Changeset - r11450:cc7b953d0155
[Not reviewed]
master
0 6 0
rubidium - 15 years ago 2009-03-22 14:55:49
rubidium@openttd.org
(svn r15813) -Codechange: remove the last remnants of the old text drawing API.
6 files changed with 42 insertions and 58 deletions:
0 comments (0 inline, 0 general)
src/gfx.cpp
Show inline comments
 
@@ -422,27 +422,12 @@ static int DrawString(int left, int righ
 
	}
 

	
 
	return align == SA_RIGHT ? left : right;
 
}
 

	
 
/**
 
 * Draw string starting at position (x,y).
 
 *
 
 * @param x      X position to start drawing
 
 * @param y      Y position to start drawing
 
 * @param str    String to draw
 
 * @param colour Colour used for drawing the string, see DoDrawString() for details
 
 *
 
 * @return Horizontal coordinate after drawing the string
 
 */
 
int DrawString(int x, int y, StringID str, TextColour colour)
 
{
 
	return DrawString(x, INT32_MAX, y, str, colour);
 
}
 

	
 
/**
 
 * Draw string, possibly truncated to make it fit in its allocated space
 
 *
 
 * @param left   The left most position to draw on.
 
 * @param right  The right most position to draw on.
 
 * @param top    The top most position to draw on.
 
 * @param str    String to draw.
src/gfx_func.h
Show inline comments
 
@@ -93,14 +93,12 @@ enum StringAlignment {
 
};
 

	
 
int DrawString(int left, int right, int top, const char *str, TextColour colour, StringAlignment align = SA_LEFT, bool underline = false);
 
int DrawString(int left, int right, int top, StringID str, TextColour colour, StringAlignment align = SA_LEFT, bool underline = false);
 
int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str, StringAlignment align = SA_LEFT);
 

	
 
int DrawString(int x, int y, StringID str, TextColour colour);
 

	
 
void DrawCharCentered(uint32 c, int x, int y, TextColour colour);
 

	
 
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode = FILLRECT_OPAQUE);
 
void GfxDrawLine(int left, int top, int right, int bottom, int colour);
 
void DrawBox(int x, int y, int dx1, int dy1, int dx2, int dy2, int dx3, int dy3);
 

	
src/smallmap_gui.cpp
Show inline comments
 
@@ -735,13 +735,13 @@ public:
 
				if (x + t->sign.width_2 > dpi->left &&
 
						x < dpi->left + dpi->width &&
 
						y + 6 > dpi->top &&
 
						y < dpi->top + dpi->height) {
 
					/* And draw it. */
 
					SetDParam(0, t->index);
 
					DrawString(x, y, STR_2056, TC_WHITE);
 
					DrawString(x, x + t->sign.width_2, y, STR_2056, TC_WHITE);
 
				}
 
			}
 
		}
 

	
 
		/* Draw map indicators */
 
		{
 
@@ -854,21 +854,21 @@ public:
 
				SetDParam(0, tbl->legend);
 
				assert(tbl->type < NUM_INDUSTRYTYPES);
 
				SetDParam(1, _industry_counts[tbl->type]);
 
				if (!tbl->show_on_map) {
 
					/* Simply draw the string, not the black border of the legend colour.
 
					 * This will enforce the idea of the disabled item */
 
					DrawString(x + 11, y, STR_SMALLMAP_INDUSTRY, TC_GREY);
 
					DrawString(x + 11, x + COLUMN_WIDTH - 1, y, STR_SMALLMAP_INDUSTRY, TC_GREY);
 
				} else {
 
					DrawString(x + 11, y, STR_SMALLMAP_INDUSTRY, TC_BLACK);
 
					DrawString(x + 11, x + COLUMN_WIDTH - 1, y, STR_SMALLMAP_INDUSTRY, TC_BLACK);
 
					GfxFillRect(x, y + 1, x + 8, y + 5, 0); // outer border of the legend colour
 
				}
 
			} else {
 
				/* Anything that is not an industry is using normal process */
 
				GfxFillRect(x, y + 1, x + 8, y + 5, 0);
 
				DrawString(x + 11, y, tbl->legend, TC_FROMSTRING);
 
				DrawString(x + 11, x + COLUMN_WIDTH - 1, y, tbl->legend, TC_FROMSTRING);
 
			}
 
			GfxFillRect(x + 1, y + 2, x + 7, y + 4, tbl->colour); // legend colour
 

	
 
			y += 6;
 
		}
 

	
src/station_gui.cpp
Show inline comments
 
@@ -31,52 +31,53 @@
 

	
 
/**
 
 * Draw small boxes of cargo amount and ratings data at the given
 
 * coordinates. If amount exceeds 576 units, it is shown 'full', same
 
 * goes for the rating: at above 90% orso (224) it is also 'full'
 
 *
 
 * @param x coordinate to draw the box at
 
 * @param left   left most coordinate to draw the box at
 
 * @param right  right most coordinate to draw the box at
 
 * @param y coordinate to draw the box at
 
 * @param type Cargo type
 
 * @param amount Cargo amount
 
 * @param rating ratings data for that particular cargo
 
 *
 
 * @note Each cargo-bar is 16 pixels wide and 6 pixels high
 
 * @note Each rating 14 pixels wide and 1 pixel high and is 1 pixel below the cargo-bar
 
 */
 
static void StationsWndShowStationRating(int x, int y, CargoID type, uint amount, byte rating)
 
static void StationsWndShowStationRating(int left, int right, int y, CargoID type, uint amount, byte rating)
 
{
 
	static const uint units_full  = 576; ///< number of units to show station as 'full'
 
	static const uint rating_full = 224; ///< rating needed so it is shown as 'full'
 

	
 
	const CargoSpec *cs = GetCargo(type);
 
	if (!cs->IsValid()) return;
 

	
 
	int colour = cs->rating_colour;
 
	uint w = (minu(amount, units_full) + 5) / 36;
 

	
 
	/* Draw total cargo (limited) on station (fits into 16 pixels) */
 
	if (w != 0) GfxFillRect(x, y, x + w - 1, y + 6, colour);
 
	if (w != 0) GfxFillRect(left, y, left + w - 1, y + 6, colour);
 

	
 
	/* Draw a one pixel-wide bar of additional cargo meter, useful
 
	 * for stations with only a small amount (<=30) */
 
	if (w == 0) {
 
		uint rest = amount / 5;
 
		if (rest != 0) {
 
			w += x;
 
			w += left;
 
			GfxFillRect(w, y + 6 - rest, w, y + 6, colour);
 
		}
 
	}
 

	
 
	DrawString(x + 1, y, cs->abbrev, TC_BLACK);
 
	DrawString(left + 1, right, y, cs->abbrev, TC_BLACK);
 

	
 
	/* Draw green/red ratings bar (fits into 14 pixels) */
 
	y += 8;
 
	GfxFillRect(x + 1, y, x + 14, y, 0xB8);
 
	GfxFillRect(left + 1, y, left + 14, y, 0xB8);
 
	rating = minu(rating, rating_full) / 16;
 
	if (rating != 0) GfxFillRect(x + 1, y, x + rating, y, 0xD0);
 
	if (rating != 0) GfxFillRect(left + 1, y, left + rating, y, 0xD0);
 
}
 

	
 
typedef GUIList<const Station*> GUIStationList;
 

	
 
/**
 
 * The list of stations per company.
 
@@ -343,16 +344,16 @@ public:
 
		DrawString(x + cg_ofst, x + cg_ofst + 12, y + cg_ofst, STR_ABBREV_NONE, TC_BLACK, SA_CENTER);
 
		x += 14;
 
		cg_ofst = this->IsWidgetLowered(SLW_CARGOALL) ? 2 : 1;
 
		DrawString(x + cg_ofst, x + cg_ofst + 12, y + cg_ofst, STR_ABBREV_ALL, TC_BLACK, SA_CENTER);
 

	
 
		cg_ofst = this->IsWidgetLowered(SLW_FACILALL) ? 2 : 1;
 
		DrawString(71 + cg_ofst, y + cg_ofst, STR_ABBREV_ALL, TC_BLACK);
 
		DrawString(71 + cg_ofst, 71 + cg_ofst + 12, y + cg_ofst, STR_ABBREV_ALL, TC_BLACK);
 

	
 
		if (this->vscroll.count == 0) { // company has no stations
 
			DrawString(xb, 40, STR_304A_NONE, TC_FROMSTRING);
 
			DrawString(xb, this->width, 40, STR_304A_NONE, TC_FROMSTRING);
 
			return;
 
		}
 

	
 
		int max = min(this->vscroll.pos + this->vscroll.cap, this->stations.Length());
 
		y = 40; // start of the list-widget
 

	
 
@@ -365,18 +366,18 @@ public:
 
			/* Do not do the complex check HasStationInUse here, it may be even false
 
			 * when the order had been removed and the station list hasn't been removed yet */
 
			assert(st->owner == owner || (st->owner == OWNER_NONE && !st->IsBuoy()));
 

	
 
			SetDParam(0, st->index);
 
			SetDParam(1, st->facilities);
 
			x = DrawString(xb, y, STR_3049_0, TC_FROMSTRING) + 5;
 
			x = DrawString(xb, this->widget[SLW_LIST].right, y, STR_3049_0, TC_FROMSTRING) + 5;
 

	
 
			/* show cargo waiting and station ratings */
 
			for (CargoID j = 0; j < NUM_CARGO; j++) {
 
				if (!st->goods[j].cargo.Empty()) {
 
					StationsWndShowStationRating(x, y, j, st->goods[j].cargo.Count(), st->goods[j].rating);
 
					StationsWndShowStationRating(x, this->widget[SLW_LIST].right, y, j, st->goods[j].cargo.Count(), st->goods[j].rating);
 
					x += 20;
 
				}
 
			}
 
			y += 10;
 
		}
 
	}
 
@@ -799,13 +800,13 @@ struct StationViewWindow : public Window
 
		if (--pos < 0) {
 
			str = STR_00D0_NOTHING;
 
			for (CargoID i = 0; i < NUM_CARGO; i++) {
 
				if (!st->goods[i].cargo.Empty()) str = STR_EMPTY;
 
			}
 
			SetDParam(0, str);
 
			DrawString(x, y, STR_0008_WAITING, TC_FROMSTRING);
 
			DrawString(x, this->widget[SVW_WAITING].right - 2, y, STR_0008_WAITING, TC_FROMSTRING);
 
			y += 10;
 
		}
 

	
 
		for (CargoDataList::const_iterator it = cargolist.begin(); it != cargolist.end() && pos > -maxrows; ++it) {
 
			if (--pos < 0) {
 
				const CargoData *cd = &(*it);
 
@@ -864,26 +865,26 @@ struct StationViewWindow : public Window
 

	
 
			SetDParamStr(0, string);
 
			DrawStringMultiLine(this->widget[SVW_ACCEPTLIST].left + 2, this->widget[SVW_ACCEPTLIST].right - 2, this->widget[SVW_ACCEPTLIST].bottom - 1, this->widget[SVW_ACCEPTLIST].top + 1, STR_JUST_RAW_STRING);
 
		} else { // extended window with list of cargo ratings
 
			y = this->widget[SVW_RATINGLIST].top + 1;
 

	
 
			DrawString(2, y, STR_3034_LOCAL_RATING_OF_TRANSPORT, TC_FROMSTRING);
 
			DrawString(this->widget[SVW_ACCEPTLIST].left + 2, this->widget[SVW_ACCEPTLIST].right - 2, y, STR_3034_LOCAL_RATING_OF_TRANSPORT, TC_FROMSTRING);
 
			y += 10;
 

	
 
			for (CargoID i = 0; i < NUM_CARGO; i++) {
 
				const CargoSpec *cs = GetCargo(i);
 
				if (!cs->IsValid()) continue;
 

	
 
				const GoodsEntry *ge = &st->goods[i];
 
				if (!HasBit(ge->acceptance_pickup, GoodsEntry::PICKUP)) continue;
 

	
 
				SetDParam(0, cs->name);
 
				SetDParam(2, ge->rating * 101 >> 8);
 
				SetDParam(1, STR_3035_APPALLING + (ge->rating >> 5));
 
				DrawString(8, y, STR_303D, TC_FROMSTRING);
 
				DrawString(this->widget[SVW_ACCEPTLIST].left + 8, this->widget[SVW_ACCEPTLIST].right - 2, y, STR_303D, TC_FROMSTRING);
 
				y += 10;
 
			}
 
		}
 
	}
 

	
 
	void HandleCargoWaitingClick(int row)
src/timetable_gui.cpp
Show inline comments
 
@@ -225,22 +225,22 @@ struct TimetableWindow : Window {
 
				if (order->travel_time == 0 && !order->IsType(OT_CONDITIONAL)) complete = false;
 
				if (order->wait_time == 0 && order->IsType(OT_GOTO_STATION) && !(order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION)) complete = false;
 
			}
 

	
 
			if (total_time != 0) {
 
				SetTimetableParams(0, 1, total_time);
 
				DrawString(2, y, complete ? STR_TIMETABLE_TOTAL_TIME : STR_TIMETABLE_TOTAL_TIME_INCOMPLETE, TC_BLACK);
 
				DrawString(this->widget[TTV_SUMMARY_PANEL].left + 2, this->widget[TTV_SUMMARY_PANEL].right - 2, y, complete ? STR_TIMETABLE_TOTAL_TIME : STR_TIMETABLE_TOTAL_TIME_INCOMPLETE, TC_BLACK);
 
			}
 
		}
 
		y += 10;
 

	
 
		if (v->lateness_counter == 0 || (!_settings_client.gui.timetable_in_ticks && v->lateness_counter / DAY_TICKS == 0)) {
 
			DrawString(2, y, STR_TIMETABLE_STATUS_ON_TIME, TC_BLACK);
 
			DrawString(this->widget[TTV_SUMMARY_PANEL].left + 2, this->widget[TTV_SUMMARY_PANEL].right - 2, y, STR_TIMETABLE_STATUS_ON_TIME, TC_BLACK);
 
		} else {
 
			SetTimetableParams(0, 1, abs(v->lateness_counter));
 
			DrawString(2, y, v->lateness_counter < 0 ? STR_TIMETABLE_STATUS_EARLY : STR_TIMETABLE_STATUS_LATE, TC_BLACK);
 
			DrawString(this->widget[TTV_SUMMARY_PANEL].left + 2, this->widget[TTV_SUMMARY_PANEL].right - 2, y, v->lateness_counter < 0 ? STR_TIMETABLE_STATUS_EARLY : STR_TIMETABLE_STATUS_LATE, TC_BLACK);
 
		}
 
	}
 

	
 
	static inline uint32 PackTimetableArgs(const Vehicle *v, uint selected)
 
	{
 
		uint order_number = (selected + 1) / 2;
src/vehicle_gui.cpp
Show inline comments
 
@@ -227,13 +227,13 @@ static RefitList *BuildRefitList(const V
 
 * @param sel selected refit cargo-type in the window
 
 * @param pos position of the selected item in caller widow
 
 * @param rows number of rows(capacity) in caller window
 
 * @param delta step height in caller window
 
 * @return the refit option that is hightlighted, NULL if none
 
 */
 
static RefitOption *DrawVehicleRefitWindow(const RefitList *list, int sel, uint pos, uint rows, uint delta)
 
static RefitOption *DrawVehicleRefitWindow(const RefitList *list, int sel, uint pos, uint rows, uint delta, uint right)
 
{
 
	RefitOption *refit = list->items;
 
	RefitOption *selected = NULL;
 
	uint num_lines = list->num_lines;
 
	uint y = 31;
 
	uint i;
 
@@ -245,17 +245,17 @@ static RefitOption *DrawVehicleRefitWind
 
			selected = &refit[i];
 
			colour = TC_WHITE;
 
		}
 

	
 
		if (i >= pos && i < pos + rows) {
 
			/* Draw the cargo name */
 
			int last_x = DrawString(2, y, GetCargo(refit[i].cargo)->name, colour);
 
			int last_x = DrawString(2, right, y, GetCargo(refit[i].cargo)->name, colour);
 

	
 
			/* If the callback succeeded, draw the cargo suffix */
 
			if (refit[i].value != CALLBACK_FAILED) {
 
				DrawString(last_x + 1, y, GetGRFStringID(GetEngineGRFID(refit[i].engine), 0xD000 + refit[i].value), colour);
 
				DrawString(last_x + 1, right, y, GetGRFStringID(GetEngineGRFID(refit[i].engine), 0xD000 + refit[i].value), colour);
 
			}
 
			y += delta;
 
		}
 

	
 
		sel--;
 
	}
 
@@ -337,25 +337,25 @@ struct RefitWindow : public Window {
 

	
 
		SetVScrollCount(this, this->list->num_lines);
 

	
 
		SetDParam(0, v->index);
 
		this->DrawWidgets();
 

	
 
		this->cargo = DrawVehicleRefitWindow(this->list, this->sel, this->vscroll.pos, this->vscroll.cap, this->resize.step_height);
 
		this->cargo = DrawVehicleRefitWindow(this->list, this->sel, this->vscroll.pos, this->vscroll.cap, this->resize.step_height, this->width - 2);
 

	
 
		if (this->cargo != NULL) {
 
			CommandCost cost;
 

	
 
			cost = DoCommand(v->tile, v->index, this->cargo->cargo | this->cargo->subtype << 8,
 
							 DC_QUERY_COST, GetCmdRefitVeh(v->type));
 

	
 
			if (CmdSucceeded(cost)) {
 
				SetDParam(0, this->cargo->cargo);
 
				SetDParam(1, _returned_refit_capacity);
 
				SetDParam(2, cost.GetCost());
 
				DrawString(2, this->widget[5].top + 1, STR_9840_NEW_CAPACITY_COST_OF_REFIT, TC_FROMSTRING);
 
				DrawString(2, this->width - 2, this->widget[5].top + 1, STR_9840_NEW_CAPACITY_COST_OF_REFIT, TC_FROMSTRING);
 
			}
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	{
 
@@ -713,28 +713,28 @@ static const Widget _vehicle_list_widget
 
	{ WWT_PUSHIMGBTN,     RESIZE_TB,  COLOUR_GREY,   236,   247,   182,   193, SPR_FLAG_VEH_RUNNING, STR_MASS_START_LIST_TIP},
 
	{      WWT_PANEL,    RESIZE_RTB,  COLOUR_GREY,   248,   247,   182,   193, 0x0,                  STR_NULL},
 
	{  WWT_RESIZEBOX,   RESIZE_LRTB,  COLOUR_GREY,   248,   259,   182,   193, 0x0,                  STR_RESIZE_BUTTON},
 
	{   WIDGETS_END},
 
};
 

	
 
static void DrawSmallOrderList(const Vehicle *v, int x, int y)
 
static void DrawSmallOrderList(const Vehicle *v, int left, int right, int y)
 
{
 
	const Order *order;
 
	int sel, i = 0;
 

	
 
	sel = v->cur_order_index;
 

	
 
	FOR_VEHICLE_ORDERS(v, order) {
 
		if (sel == 0) DrawString(x - 6, y, STR_SMALL_RIGHT_ARROW, TC_BLACK);
 
		if (sel == 0) DrawString(left - 6, left, y, STR_SMALL_RIGHT_ARROW, TC_BLACK);
 
		sel--;
 

	
 
		if (order->IsType(OT_GOTO_STATION)) {
 
			if (v->type == VEH_SHIP && GetStation(order->GetDestination())->IsBuoy()) continue;
 

	
 
			SetDParam(0, order->GetDestination());
 
			DrawString(x, y, STR_A036, TC_FROMSTRING);
 
			DrawString(left, right, y, STR_A036, TC_FROMSTRING);
 

	
 
			y += 6;
 
			if (++i == 4) break;
 
		}
 
	}
 
}
 
@@ -764,34 +764,34 @@ void BaseVehicleListWindow::DrawVehicleL
 
		StringID str;
 

	
 
		SetDParam(0, v->GetDisplayProfitThisYear());
 
		SetDParam(1, v->GetDisplayProfitLastYear());
 

	
 
		DrawVehicleImage(v, x + 19, y + 6, selected_vehicle, this->widget[VLW_WIDGET_LIST].right - this->widget[VLW_WIDGET_LIST].left - 20, 0);
 
		DrawString(x + 19, y + this->resize.step_height - 8, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, TC_FROMSTRING);
 
		DrawString(x + 19, this->widget[VLW_WIDGET_LIST].right, y + this->resize.step_height - 8, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, TC_FROMSTRING);
 

	
 
		if (v->name != NULL) {
 
			/* The vehicle got a name so we will print it */
 
			SetDParam(0, v->index);
 
			DrawString(x + 19, y, STR_01AB, TC_FROMSTRING);
 
			DrawString(x + 19, this->widget[VLW_WIDGET_LIST].right, y, STR_01AB, TC_FROMSTRING);
 
		} else if (v->group_id != DEFAULT_GROUP) {
 
			/* The vehicle has no name, but is member of a group, so print group name */
 
			SetDParam(0, v->group_id);
 
			DrawString(x + 19, y, STR_GROUP_TINY_NAME, TC_BLACK);
 
			DrawString(x + 19, this->widget[VLW_WIDGET_LIST].right, y, STR_GROUP_TINY_NAME, TC_BLACK);
 
		}
 

	
 
		if (this->resize.step_height == PLY_WND_PRC__SIZE_OF_ROW_BIG) DrawSmallOrderList(v, x + 138, y);
 
		if (this->resize.step_height == PLY_WND_PRC__SIZE_OF_ROW_BIG) DrawSmallOrderList(v, x + 138, this->widget[VLW_WIDGET_LIST].right, y);
 

	
 
		if (v->IsInDepot()) {
 
			str = STR_021F;
 
		} else {
 
			str = (v->age > v->max_age - DAYS_IN_LEAP_YEAR) ? STR_00E3 : STR_00E2;
 
		}
 

	
 
		SetDParam(0, v->unitnumber);
 
		DrawString(x, y + 2, str, TC_FROMSTRING);
 
		DrawString(x, this->widget[VLW_WIDGET_LIST].right, y + 2, str, TC_FROMSTRING);
 

	
 
		DrawVehicleProfitButton(v, x, y + 13);
 

	
 
		y += this->resize.step_height;
 
	}
 
}
 
@@ -1002,13 +1002,13 @@ struct VehicleListWindow : public BaseVe
 
			VLW_WIDGET_START_ALL,
 
			WIDGET_LIST_END);
 

	
 
		this->DrawWidgets();
 

	
 
		/* draw sorting criteria string */
 
		DrawString(85, 15, this->vehicle_sorter_names[this->vehicles.SortType()], TC_BLACK);
 
		DrawString(85, this->widget[VLW_WIDGET_SORT_ORDER].right, 15, this->vehicle_sorter_names[this->vehicles.SortType()], TC_BLACK);
 
		/* draw arrow pointing up/down for ascending/descending sorting */
 
		this->DrawSortButtonState(VLW_WIDGET_SORT_ORDER, this->vehicles.IsDescSortOrder() ? SBS_DOWN : SBS_UP);
 

	
 
		this->DrawVehicleListItems(x,  INVALID_VEHICLE);
 
	}
 

	
 
@@ -1414,50 +1414,50 @@ struct VehicleDetailsWindow : Window {
 

	
 
		/* Draw running cost */
 
		SetDParam(1, v->age / DAYS_IN_LEAP_YEAR);
 
		SetDParam(0, (v->age + DAYS_IN_YEAR < v->max_age) ? STR_AGE : STR_AGE_RED);
 
		SetDParam(2, v->max_age / DAYS_IN_LEAP_YEAR);
 
		SetDParam(3, v->GetDisplayRunningCost());
 
		DrawString(2, 15, _vehicle_translation_table[VST_VEHICLE_AGE_RUNNING_COST_YR][v->type], TC_FROMSTRING);
 
		DrawString(2, this->width - 2, 15, _vehicle_translation_table[VST_VEHICLE_AGE_RUNNING_COST_YR][v->type], TC_FROMSTRING);
 

	
 
		/* Draw max speed */
 
		switch (v->type) {
 
			case VEH_TRAIN:
 
				SetDParam(2, v->GetDisplayMaxSpeed());
 
				SetDParam(1, v->u.rail.cached_power);
 
				SetDParam(0, v->u.rail.cached_weight);
 
				SetDParam(3, v->u.rail.cached_max_te / 1000);
 
				DrawString(2, 25, (_settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL && v->u.rail.railtype != RAILTYPE_MAGLEV) ?
 
				DrawString(2, this->width - 2, 25, (_settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL && v->u.rail.railtype != RAILTYPE_MAGLEV) ?
 
					STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE :
 
					STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED, TC_FROMSTRING);
 
				break;
 

	
 
			case VEH_ROAD:
 
			case VEH_SHIP:
 
			case VEH_AIRCRAFT:
 
				SetDParam(0, v->GetDisplayMaxSpeed());
 
				DrawString(2, 25, _vehicle_translation_table[VST_VEHICLE_MAX_SPEED][v->type], TC_FROMSTRING);
 
				DrawString(2, this->width - 2, 25, _vehicle_translation_table[VST_VEHICLE_MAX_SPEED][v->type], TC_FROMSTRING);
 
				break;
 

	
 
			default: NOT_REACHED();
 
		}
 

	
 
		/* Draw profit */
 
		SetDParam(0, v->GetDisplayProfitThisYear());
 
		SetDParam(1, v->GetDisplayProfitLastYear());
 
		DrawString(2, 35, _vehicle_translation_table[VST_VEHICLE_PROFIT_THIS_YEAR_LAST_YEAR][v->type], TC_FROMSTRING);
 
		DrawString(2, this->width - 2, 35, _vehicle_translation_table[VST_VEHICLE_PROFIT_THIS_YEAR_LAST_YEAR][v->type], TC_FROMSTRING);
 

	
 
		/* Draw breakdown & reliability */
 
		SetDParam(0, v->reliability * 100 >> 16);
 
		SetDParam(1, v->breakdowns_since_last_service);
 
		DrawString(2, 45, _vehicle_translation_table[VST_VEHICLE_RELIABILITY_BREAKDOWNS][v->type], TC_FROMSTRING);
 
		DrawString(2, this->width - 2, 45, _vehicle_translation_table[VST_VEHICLE_RELIABILITY_BREAKDOWNS][v->type], TC_FROMSTRING);
 

	
 
		/* Draw service interval text */
 
		SetDParam(0, v->service_interval);
 
		SetDParam(1, v->date_of_last_service);
 
		DrawString(13, this->height - (v->type != VEH_TRAIN ? 11 : 23), _settings_game.vehicle.servint_ispercent ? STR_SERVICING_INTERVAL_PERCENT : STR_883C_SERVICING_INTERVAL_DAYS, TC_FROMSTRING);
 
		DrawString(13, this->width - 2, this->height - (v->type != VEH_TRAIN ? 11 : 23), _settings_game.vehicle.servint_ispercent ? STR_SERVICING_INTERVAL_PERCENT : STR_883C_SERVICING_INTERVAL_DAYS, TC_FROMSTRING);
 

	
 
		switch (v->type) {
 
			case VEH_TRAIN:
 
				DrawVehicleDetails(v, 2, this->width - 2, 57, this->vscroll.pos, this->vscroll.cap, det_tab);
 
				break;
 

	
0 comments (0 inline, 0 general)