(svn r15807) -Codechange: let the build vehicle gui helper function pass around left and right instead of only left and assuming infinite width.

This commit is contained in:
rubidium 2009-03-22 11:06:25 +00:00
parent ead0a6a6e5
commit dfe5dad5f6
4 changed files with 52 additions and 53 deletions

View File

@ -327,7 +327,7 @@ public:
/* Also draw the details if an engine is selected */ /* Also draw the details if an engine is selected */
if (this->sel_engine[i] != INVALID_ENGINE) { if (this->sel_engine[i] != INVALID_ENGINE) {
const Widget *wi = &this->widget[i == 0 ? RVW_WIDGET_LEFT_DETAILS : RVW_WIDGET_RIGHT_DETAILS]; const Widget *wi = &this->widget[i == 0 ? RVW_WIDGET_LEFT_DETAILS : RVW_WIDGET_RIGHT_DETAILS];
int text_end = DrawVehiclePurchaseInfo(wi->left + 2, wi->top + 1, wi->right - wi->left - 2, this->sel_engine[i]); int text_end = DrawVehiclePurchaseInfo(wi->left + 2, wi->right - 2, wi->top + 1, this->sel_engine[i]);
if (text_end > wi->bottom) { if (text_end > wi->bottom) {
this->SetDirty(); this->SetDirty();

View File

@ -353,7 +353,7 @@ static const StringID _sort_listing[][11] = {{
INVALID_STRING_ID INVALID_STRING_ID
}}; }};
static int DrawCargoCapacityInfo(int x, int y, EngineID engine, VehicleType type, bool refittable) static int DrawCargoCapacityInfo(int left, int right, int y, EngineID engine, VehicleType type, bool refittable)
{ {
uint16 *cap = GetCapacityOfArticulatedParts(engine, type); uint16 *cap = GetCapacityOfArticulatedParts(engine, type);
@ -363,7 +363,7 @@ static int DrawCargoCapacityInfo(int x, int y, EngineID engine, VehicleType type
SetDParam(0, c); SetDParam(0, c);
SetDParam(1, cap[c]); SetDParam(1, cap[c]);
SetDParam(2, refittable ? STR_9842_REFITTABLE : STR_EMPTY); SetDParam(2, refittable ? STR_9842_REFITTABLE : STR_EMPTY);
DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING);
y += 10; y += 10;
/* Only show as refittable once */ /* Only show as refittable once */
@ -374,13 +374,13 @@ static int DrawCargoCapacityInfo(int x, int y, EngineID engine, VehicleType type
} }
/* Draw rail wagon specific details */ /* Draw rail wagon specific details */
static int DrawRailWagonPurchaseInfo(int x, int y, EngineID engine_number, const RailVehicleInfo *rvi) static int DrawRailWagonPurchaseInfo(int left, int right, int y, EngineID engine_number, const RailVehicleInfo *rvi)
{ {
const Engine *e = GetEngine(engine_number); const Engine *e = GetEngine(engine_number);
/* Purchase cost */ /* Purchase cost */
SetDParam(0, e->GetCost()); SetDParam(0, e->GetCost());
DrawString(x, y, STR_PURCHASE_INFO_COST, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_COST, TC_FROMSTRING);
y += 10; y += 10;
/* Wagon weight - (including cargo) */ /* Wagon weight - (including cargo) */
@ -388,7 +388,7 @@ static int DrawRailWagonPurchaseInfo(int x, int y, EngineID engine_number, const
SetDParam(0, weight); SetDParam(0, weight);
uint cargo_weight = (e->CanCarryCargo() ? GetCargo(e->GetDefaultCargoType())->weight * e->GetDisplayDefaultCapacity() >> 4 : 0); uint cargo_weight = (e->CanCarryCargo() ? GetCargo(e->GetDefaultCargoType())->weight * e->GetDisplayDefaultCapacity() >> 4 : 0);
SetDParam(1, cargo_weight + weight); SetDParam(1, cargo_weight + weight);
DrawString(x, y, STR_PURCHASE_INFO_WEIGHT_CWEIGHT, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_WEIGHT_CWEIGHT, TC_FROMSTRING);
y += 10; y += 10;
/* Wagon speed limit, displayed if above zero */ /* Wagon speed limit, displayed if above zero */
@ -396,7 +396,7 @@ static int DrawRailWagonPurchaseInfo(int x, int y, EngineID engine_number, const
uint max_speed = e->GetDisplayMaxSpeed(); uint max_speed = e->GetDisplayMaxSpeed();
if (max_speed > 0) { if (max_speed > 0) {
SetDParam(0, max_speed); SetDParam(0, max_speed);
DrawString(x, y, STR_PURCHASE_INFO_SPEED, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_SPEED, TC_FROMSTRING);
y += 10; y += 10;
} }
} }
@ -404,7 +404,7 @@ static int DrawRailWagonPurchaseInfo(int x, int y, EngineID engine_number, const
/* Running cost */ /* Running cost */
if (rvi->running_cost_class != 0xFF) { if (rvi->running_cost_class != 0xFF) {
SetDParam(0, e->GetRunningCost()); SetDParam(0, e->GetRunningCost());
DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING);
y += 10; y += 10;
} }
@ -412,33 +412,33 @@ static int DrawRailWagonPurchaseInfo(int x, int y, EngineID engine_number, const
} }
/* Draw locomotive specific details */ /* Draw locomotive specific details */
static int DrawRailEnginePurchaseInfo(int x, int y, EngineID engine_number, const RailVehicleInfo *rvi) static int DrawRailEnginePurchaseInfo(int left, int right, int y, EngineID engine_number, const RailVehicleInfo *rvi)
{ {
const Engine *e = GetEngine(engine_number); const Engine *e = GetEngine(engine_number);
/* Purchase Cost - Engine weight */ /* Purchase Cost - Engine weight */
SetDParam(0, e->GetCost()); SetDParam(0, e->GetCost());
SetDParam(1, e->GetDisplayWeight()); SetDParam(1, e->GetDisplayWeight());
DrawString(x, y, STR_PURCHASE_INFO_COST_WEIGHT, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_COST_WEIGHT, TC_FROMSTRING);
y += 10; y += 10;
/* Max speed - Engine power */ /* Max speed - Engine power */
SetDParam(0, e->GetDisplayMaxSpeed()); SetDParam(0, e->GetDisplayMaxSpeed());
SetDParam(1, e->GetPower()); SetDParam(1, e->GetPower());
DrawString(x, y, STR_PURCHASE_INFO_SPEED_POWER, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_SPEED_POWER, TC_FROMSTRING);
y += 10; y += 10;
/* Max tractive effort - not applicable if old acceleration or maglev */ /* Max tractive effort - not applicable if old acceleration or maglev */
if (_settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL && rvi->railtype != RAILTYPE_MAGLEV) { if (_settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL && rvi->railtype != RAILTYPE_MAGLEV) {
SetDParam(0, e->GetDisplayMaxTractiveEffort()); SetDParam(0, e->GetDisplayMaxTractiveEffort());
DrawString(x, y, STR_PURCHASE_INFO_MAX_TE, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_MAX_TE, TC_FROMSTRING);
y += 10; y += 10;
} }
/* Running cost */ /* Running cost */
if (rvi->running_cost_class != 0xFF) { if (rvi->running_cost_class != 0xFF) {
SetDParam(0, e->GetRunningCost()); SetDParam(0, e->GetRunningCost());
DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING);
y += 10; y += 10;
} }
@ -446,7 +446,7 @@ static int DrawRailEnginePurchaseInfo(int x, int y, EngineID engine_number, cons
if (rvi->pow_wag_power != 0) { if (rvi->pow_wag_power != 0) {
SetDParam(0, rvi->pow_wag_power); SetDParam(0, rvi->pow_wag_power);
SetDParam(1, rvi->pow_wag_weight); SetDParam(1, rvi->pow_wag_weight);
DrawString(x, y, STR_PURCHASE_INFO_PWAGPOWER_PWAGWEIGHT, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_PWAGPOWER_PWAGWEIGHT, TC_FROMSTRING);
y += 10; y += 10;
}; };
@ -454,52 +454,52 @@ static int DrawRailEnginePurchaseInfo(int x, int y, EngineID engine_number, cons
} }
/* Draw road vehicle specific details */ /* Draw road vehicle specific details */
static int DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number) static int DrawRoadVehPurchaseInfo(int left, int right, int y, EngineID engine_number)
{ {
const Engine *e = GetEngine(engine_number); const Engine *e = GetEngine(engine_number);
/* Purchase cost - Max speed */ /* Purchase cost - Max speed */
SetDParam(0, e->GetCost()); SetDParam(0, e->GetCost());
SetDParam(1, e->GetDisplayMaxSpeed()); SetDParam(1, e->GetDisplayMaxSpeed());
DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING);
y += 10; y += 10;
/* Running cost */ /* Running cost */
SetDParam(0, e->GetRunningCost()); SetDParam(0, e->GetRunningCost());
DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING);
y += 10; y += 10;
return y; return y;
} }
/* Draw ship specific details */ /* Draw ship specific details */
static int DrawShipPurchaseInfo(int x, int y, EngineID engine_number, const ShipVehicleInfo *svi, bool refittable) static int DrawShipPurchaseInfo(int left, int right, int y, EngineID engine_number, const ShipVehicleInfo *svi, bool refittable)
{ {
const Engine *e = GetEngine(engine_number); const Engine *e = GetEngine(engine_number);
/* Purchase cost - Max speed */ /* Purchase cost - Max speed */
SetDParam(0, e->GetCost()); SetDParam(0, e->GetCost());
SetDParam(1, e->GetDisplayMaxSpeed()); SetDParam(1, e->GetDisplayMaxSpeed());
DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING);
y += 10; y += 10;
/* Cargo type + capacity */ /* Cargo type + capacity */
SetDParam(0, e->GetDefaultCargoType()); SetDParam(0, e->GetDefaultCargoType());
SetDParam(1, e->GetDisplayDefaultCapacity()); SetDParam(1, e->GetDisplayDefaultCapacity());
SetDParam(2, refittable ? STR_9842_REFITTABLE : STR_EMPTY); SetDParam(2, refittable ? STR_9842_REFITTABLE : STR_EMPTY);
DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING);
y += 10; y += 10;
/* Running cost */ /* Running cost */
SetDParam(0, e->GetRunningCost()); SetDParam(0, e->GetRunningCost());
DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING);
y += 10; y += 10;
return y; return y;
} }
/* Draw aircraft specific details */ /* Draw aircraft specific details */
static int DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number, const AircraftVehicleInfo *avi, bool refittable) static int DrawAircraftPurchaseInfo(int left, int right, int y, EngineID engine_number, const AircraftVehicleInfo *avi, bool refittable)
{ {
const Engine *e = GetEngine(engine_number); const Engine *e = GetEngine(engine_number);
CargoID cargo = e->GetDefaultCargoType(); CargoID cargo = e->GetDefaultCargoType();
@ -507,27 +507,27 @@ static int DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number, const
/* Purchase cost - Max speed */ /* Purchase cost - Max speed */
SetDParam(0, e->GetCost()); SetDParam(0, e->GetCost());
SetDParam(1, e->GetDisplayMaxSpeed()); SetDParam(1, e->GetDisplayMaxSpeed());
DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING);
y += 10; y += 10;
/* Cargo capacity */ /* Cargo capacity */
if (cargo == CT_INVALID || cargo == CT_PASSENGERS) { if (cargo == CT_INVALID || cargo == CT_PASSENGERS) {
SetDParam(0, e->GetDisplayDefaultCapacity()); SetDParam(0, e->GetDisplayDefaultCapacity());
SetDParam(1, avi->mail_capacity); SetDParam(1, avi->mail_capacity);
DrawString(x, y, STR_PURCHASE_INFO_AIRCRAFT_CAPACITY, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_AIRCRAFT_CAPACITY, TC_FROMSTRING);
} else { } else {
/* Note, if the default capacity is selected by the refit capacity /* Note, if the default capacity is selected by the refit capacity
* callback, then the capacity shown is likely to be incorrect. */ * callback, then the capacity shown is likely to be incorrect. */
SetDParam(0, cargo); SetDParam(0, cargo);
SetDParam(1, e->GetDisplayDefaultCapacity()); SetDParam(1, e->GetDisplayDefaultCapacity());
SetDParam(2, refittable ? STR_9842_REFITTABLE : STR_EMPTY); SetDParam(2, refittable ? STR_9842_REFITTABLE : STR_EMPTY);
DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING);
} }
y += 10; y += 10;
/* Running cost */ /* Running cost */
SetDParam(0, e->GetRunningCost()); SetDParam(0, e->GetRunningCost());
DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING);
y += 10; y += 10;
return y; return y;
@ -535,12 +535,11 @@ static int DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number, const
/** /**
* Draw the purchase info details of a vehicle at a given location. * Draw the purchase info details of a vehicle at a given location.
* @param x,y location where to draw the info * @param left,right,y location where to draw the info
* @param w how wide are the text allowed to be (size of widget/window to Draw in)
* @param engine_number the engine of which to draw the info of * @param engine_number the engine of which to draw the info of
* @return y after drawing all the text * @return y after drawing all the text
*/ */
int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number) int DrawVehiclePurchaseInfo(int left, int right, int y, EngineID engine_number)
{ {
const Engine *e = GetEngine(engine_number); const Engine *e = GetEngine(engine_number);
YearMonthDay ymd; YearMonthDay ymd;
@ -552,18 +551,18 @@ int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number)
case VEH_TRAIN: { case VEH_TRAIN: {
const RailVehicleInfo *rvi = RailVehInfo(engine_number); const RailVehicleInfo *rvi = RailVehInfo(engine_number);
if (rvi->railveh_type == RAILVEH_WAGON) { if (rvi->railveh_type == RAILVEH_WAGON) {
y = DrawRailWagonPurchaseInfo(x, y, engine_number, rvi); y = DrawRailWagonPurchaseInfo(left, right, y, engine_number, rvi);
} else { } else {
y = DrawRailEnginePurchaseInfo(x, y, engine_number, rvi); y = DrawRailEnginePurchaseInfo(left, right, y, engine_number, rvi);
} }
/* Cargo type + capacity, or N/A */ /* Cargo type + capacity, or N/A */
int new_y = DrawCargoCapacityInfo(x, y, engine_number, VEH_TRAIN, refittable); int new_y = DrawCargoCapacityInfo(left, right, y, engine_number, VEH_TRAIN, refittable);
if (new_y == y) { if (new_y == y) {
SetDParam(0, CT_INVALID); SetDParam(0, CT_INVALID);
SetDParam(2, STR_EMPTY); SetDParam(2, STR_EMPTY);
DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING);
y += 10; y += 10;
} else { } else {
y = new_y; y = new_y;
@ -571,15 +570,15 @@ int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number)
break; break;
} }
case VEH_ROAD: { case VEH_ROAD: {
y = DrawRoadVehPurchaseInfo(x, y, engine_number); y = DrawRoadVehPurchaseInfo(left, right, y, engine_number);
/* Cargo type + capacity, or N/A */ /* Cargo type + capacity, or N/A */
int new_y = DrawCargoCapacityInfo(x, y, engine_number, VEH_ROAD, refittable); int new_y = DrawCargoCapacityInfo(left, right, y, engine_number, VEH_ROAD, refittable);
if (new_y == y) { if (new_y == y) {
SetDParam(0, CT_INVALID); SetDParam(0, CT_INVALID);
SetDParam(2, STR_EMPTY); SetDParam(2, STR_EMPTY);
DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING);
y += 10; y += 10;
} else { } else {
y = new_y; y = new_y;
@ -587,10 +586,10 @@ int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number)
break; break;
} }
case VEH_SHIP: case VEH_SHIP:
y = DrawShipPurchaseInfo(x, y, engine_number, ShipVehInfo(engine_number), refittable); y = DrawShipPurchaseInfo(left, right, y, engine_number, ShipVehInfo(engine_number), refittable);
break; break;
case VEH_AIRCRAFT: case VEH_AIRCRAFT:
y = DrawAircraftPurchaseInfo(x, y, engine_number, AircraftVehInfo(engine_number), refittable); y = DrawAircraftPurchaseInfo(left, right, y, engine_number, AircraftVehInfo(engine_number), refittable);
break; break;
} }
@ -599,18 +598,18 @@ int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number)
/* Design date - Life length */ /* Design date - Life length */
SetDParam(0, ymd.year); SetDParam(0, ymd.year);
SetDParam(1, e->lifelength); SetDParam(1, e->lifelength);
DrawString(x, y, STR_PURCHASE_INFO_DESIGNED_LIFE, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_DESIGNED_LIFE, TC_FROMSTRING);
y += 10; y += 10;
/* Reliability */ /* Reliability */
SetDParam(0, e->reliability * 100 >> 16); SetDParam(0, e->reliability * 100 >> 16);
DrawString(x, y, STR_PURCHASE_INFO_RELIABILITY, TC_FROMSTRING); DrawString(left, right, y, STR_PURCHASE_INFO_RELIABILITY, TC_FROMSTRING);
y += 10; y += 10;
} }
/* Additional text from NewGRF */ /* Additional text from NewGRF */
y += ShowAdditionalText(x, y, w, engine_number); y = ShowAdditionalText(left, right, y, engine_number);
if (refittable) y += ShowRefitOptionsList(x, y, w, engine_number); if (refittable) y = ShowRefitOptionsList(left, right, y, engine_number);
return y; return y;
} }
@ -1031,7 +1030,7 @@ struct BuildVehicleWindow : Window {
if (this->sel_engine != INVALID_ENGINE) { if (this->sel_engine != INVALID_ENGINE) {
const Widget *wi = &this->widget[BUILD_VEHICLE_WIDGET_PANEL]; const Widget *wi = &this->widget[BUILD_VEHICLE_WIDGET_PANEL];
int text_end = DrawVehiclePurchaseInfo(2, wi->top + 1, wi->right - wi->left - 2, this->sel_engine); int text_end = DrawVehiclePurchaseInfo(wi->left + 2, wi->right - 2, wi->top + 1, this->sel_engine);
if (text_end > wi->bottom) { if (text_end > wi->bottom) {
this->SetDirty(); this->SetDirty();

View File

@ -431,21 +431,21 @@ void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *pare
} }
/** Display additional text from NewGRF in the purchase information window */ /** Display additional text from NewGRF in the purchase information window */
uint ShowAdditionalText(int x, int y, uint w, EngineID engine) uint ShowAdditionalText(int left, int right, int y, EngineID engine)
{ {
uint16 callback = GetVehicleCallback(CBID_VEHICLE_ADDITIONAL_TEXT, 0, 0, engine, NULL); uint16 callback = GetVehicleCallback(CBID_VEHICLE_ADDITIONAL_TEXT, 0, 0, engine, NULL);
if (callback == CALLBACK_FAILED) return 0; if (callback == CALLBACK_FAILED) return y;
/* STR_02BD is used to start the string with {BLACK} */ /* STR_02BD is used to start the string with {BLACK} */
SetDParam(0, GetGRFStringID(GetEngineGRFID(engine), 0xD000 + callback)); SetDParam(0, GetGRFStringID(GetEngineGRFID(engine), 0xD000 + callback));
PrepareTextRefStackUsage(0); PrepareTextRefStackUsage(0);
uint result = DrawStringMultiLine(x, x + w, y, INT32_MAX, STR_02BD); uint result = DrawStringMultiLine(left, right, y, INT32_MAX, STR_02BD);
StopTextRefStackUsage(); StopTextRefStackUsage();
return result - y; return result;
} }
/** Display list of cargo types of the engine, for the purchase information window */ /** Display list of cargo types of the engine, for the purchase information window */
uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine) uint ShowRefitOptionsList(int left, int right, int y, EngineID engine)
{ {
/* List of cargo types of this engine */ /* List of cargo types of this engine */
uint32 cmask = GetUnionOfArticulatedRefitMasks(engine, GetEngine(engine)->type, false); uint32 cmask = GetUnionOfArticulatedRefitMasks(engine, GetEngine(engine)->type, false);
@ -455,7 +455,7 @@ uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine)
char *b = string; char *b = string;
/* Draw nothing if the engine is not refittable */ /* Draw nothing if the engine is not refittable */
if (CountBits(cmask) <= 1) return 0; if (CountBits(cmask) <= 1) return y;
b = InlineString(b, STR_PURCHASE_INFO_REFITTABLE_TO); b = InlineString(b, STR_PURCHASE_INFO_REFITTABLE_TO);
@ -492,7 +492,7 @@ uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine)
assert(b < endof(string)); assert(b < endof(string));
SetDParamStr(0, string); SetDParamStr(0, string);
return DrawStringMultiLine(x, x + w, y, INT32_MAX, STR_JUST_RAW_STRING); return DrawStringMultiLine(left, right, y, INT32_MAX, STR_JUST_RAW_STRING);
} }
/** Get the cargo subtype text from NewGRF for the vehicle details window. */ /** Get the cargo subtype text from NewGRF for the vehicle details window. */

View File

@ -51,7 +51,7 @@ static inline bool ValidVLWFlags(uint16 flags)
return (flags == VLW_STANDARD || flags == VLW_SHARED_ORDERS || flags == VLW_STATION_LIST || flags == VLW_DEPOT_LIST || flags == VLW_GROUP_LIST); return (flags == VLW_STANDARD || flags == VLW_SHARED_ORDERS || flags == VLW_STATION_LIST || flags == VLW_DEPOT_LIST || flags == VLW_GROUP_LIST);
} }
int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number); int DrawVehiclePurchaseInfo(int left, int right, int y, EngineID engine_number);
void DrawTrainImage(const Vehicle *v, int x, int y, VehicleID selection, int count, int skip); void DrawTrainImage(const Vehicle *v, int x, int y, VehicleID selection, int count, int skip);
void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection, int count); void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection, int count);
@ -60,8 +60,8 @@ void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selection);
void ShowBuildVehicleWindow(TileIndex tile, VehicleType type); void ShowBuildVehicleWindow(TileIndex tile, VehicleType type);
uint ShowAdditionalText(int x, int y, uint w, EngineID engine); uint ShowAdditionalText(int left, int right, int y, EngineID engine);
uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine); uint ShowRefitOptionsList(int left, int right, int y, EngineID engine);
StringID GetCargoSubtypeText(const Vehicle *v); StringID GetCargoSubtypeText(const Vehicle *v);
void ShowVehicleListWindow(const Vehicle *v); void ShowVehicleListWindow(const Vehicle *v);