summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhackykid <hackykid@openttd.org>2005-06-05 23:01:10 +0000
committerhackykid <hackykid@openttd.org>2005-06-05 23:01:10 +0000
commit09aadafda1dfb08780fade5a52289a0742f84674 (patch)
tree68e68cdc1f6ef01d2a66211c1c860e94421fdfa9
parentea57dee837307d7a86a040e4121779f8e4bd1927 (diff)
downloadopenttd-09aadafda1dfb08780fade5a52289a0742f84674.tar.xz
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
- Add: In the purchase details for trains display "(refittable)" after the capacity if the vehicle is refittable.
-rw-r--r--aircraft_gui.c50
-rw-r--r--lang/english.txt16
-rw-r--r--roadveh_gui.c49
-rw-r--r--ship_gui.c45
-rw-r--r--train_gui.c99
-rw-r--r--vehicle_gui.c24
-rw-r--r--vehicle_gui.h10
7 files changed, 195 insertions, 98 deletions
diff --git a/aircraft_gui.c b/aircraft_gui.c
index f58184464..4c264fa55 100644
--- a/aircraft_gui.c
+++ b/aircraft_gui.c
@@ -15,25 +15,45 @@
#include "player.h"
#include "depot.h"
-
-void Set_DPARAM_Aircraft_Build_Window(uint16 engine_number)
+/**
+ * Draw the purchase info details of an aircraft at a given location.
+ * @param x,y location where to draw the info
+ * @param engine_number the engine of which to draw the info of
+ */
+void DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number)
{
const AircraftVehicleInfo *avi = AircraftVehInfo(engine_number);
- Engine *e;
+ Engine *e = &_engines[engine_number];
YearMonthDay ymd;
+ ConvertDayToYMD(&ymd, e->intro_date);
+ /* Purchase cost - Max speed */
SetDParam(0, avi->base_cost * (_price.aircraft_base>>3)>>5);
SetDParam(1, avi->max_speed * 8);
- SetDParam(2, avi->passenger_capacity);
- SetDParam(3, avi->mail_capacity);
- SetDParam(4, avi->running_cost * _price.aircraft_running >> 8);
-
- e = &_engines[engine_number];
- SetDParam(6, e->lifelength);
- SetDParam(7, e->reliability * 100 >> 16);
- ConvertDayToYMD(&ymd, e->intro_date);
- SetDParam(5, ymd.year + 1920);
-
+ DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, 0);
+ y += 10;
+
+ /* Cargo capacity */
+ SetDParam(0, avi->passenger_capacity);
+ SetDParam(1, avi->mail_capacity);
+ DrawString(x, y, STR_PURCHASE_INFO_AIRCRAFT_CAPACITY, 0);
+ y += 10;
+
+ /* Running cost */
+ SetDParam(0, avi->running_cost * _price.aircraft_running >> 8);
+ DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
+ y += 10;
+
+ /* Design date - Life length */
+ SetDParam(0, ymd.year + 1920);
+ SetDParam(1, e->lifelength);
+ DrawString(x, y, STR_PURCHASE_INFO_DESIGNED_LIFE, 0);
+ y += 10;
+
+ /* Reliability */
+ SetDParam(0, e->reliability * 100 >> 16);
+ DrawString(x, y, STR_PURCHASE_INFO_RELIABILITY, 0);
+ y += 10;
}
static void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selection)
@@ -110,9 +130,7 @@ static void NewAircraftWndProc(Window *w, WindowEvent *e)
WP(w,buildtrain_d).sel_engine = selected_id;
if (selected_id != -1) {
- Set_DPARAM_Aircraft_Build_Window(selected_id);
-
- DrawString(2, w->widget[4].top + 1, STR_A007_COST_SPEED_CAPACITY_PASSENGERS, 0);
+ DrawAircraftPurchaseInfo(2, w->widget[4].top + 1, selected_id);
}
}
} break;
diff --git a/lang/english.txt b/lang/english.txt
index 055fa2041..b6f2a1331 100644
--- a/lang/english.txt
+++ b/lang/english.txt
@@ -2420,7 +2420,6 @@ STR_8813_FROM :{LTBLUE}{CARGO}
STR_8814_TRAIN_IS_WAITING_IN_DEPOT :{WHITE}Train {COMMA16} is waiting in depot
STR_8815_NEW_VEHICLES :{BLACK}New Vehicles
STR_8816 :{BLACK}-
-STR_8817_COST_WEIGHT_T_SPEED_POWER :{BLACK}Cost: {GOLD}{CURRENCY}{BLACK} Weight: {GOLD}{COMMA16}t{}{BLACK}Speed: {GOLD}{VELOCITY}{BLACK} Power: {GOLD}{COMMA32}hp{}{BLACK}Running Cost: {GOLD}{CURRENCY}/yr{}{BLACK}Capacity: {GOLD}{STRING}{}{BLACK}Designed: {GOLD}{NUMU16}{BLACK} Life: {GOLD}{COMMA16} years{}{BLACK}Max. Reliability: {GOLD}{COMMA8}%
STR_8818_INFORMATION :{BLACK}Information
STR_8819_TRAIN_TOO_LONG :{WHITE}Train too long
STR_881A_TRAINS_CAN_ONLY_BE_ALTERED :{WHITE}Trains can only be altered when stopped inside a depot
@@ -2430,7 +2429,6 @@ STR_881D_NEW_MONORAIL_VEHICLES :{WHITE}New Mono
STR_881E_NEW_MAGLEV_VEHICLES :{WHITE}New Maglev Vehicles
STR_881F_BUILD_VEHICLE :{BLACK}Build Vehicle
STR_8820_RENAME :{BLACK}Rename
-STR_8821_COST_WEIGHT_T_T_CAPACITY :{BLACK}Cost: {GOLD}{CURRENCY}{}{BLACK}Weight: {GOLD}{COMMA16}t ({COMMA16}t){}{BLACK}Capacity: {GOLD}{STRING}
STR_8823_SKIP :{BLACK}Skip
STR_8824_DELETE :{BLACK}Delete
STR_8825_NON_STOP :{BLACK}Non-Stop
@@ -2523,7 +2521,6 @@ STR_9004_NEW_VEHICLES :{BLACK}New Vehi
STR_9005_INFORMATION :{BLACK}Information
STR_9006_NEW_ROAD_VEHICLES :{WHITE}New Road Vehicles
STR_9007_BUILD_VEHICLE :{BLACK}Build Vehicle
-STR_9008_COST_SPEED_RUNNING_COST :{BLACK}Cost: {GOLD}{CURRENCY}{BLACK} Speed: {GOLD}{VELOCITY}{}{BLACK}Running Cost: {GOLD}{CURRENCY}/yr{}{BLACK}Capacity: {GOLD}{STRING}{}{BLACK}Designed: {GOLD}{NUMU16}{BLACK} Life: {GOLD}{COMMA16} years{}{BLACK}Max. Reliability: {GOLD}{COMMA8}%
STR_9009_CAN_T_BUILD_ROAD_VEHICLE :{WHITE}Can't build road vehicle...
STR_900A_MUST_BUILD_ROAD_VEHICLE :{WHITE}Must build road vehicle depot first
STR_900B_ORDERS :{WHITE}{STRING} (Orders)
@@ -2586,7 +2583,6 @@ STR_9806_CAN_T_BUILD_SHIPS :{WHITE}Can't bu
STR_9807_MUST_BUILD_SHIP_DEPOT_FIRST :{WHITE}Must build ship depot first
STR_9808_NEW_SHIPS :{WHITE}New Ships
STR_9809_BUILD_SHIP :{BLACK}Build Ship
-STR_980A_COST_SPEED_CAPACITY_RUNNING :{BLACK}Cost: {GOLD}{CURRENCY}{BLACK} Speed: {GOLD}{VELOCITY}{}{BLACK}Capacity: {GOLD}{STRING} {STRING}{}{BLACK}Running Cost: {GOLD}{CURRENCY}/yr{}{BLACK}Designed: {GOLD}{NUMU16}{BLACK} Life: {GOLD}{COMMA16} years{}{BLACK}Max. Reliability: {GOLD}{COMMA8}%
STR_980B_SHIP_MUST_BE_STOPPED_IN :{WHITE}Ship must be stopped in depot
STR_980C_CAN_T_SELL_SHIP :{WHITE}Can't sell ship...
STR_980D_CAN_T_BUILD_SHIP :{WHITE}Can't build ship...
@@ -2655,7 +2651,6 @@ STR_A003_NEW_AIRCRAFT :{BLACK}New Airc
STR_A004_INFORMATION :{BLACK}Information
STR_A005_NEW_AIRCRAFT :{WHITE}New Aircraft
STR_A006_BUILD_AIRCRAFT :{BLACK}Build Aircraft
-STR_A007_COST_SPEED_CAPACITY_PASSENGERS :{BLACK}Cost: {GOLD}{CURRENCY}{BLACK} Speed: {GOLD}{VELOCITY}{}{BLACK}Capacity: {GOLD}{COMMA16} passengers, {COMMA16} bags of mail{}{BLACK}Running Cost: {GOLD}{CURRENCY}/yr{}{BLACK}Designed: {GOLD}{NUMU16}{BLACK} Life: {GOLD}{COMMA16} years{}{BLACK}Max. Reliability: {GOLD}{COMMA8}%
STR_A008_CAN_T_BUILD_AIRCRAFT :{WHITE}Can't build aircraft...
STR_A009_AIRCRAFT :{WHITE}{STRING} - {COMMA16} Aircraft
STR_A00A :{WHITE}{STRING}
@@ -2823,3 +2818,14 @@ STR_MAGLEV_VEHICLES :Maglev Vehicles
############ End of list of rail types
STR_TINY_BLACK :{BLACK}{TINYFONT}{COMMA16}
+
+STR_PURCHASE_INFO_COST_WEIGHT :{BLACK}Cost: {GOLD}{CURRENCY}{BLACK} Weight: {GOLD}{COMMA16}t
+STR_PURCHASE_INFO_SPEED_POWER :{BLACK}Speed: {GOLD}{VELOCITY}{BLACK} Power: {GOLD}{COMMA32}hp
+STR_PURCHASE_INFO_RUNNINGCOST :{BLACK}Running Cost: {GOLD}{CURRENCY}/yr
+STR_PURCHASE_INFO_CAPACITY :{BLACK}Capacity: {GOLD}{STRING} {STRING}
+STR_PURCHASE_INFO_DESIGNED_LIFE :{BLACK}Designed: {GOLD}{NUMU16}{BLACK} Life: {GOLD}{COMMA16} years
+STR_PURCHASE_INFO_RELIABILITY :{BLACK}Max. Reliability: {GOLD}{COMMA8}%
+STR_PURCHASE_INFO_COST :{BLACK}Cost: {GOLD}{CURRENCY}
+STR_PURCHASE_INFO_WEIGHT_CWEIGHT :{BLACK}Weight: {GOLD}{COMMA16}t ({COMMA16}t)
+STR_PURCHASE_INFO_COST_SPEED :{BLACK}Cost: {GOLD}{CURRENCY}{BLACK} Speed: {GOLD}{VELOCITY}
+STR_PURCHASE_INFO_AIRCRAFT_CAPACITY :{BLACK}Capacity: {GOLD}{COMMA16} passengers, {COMMA16} bags of mail
diff --git a/roadveh_gui.c b/roadveh_gui.c
index e9a8b70dd..a36791448 100644
--- a/roadveh_gui.c
+++ b/roadveh_gui.c
@@ -14,23 +14,46 @@
#include "engine.h"
#include "depot.h"
-void Set_DPARAM_Road_Veh_Build_Window(uint16 engine_number)
+/**
+ * Draw the purchase info details of road vehicle at a given location.
+ * @param x,y location where to draw the info
+ * @param engine_number the engine of which to draw the info of
+ */
+void DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number)
{
const RoadVehicleInfo *rvi = RoadVehInfo(engine_number);
- Engine *e;
+ Engine *e = &_engines[engine_number];
YearMonthDay ymd;
+ ConvertDayToYMD(&ymd, e->intro_date);
+ /* Purchase cost - Max speed */
SetDParam(0, rvi->base_cost * (_price.roadveh_base>>3)>>5);
SetDParam(1, rvi->max_speed * 10 >> 5);
- SetDParam(2, rvi->running_cost * _price.roadveh_running >> 8);
- SetDParam(4, rvi->capacity);
- SetDParam(3, _cargoc.names_long_p[rvi->cargo_type]);
-
- e = &_engines[engine_number];
- SetDParam(6, e->lifelength);
- SetDParam(7, e->reliability * 100 >> 16);
- ConvertDayToYMD(&ymd, e->intro_date);
- SetDParam(5, ymd.year + 1920);
+ DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, 0);
+ y += 10;
+
+ /* Running cost */
+ SetDParam(0, rvi->running_cost * _price.roadveh_running >> 8);
+ DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
+ y += 10;
+
+ /* Cargo type + capacity */
+ SetDParam(0, _cargoc.names_long_p[rvi->cargo_type]);
+ SetDParam(1, rvi->capacity);
+ SetDParam(2, STR_EMPTY);
+ DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0);
+ y += 10;
+
+ /* Design date - Life length */
+ SetDParam(0, ymd.year + 1920);
+ SetDParam(1, e->lifelength);
+ DrawString(x, y, STR_PURCHASE_INFO_DESIGNED_LIFE, 0);
+ y += 10;
+
+ /* Reliability */
+ SetDParam(0, e->reliability * 100 >> 16);
+ DrawString(x, y, STR_PURCHASE_INFO_RELIABILITY, 0);
+ y += 10;
}
static void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection)
@@ -379,9 +402,7 @@ static void DrawNewRoadVehWindow(Window *w)
WP(w,buildtrain_d).sel_engine = selected_id;
if (selected_id != -1) {
- Set_DPARAM_Road_Veh_Build_Window(selected_id);
-
- DrawString(2, w->widget[4].top + 1, STR_9008_COST_SPEED_RUNNING_COST, 0);
+ DrawRoadVehPurchaseInfo(2, w->widget[4].top + 1, selected_id);
}
}
}
diff --git a/ship_gui.c b/ship_gui.c
index 30a366539..0f9cba79a 100644
--- a/ship_gui.c
+++ b/ship_gui.c
@@ -14,24 +14,47 @@
#include "engine.h"
#include "depot.h"
-void Set_DPARAM_Ship_Build_Window(uint16 engine_number)
+/**
+ * Draw the purchase info details of a ship at a given location.
+ * @param x,y location where to draw the info
+ * @param engine_number the engine of which to draw the info of
+ */
+void DrawShipPurchaseInfo(int x, int y, EngineID engine_number)
{
YearMonthDay ymd;
const ShipVehicleInfo *svi = ShipVehInfo(engine_number);
Engine *e;
+ /* Purchase cost - Max speed */
SetDParam(0, svi->base_cost * (_price.ship_base>>3)>>5);
SetDParam(1, svi->max_speed * 10 >> 5);
- SetDParam(2, _cargoc.names_long_p[svi->cargo_type]);
- SetDParam(3, svi->capacity);
- SetDParam(4, svi->refittable ? STR_9842_REFITTABLE : STR_EMPTY);
- SetDParam(5, svi->running_cost * _price.ship_running >> 8);
-
+ DrawString(x,y, STR_PURCHASE_INFO_COST_SPEED, 0);
+ y += 10;
+
+ /* Cargo type + capacity */
+ SetDParam(0, _cargoc.names_long_p[svi->cargo_type]);
+ SetDParam(1, svi->capacity);
+ SetDParam(2, svi->refittable ? STR_9842_REFITTABLE : STR_EMPTY);
+ DrawString(x,y, STR_PURCHASE_INFO_CAPACITY, 0);
+ y += 10;
+
+ /* Running cost */
+ SetDParam(0, svi->running_cost * _price.ship_running >> 8);
+ DrawString(x,y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
+ y += 10;
+
+ /* Design date - Life length */
e = &_engines[engine_number];
- SetDParam(7, e->lifelength);
- SetDParam(8, e->reliability * 100 >> 16);
ConvertDayToYMD(&ymd, e->intro_date);
- SetDParam(6, ymd.year + 1920);
+ SetDParam(0, ymd.year + 1920);
+ SetDParam(1, e->lifelength);
+ DrawString(x,y, STR_PURCHASE_INFO_DESIGNED_LIFE, 0);
+ y += 10;
+
+ /* Reliability */
+ SetDParam(0, e->reliability * 100 >> 16);
+ DrawString(x,y, STR_PURCHASE_INFO_RELIABILITY, 0);
+ y += 10;
}
static void DrawShipImage(const Vehicle *v, int x, int y, VehicleID selection)
@@ -338,9 +361,7 @@ static void NewShipWndProc(Window *w, WindowEvent *e)
WP(w,buildtrain_d).sel_engine = selected_id;
if (selected_id != -1) {
- Set_DPARAM_Ship_Build_Window(selected_id);
-
- DrawString(2, w->widget[4].top + 1, STR_980A_COST_SPEED_CAPACITY_RUNNING, 0);
+ DrawShipPurchaseInfo(2, w->widget[4].top + 1, selected_id);
}
}
break;
diff --git a/train_gui.c b/train_gui.c
index ae53cef37..b3a9f52fb 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -17,43 +17,86 @@
int _traininfo_vehicle_pitch = 0;
-void Set_DPARAM_Train_Engine_Build_Window(uint16 engine_number)
+/**
+ * Draw the purchase info details of train engine at a given location.
+ * @param x,y location where to draw the info
+ * @param engine_number the engine of which to draw the info of
+ */
+void DrawTrainEnginePurchaseInfo(int x, int y, EngineID engine_number)
{
const RailVehicleInfo *rvi = RailVehInfo(engine_number);
- Engine *e;
+ Engine *e = &_engines[engine_number];
int multihead = (rvi->flags&RVI_MULTIHEAD?1:0);
YearMonthDay ymd;
+ ConvertDayToYMD(&ymd, e->intro_date);
-
+ /* Purchase Cost - Engine weight */
SetDParam(0, rvi->base_cost * (_price.build_railvehicle >> 3) >> 5);
- SetDParam(2, rvi->max_speed * 10 >> 4);
- SetDParam(3, rvi->power << multihead);
SetDParam(1, rvi->weight << multihead);
- SetDParam(4, (rvi->running_cost_base * _price.running_rail[rvi->engclass] >> 8) << multihead);
-
- SetDParam(5, STR_8838_N_A);
+ DrawString(x,y, STR_PURCHASE_INFO_COST_WEIGHT, 0);
+ y += 10;
+
+ /* Max speed - Engine power */
+ SetDParam(0, rvi->max_speed * 10 >> 4);
+ SetDParam(1, rvi->power << multihead);
+ DrawString(x,y, STR_PURCHASE_INFO_SPEED_POWER, 0);
+ y += 10;
+
+ /* Running cost */
+ SetDParam(0, (rvi->running_cost_base * _price.running_rail[rvi->engclass] >> 8) << multihead);
+ DrawString(x,y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
+ y += 10;
+
+ /* Cargo type + capacity, or N/A */
+ SetDParam(0, STR_8838_N_A);
+ SetDParam(2, STR_EMPTY);
if (rvi->capacity != 0) {
- SetDParam(6, rvi->capacity << multihead);
- SetDParam(5, _cargoc.names_long_p[rvi->cargo_type]);
+ SetDParam(0, _cargoc.names_long_p[rvi->cargo_type]);
+ SetDParam(1, rvi->capacity << multihead);
+ SetDParam(2, STR_9842_REFITTABLE);
}
-
- e = &_engines[engine_number];
-
- SetDParam(8, e->lifelength);
- SetDParam(9, e->reliability * 100 >> 16);
- ConvertDayToYMD(&ymd, e->intro_date);
- SetDParam(7, ymd.year + 1920);
+ DrawString(x,y, STR_PURCHASE_INFO_CAPACITY, 0);
+ y += 10;
+
+ /* Design date - Life length */
+ SetDParam(0, ymd.year + 1920);
+ SetDParam(1, e->lifelength);
+ DrawString(x,y, STR_PURCHASE_INFO_DESIGNED_LIFE, 0);
+ y += 10;
+
+ /* Reliability */
+ SetDParam(0, e->reliability * 100 >> 16);
+ DrawString(x,y, STR_PURCHASE_INFO_RELIABILITY, 0);
+ y += 10;
}
-void Set_DPARAM_Train_Car_Build_Window(Window *w, uint16 engine_number)
+/**
+ * Draw the purchase info details of a train wagon at a given location.
+ * @param x,y location where to draw the info
+ * @param engine_number the engine of which to draw the info of
+ */
+void DrawTrainWagonPurchaseInfo(int x, int y, EngineID engine_number)
{
const RailVehicleInfo *rvi = RailVehInfo(engine_number);
-
- SetDParam(0, DoCommandByTile(w->window_number, engine_number, 0, DC_QUERY_COST, CMD_BUILD_RAIL_VEHICLE) );
- SetDParam(4, rvi->capacity);
- SetDParam(1, rvi->weight);
- SetDParam(3, _cargoc.names_long_p[rvi->cargo_type]);
- SetDParam(2, (_cargoc.weights[rvi->cargo_type] * rvi->capacity >> 4) + rvi->weight);
+ bool refittable = (_engine_refit_masks[engine_number] != 0);
+
+ /* Purchase cost */
+ SetDParam(0, (rvi->base_cost * _price.build_railwagon) >> 8);
+ DrawString(x, y, STR_PURCHASE_INFO_COST, 0);
+ y += 10;
+
+ /* Wagon weight - (including cargo) */
+ SetDParam(0, rvi->weight);
+ SetDParam(1, (_cargoc.weights[rvi->cargo_type] * rvi->capacity >> 4) + rvi->weight);
+ DrawString(x, y, STR_PURCHASE_INFO_WEIGHT_CWEIGHT, 0);
+ y += 10;
+
+ /* Cargo type + capacity */
+ SetDParam(0, _cargoc.names_long_p[rvi->cargo_type]);
+ SetDParam(1, rvi->capacity);
+ SetDParam(2, refittable ? STR_9842_REFITTABLE : STR_EMPTY);
+ DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0);
+ y += 10;
}
void CcBuildWagon(bool success, uint tile, uint32 p1, uint32 p2)
@@ -173,14 +216,10 @@ static void NewRailVehicleWndProc(Window *w, WindowEvent *e)
if (!(rvi->flags & RVI_WAGON)) {
/* it's an engine */
- Set_DPARAM_Train_Engine_Build_Window(selected_id);
-
- DrawString(2, w->widget[4].top + 1, STR_8817_COST_WEIGHT_T_SPEED_POWER, 0);
+ DrawTrainEnginePurchaseInfo(2, w->widget[4].top + 1,selected_id);
} else {
/* it's a wagon */
- Set_DPARAM_Train_Car_Build_Window(w, selected_id);
-
- DrawString(2, w->widget[4].top + 1, STR_8821_COST_WEIGHT_T_T_CAPACITY, 0);
+ DrawTrainWagonPurchaseInfo(2, w->widget[4].top + 1, selected_id);
}
}
}
diff --git a/vehicle_gui.c b/vehicle_gui.c
index 16edc3b99..48594cc56 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -844,12 +844,10 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
if (selected_id[i] != -1) {
if (!(RailVehInfo(selected_id[i])->flags & RVI_WAGON)) {
/* it's an engine */
- Set_DPARAM_Train_Engine_Build_Window(selected_id[i]);
- DrawString(2 + offset, 15 + (14 * w->vscroll.cap), STR_8817_COST_WEIGHT_T_SPEED_POWER, 0);
+ DrawTrainEnginePurchaseInfo(2 + offset, 15 + (14 * w->vscroll.cap), selected_id[i]);
} else {
/* it's a wagon. Train cars are not replaced with the current GUI, but this code is ready for newgrf if anybody adds that*/
- Set_DPARAM_Train_Car_Build_Window(w, selected_id[i]);
- DrawString(2 + offset, 15 + (14 * w->vscroll.cap), STR_8821_COST_WEIGHT_T_T_CAPACITY, 0);
+ DrawTrainWagonPurchaseInfo(2 + offset, 15 + (14 * w->vscroll.cap), selected_id[i]);
}
}
}
@@ -858,11 +856,9 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
case VEH_Road: {
if (selected_id[0] != -1) {
- Set_DPARAM_Road_Veh_Build_Window(selected_id[0]);
- DrawString(2, 15 + (14 * w->vscroll.cap), STR_9008_COST_SPEED_RUNNING_COST, 0);
+ DrawRoadVehPurchaseInfo(2, 15 + (14 * w->vscroll.cap), selected_id[0]);
if (selected_id[1] != -1) {
- Set_DPARAM_Road_Veh_Build_Window(selected_id[1]);
- DrawString(2 + 228, 15 + (14 * w->vscroll.cap), STR_9008_COST_SPEED_RUNNING_COST, 0);
+ DrawRoadVehPurchaseInfo(2 + 228, 15 + (14 * w->vscroll.cap), selected_id[1]);
}
}
break;
@@ -870,11 +866,9 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
case VEH_Ship: {
if (selected_id[0] != -1) {
- Set_DPARAM_Ship_Build_Window(selected_id[0]);
- DrawString(2, 15 + (24 * w->vscroll.cap), STR_980A_COST_SPEED_CAPACITY_RUNNING, 0);
+ DrawShipPurchaseInfo(2, 15 + (24 * w->vscroll.cap), selected_id[0]);
if (selected_id[1] != -1) {
- Set_DPARAM_Ship_Build_Window(selected_id[1]);
- DrawString(2 + 228, 15 + (24 * w->vscroll.cap), STR_980A_COST_SPEED_CAPACITY_RUNNING, 0);
+ DrawShipPurchaseInfo(2 + 228, 15 + (24 * w->vscroll.cap), selected_id[1]);
}
}
break;
@@ -882,11 +876,9 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
case VEH_Aircraft: {
if (selected_id[0] != -1) {
- Set_DPARAM_Aircraft_Build_Window(selected_id[0]);
- DrawString(2, 15 + (24 * w->vscroll.cap), STR_A007_COST_SPEED_CAPACITY_PASSENGERS, 0);
+ DrawAircraftPurchaseInfo(2, 15 + (24 * w->vscroll.cap), selected_id[0]);
if (selected_id[1] != -1) {
- Set_DPARAM_Aircraft_Build_Window(selected_id[1]);
- DrawString(2 + 228, 15 + (24 * w->vscroll.cap), STR_A007_COST_SPEED_CAPACITY_PASSENGERS, 0);
+ DrawAircraftPurchaseInfo(2 + 228, 15 + (24 * w->vscroll.cap), selected_id[1]);
}
}
break;
diff --git a/vehicle_gui.h b/vehicle_gui.h
index a4e010c69..9b4e40f0b 100644
--- a/vehicle_gui.h
+++ b/vehicle_gui.h
@@ -70,11 +70,11 @@ enum {
void ShowReplaceVehicleWindow(byte vehicletype);
-void Set_DPARAM_Train_Engine_Build_Window(uint16 engine_number);
-void Set_DPARAM_Train_Car_Build_Window(Window *w, uint16 engine_number);
-void Set_DPARAM_Road_Veh_Build_Window(uint16 engine_number);
-void Set_DPARAM_Aircraft_Build_Window(uint16 engine_number);
-void Set_DPARAM_Ship_Build_Window(uint16 engine_number);
+void DrawTrainEnginePurchaseInfo(int x, int y, EngineID engine_number);
+void DrawTrainWagonPurchaseInfo(int x, int y, EngineID engine_number);
+void DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number);
+void DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number);
+void DrawShipPurchaseInfo(int x, int y, EngineID engine_number);
#endif /* VEHICLE_GUI_H */