Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #include "stdafx.h"
00013 #include "vehicle_base.h"
00014 #include "window_gui.h"
00015 #include "gfx_func.h"
00016 #include "vehicle_gui.h"
00017 #include "strings_func.h"
00018 #include "vehicle_func.h"
00019 #include "spritecache.h"
00020
00021 #include "table/strings.h"
00022
00031 void DrawShipImage(const Vehicle *v, int left, int right, int y, VehicleID selection)
00032 {
00033 bool rtl = _current_text_dir == TD_RTL;
00034
00035 SpriteID sprite = v->GetImage(rtl ? DIR_E : DIR_W);
00036 const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
00037
00038 int x = rtl ? right - real_sprite->width - real_sprite->x_offs : left - real_sprite->x_offs;
00039
00040 DrawSprite(sprite, GetVehiclePalette(v), x, y + 10);
00041
00042 if (v->index == selection) {
00043 x += real_sprite->x_offs;
00044 y += real_sprite->y_offs + 10;
00045 DrawFrameRect(x - 1, y - 1, x + real_sprite->width + 1, y + real_sprite->height + 1, COLOUR_WHITE, FR_BORDERONLY);
00046 }
00047 }
00048
00057 void DrawShipDetails(const Vehicle *v, int left, int right, int y)
00058 {
00059 SetDParam(0, v->engine_type);
00060 SetDParam(1, v->build_year);
00061 SetDParam(2, v->value);
00062 DrawString(left, right, y, STR_VEHICLE_INFO_BUILT_VALUE, TC_FROMSTRING, SA_LEFT | SA_STRIP);
00063
00064 SetDParam(0, v->cargo_type);
00065 SetDParam(1, v->cargo_cap);
00066 SetDParam(4, GetCargoSubtypeText(v));
00067 DrawString(left, right, y + FONT_HEIGHT_NORMAL, STR_VEHICLE_INFO_CAPACITY);
00068
00069 StringID str = STR_VEHICLE_DETAILS_CARGO_EMPTY;
00070 if (!v->cargo.Empty()) {
00071 SetDParam(0, v->cargo_type);
00072 SetDParam(1, v->cargo.Count());
00073 SetDParam(2, v->cargo.Source());
00074 str = STR_VEHICLE_DETAILS_CARGO_FROM;
00075 }
00076 DrawString(left, right, y + 2 * FONT_HEIGHT_NORMAL + 1, str);
00077
00078
00079 SetDParam(0, v->cargo.FeederShare());
00080 DrawString(left, right, y + 3 * FONT_HEIGHT_NORMAL + 3, STR_VEHICLE_INFO_FEEDER_CARGO_VALUE);
00081 }