summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/aircraft_gui.cpp2
-rw-r--r--src/autoreplace_gui.cpp3
-rw-r--r--src/build_vehicle_gui.cpp12
-rw-r--r--src/engine_gui.cpp7
-rw-r--r--src/lang/english.txt15
-rw-r--r--src/roadveh_gui.cpp2
-rw-r--r--src/ship_gui.cpp2
-rw-r--r--src/strgen/strgen.cpp1
-rw-r--r--src/strings.cpp8
-rw-r--r--src/table/control_codes.h1
-rw-r--r--src/train_gui.cpp4
11 files changed, 37 insertions, 20 deletions
diff --git a/src/aircraft_gui.cpp b/src/aircraft_gui.cpp
index 85ba43443..7890a8fd4 100644
--- a/src/aircraft_gui.cpp
+++ b/src/aircraft_gui.cpp
@@ -136,7 +136,7 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e)
do {
if (IsNormalAircraft(v)) {
- SetDParam(0, GetCustomEngineName(v->engine_type));
+ SetDParam(0, v->engine_type);
SetDParam(1, v->build_year);
SetDParam(2, v->value);
DrawString(60, y, STR_A011_BUILT_VALUE, 0);
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index e1925e7d0..f77428dda 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -288,7 +288,8 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
if (!EngineHasReplacementForPlayer(p, selected_id[0], selected_group)) {
SetDParam(0, STR_NOT_REPLACING);
} else {
- SetDParam(0, GetCustomEngineName(EngineReplacementForPlayer(p, selected_id[0], selected_group)));
+ SetDParam(0, STR_ENGINE_NAME);
+ SetDParam(1, EngineReplacementForPlayer(p, selected_id[0], selected_group));
}
} else {
SetDParam(0, STR_NOT_REPLACING_VEHICLE_SELECTED);
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 5535af88d..111cced0b 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -140,12 +140,14 @@ static int CDECL EngineNameSorter(const void *a, const void *b)
if (va != last_engine[0]) {
last_engine[0] = va;
- GetString(last_name[0], GetCustomEngineName(va), lastof(last_name[0]));
+ SetDParam(0, va);
+ GetString(last_name[0], STR_ENGINE_NAME, lastof(last_name[0]));
}
if (vb != last_engine[1]) {
last_engine[1] = vb;
- GetString(last_name[1], GetCustomEngineName(vb), lastof(last_name[1]));
+ SetDParam(0, vb);
+ GetString(last_name[1], STR_ENGINE_NAME, lastof(last_name[1]));
}
r = strcmp(last_name[0], last_name[1]); // sort by name
@@ -853,7 +855,8 @@ void DrawEngineList(VehicleType type, int x, int y, const EngineList eng_list, u
const EngineID engine = eng_list[min];
const uint num_engines = IsDefaultGroupID(selected_group) ? p->num_engines[engine] : GetGroup(selected_group)->num_engines[engine];
- DrawString(x + x_offset, y, GetCustomEngineName(engine), engine == selected_id ? 0xC : 0x10);
+ SetDParam(0, engine);
+ DrawString(x + x_offset, y, STR_ENGINE_NAME, engine == selected_id ? 0xC : 0x10);
DrawVehicleEngine(type, x, y + y_offset, engine, (show_count && num_engines == 0) ? PALETTE_CRASH : GetEnginePalette(engine, _local_player));
if (show_count) {
SetDParam(0, num_engines);
@@ -963,7 +966,8 @@ static void BuildVehicleClickEvent(Window *w, WindowEvent *e)
case VEH_SHIP: str = STR_9838_RENAME_SHIP_TYPE; break;
case VEH_AIRCRAFT: str = STR_A039_RENAME_AIRCRAFT_TYPE; break;
}
- ShowQueryString(GetCustomEngineName(sel_eng), str, 31, 160, w, CS_ALPHANUMERAL);
+ SetDParam(0, sel_eng);
+ ShowQueryString(STR_ENGINE_NAME, str, 31, 160, w, CS_ALPHANUMERAL);
}
break;
}
diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp
index b2446fbe3..4421f1f5f 100644
--- a/src/engine_gui.cpp
+++ b/src/engine_gui.cpp
@@ -78,7 +78,8 @@ static void EnginePreviewWndProc(Window *w, WindowEvent *e)
SetDParam(0, GetEngineCategoryName(engine));
DrawStringMultiCenter(150, 44, STR_8101_WE_HAVE_JUST_DESIGNED_A, 296);
- DrawStringCentered(w->width >> 1, 80, GetCustomEngineName(engine), 0x10);
+ SetDParam(0, engine);
+ DrawStringCentered(w->width >> 1, 80, STR_ENGINE_NAME, 0x10);
dei = &_draw_engine_list[GetEngine(engine)->type];
@@ -177,7 +178,7 @@ StringID GetNewsStringNewVehicleAvail(const NewsItem *ni)
{
EngineID engine = ni->string_id;
SetDParam(0, GetEngineCategoryName(engine));
- SetDParam(1, GetCustomEngineName(engine));
+ SetDParam(1, engine);
return STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE;
}
@@ -193,7 +194,7 @@ void DrawNewsNewVehicleAvail(Window *w)
GfxFillRect(25, 56, w->width - 25, w->height - 2, 10);
- SetDParam(0, GetCustomEngineName(engine));
+ SetDParam(0, engine);
DrawStringMultiCenter(w->width >> 1, 57, STR_NEW_VEHICLE_TYPE, w->width - 2);
dei->engine_proc(w->width >> 1, 88, engine, 0);
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 5edb81319..2b02e21bf 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -2669,8 +2669,8 @@ STR_882A_END_OF_ORDERS :{SETX 10}- - En
STR_FULLLOAD_OR_SERVICE :{SKIP}{SKIP}{STRING}
STR_SERVICE :{BLACK}Service
STR_882B_CAN_T_BUILD_RAILROAD_VEHICLE :{WHITE}Can't build railway vehicle...
-STR_882C_BUILT_VALUE :{LTBLUE}{STRING}{BLACK} Built: {LTBLUE}{NUM}{BLACK} Value: {LTBLUE}{CURRENCY}
-STR_882D_VALUE :{LTBLUE}{STRING}{BLACK} Value: {LTBLUE}{CURRENCY}
+STR_882C_BUILT_VALUE :{LTBLUE}{ENGINE}{BLACK} Built: {LTBLUE}{NUM}{BLACK} Value: {LTBLUE}{CURRENCY}
+STR_882D_VALUE :{LTBLUE}{ENGINE}{BLACK} Value: {LTBLUE}{CURRENCY}
STR_882E :{WHITE}{VEHICLE}
STR_882F_LOADING_UNLOADING :{LTBLUE}Loading / Unloading
STR_TRAIN_MUST_BE_STOPPED :{WHITE}Train must be stopped inside a depot
@@ -2755,8 +2755,8 @@ STR_TRAIN_NO_POWER :{RED}No power
STR_TRAIN_START_NO_CATENARY :This track lacks catenary, so the train can't start
STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}New {STRING} now available!
-STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
-STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}New {STRING} now available! - {STRING}
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{ENGINE}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}New {STRING} now available! - {ENGINE}
STR_CAN_T_TIMETABLE_VEHICLE :{WHITE}Can't timetable vehicle...
STR_TIMETABLE_ONLY_WAIT_AT_STATIONS :{WHITE}Vehicles can only wait at stations.
@@ -2780,7 +2780,7 @@ STR_900D_AGE_RUNNING_COST_YR :{BLACK}Age: {LT
STR_900E_MAX_SPEED :{BLACK}Max. speed: {LTBLUE}{VELOCITY}
STR_900F_PROFIT_THIS_YEAR_LAST_YEAR :{BLACK}Profit this year: {LTBLUE}{CURRENCY} (last year: {CURRENCY})
STR_9010_RELIABILITY_BREAKDOWNS :{BLACK}Reliability: {LTBLUE}{COMMA}% {BLACK}Breakdowns since last service: {LTBLUE}{COMMA}
-STR_9011_BUILT_VALUE :{LTBLUE}{STRING}{BLACK} Built: {LTBLUE}{NUM}{BLACK} Value: {LTBLUE}{CURRENCY}
+STR_9011_BUILT_VALUE :{LTBLUE}{ENGINE}{BLACK} Built: {LTBLUE}{NUM}{BLACK} Value: {LTBLUE}{CURRENCY}
STR_9012_CAPACITY :{BLACK}Capacity: {LTBLUE}{CARGO}
STR_9013_MUST_BE_STOPPED_INSIDE :{WHITE}...must be stopped inside a road vehicle depot
STR_9014_CAN_T_SELL_ROAD_VEHICLE :{WHITE}Can't sell road vehicle...
@@ -2856,7 +2856,7 @@ STR_9812_AGE_RUNNING_COST_YR :{BLACK}Age: {LT
STR_9813_MAX_SPEED :{BLACK}Max. speed: {LTBLUE}{VELOCITY}
STR_9814_PROFIT_THIS_YEAR_LAST_YEAR :{BLACK}Profit this year: {LTBLUE}{CURRENCY} (last year: {CURRENCY})
STR_9815_RELIABILITY_BREAKDOWNS :{BLACK}Reliability: {LTBLUE}{COMMA}% {BLACK}Breakdowns since last service: {LTBLUE}{COMMA}
-STR_9816_BUILT_VALUE :{LTBLUE}{STRING}{BLACK} Built: {LTBLUE}{NUM}{BLACK} Value: {LTBLUE}{CURRENCY}
+STR_9816_BUILT_VALUE :{LTBLUE}{ENGINE}{BLACK} Built: {LTBLUE}{NUM}{BLACK} Value: {LTBLUE}{CURRENCY}
STR_9817_CAPACITY :{BLACK}Capacity: {LTBLUE}{CARGO}
STR_9818_CAN_T_STOP_START_SHIP :{WHITE}Can't stop/start ship...
STR_9819_CAN_T_SEND_SHIP_TO_DEPOT :{WHITE}Can't send ship to depot...
@@ -2924,7 +2924,7 @@ STR_A00D_AGE_RUNNING_COST_YR :{BLACK}Age: {LT
STR_A00E_MAX_SPEED :{BLACK}Max. speed: {LTBLUE}{VELOCITY}
STR_A00F_PROFIT_THIS_YEAR_LAST_YEAR :{BLACK}Profit this year: {LTBLUE}{CURRENCY} (last year: {CURRENCY})
STR_A010_RELIABILITY_BREAKDOWNS :{BLACK}Reliability: {LTBLUE}{COMMA}% {BLACK}Breakdowns since last service: {LTBLUE}{COMMA}
-STR_A011_BUILT_VALUE :{LTBLUE}{STRING}{BLACK} Built: {LTBLUE}{NUM}{BLACK} Value: {LTBLUE}{CURRENCY}
+STR_A011_BUILT_VALUE :{LTBLUE}{ENGINE}{BLACK} Built: {LTBLUE}{NUM}{BLACK} Value: {LTBLUE}{CURRENCY}
STR_A012_CAN_T_SEND_AIRCRAFT_TO :{WHITE}Can't send aircraft to hangar...
STR_HEADING_FOR_HANGAR :{ORANGE}Heading for {STATION} Hangar
STR_HEADING_FOR_HANGAR_VEL :{ORANGE}Heading for {STATION} Hangar, {VELOCITY}
@@ -3340,6 +3340,7 @@ STR_PROFIT_GOOD_THIS_YEAR_BAD_LAST_YEAR :{TINYFONT}{BLAC
STR_PROFIT_BAD_THIS_YEAR_BAD_LAST_YEAR :{TINYFONT}{BLACK}Profit this year: {RED}{CURRENCY} {BLACK}(last year: {RED}{CURRENCY}{BLACK})
STR_COMPANY_NAME :{COMPANY}
+STR_ENGINE_NAME :{ENGINE}
STR_GROUP_NAME :{GROUP}
STR_PLAYER_NAME :{PLAYERNAME}
STR_SIGN_NAME :{SIGN}
diff --git a/src/roadveh_gui.cpp b/src/roadveh_gui.cpp
index ab94fb855..10fd3a18d 100644
--- a/src/roadveh_gui.cpp
+++ b/src/roadveh_gui.cpp
@@ -117,7 +117,7 @@ static void RoadVehDetailsWndProc(Window *w, WindowEvent *e)
DrawRoadVehImage(v, 3, 57, 0, INVALID_VEHICLE);
- SetDParam(0, GetCustomEngineName(v->engine_type));
+ SetDParam(0, v->engine_type);
SetDParam(1, v->build_year);
SetDParam(2, v->value);
DrawString(34, 57 + y_offset, STR_9011_BUILT_VALUE, 0);
diff --git a/src/ship_gui.cpp b/src/ship_gui.cpp
index 68e2acb17..e67111658 100644
--- a/src/ship_gui.cpp
+++ b/src/ship_gui.cpp
@@ -82,8 +82,8 @@ static void ShipDetailsWndProc(Window *w, WindowEvent *e)
DrawShipImage(v, 3, 57, INVALID_VEHICLE);
+ SetDParam(0, v->engine_type);
SetDParam(1, v->build_year);
- SetDParam(0, GetCustomEngineName(v->engine_type));
SetDParam(2, v->value);
DrawString(74, 57, STR_9816_BUILT_VALUE, 0);
diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp
index c1af6bbf0..bc1169458 100644
--- a/src/strgen/strgen.cpp
+++ b/src/strgen/strgen.cpp
@@ -500,6 +500,7 @@ static const CmdStruct _cmd_structs[] = {
{"TOWN", EmitSingleChar, SCC_TOWN_NAME, 1, 0},
{"GROUP", EmitSingleChar, SCC_GROUP_NAME, 1, 0},
{"SIGN", EmitSingleChar, SCC_SIGN_NAME, 1, 0},
+ {"ENGINE", EmitSingleChar, SCC_ENGINE_NAME, 1, 0},
{"VEHICLE", EmitSingleChar, SCC_VEHICLE_NAME, 1, 0},
{"COMPANY", EmitSingleChar, SCC_COMPANY_NAME, 1, 0},
{"COMPANYNUM", EmitSingleChar, SCC_COMPANY_NUM, 1, 0},
diff --git a/src/strings.cpp b/src/strings.cpp
index 52401b9bd..c9495b89f 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -31,6 +31,7 @@
#include "newgrf_townname.h"
#include "signs.h"
#include "vehicle.h"
+#include "newgrf_engine.h"
/* for opendir/readdir/closedir */
# include "fios.h"
@@ -864,6 +865,13 @@ static char* FormatString(char* buff, const char* str, const int64* argv, uint c
break;
}
+ case SCC_ENGINE_NAME: { // {ENGINE}
+ EngineID engine = (EngineID)GetInt32(&argv);
+
+ buff = GetString(buff, GetCustomEngineName(engine), last);
+ break;
+ }
+
case SCC_VEHICLE_NAME: { // {VEHICLE}
const Vehicle *v = GetVehicle(GetInt32(&argv));
diff --git a/src/table/control_codes.h b/src/table/control_codes.h
index e841d2e27..e241e9ad0 100644
--- a/src/table/control_codes.h
+++ b/src/table/control_codes.h
@@ -32,6 +32,7 @@ enum {
SCC_COMPANY_NAME,
SCC_COMPANY_NUM,
SCC_PLAYER_NAME,
+ SCC_ENGINE_NAME,
SCC_CURRENCY_COMPACT,
SCC_CURRENCY,
diff --git a/src/train_gui.cpp b/src/train_gui.cpp
index 78b48bbe0..4d6c81bad 100644
--- a/src/train_gui.cpp
+++ b/src/train_gui.cpp
@@ -342,11 +342,11 @@ static void TrainDetailsCargoTab(const Vehicle *v, int x, int y)
static void TrainDetailsInfoTab(const Vehicle *v, int x, int y)
{
if (RailVehInfo(v->engine_type)->railveh_type == RAILVEH_WAGON) {
- SetDParam(0, GetCustomEngineName(v->engine_type));
+ SetDParam(0, v->engine_type);
SetDParam(1, v->value);
DrawString(x, y, STR_882D_VALUE, 0x10);
} else {
- SetDParam(0, GetCustomEngineName(v->engine_type));
+ SetDParam(0, v->engine_type);
SetDParam(1, v->build_year);
SetDParam(2, v->value);
DrawString(x, y, STR_882C_BUILT_VALUE, 0x10);