--- a/src/aircraft_gui.cpp Sun Jun 24 22:18:46 2007 +0000
+++ b/src/aircraft_gui.cpp Sun Jun 24 22:42:11 2007 +0000
@@ -80,8 +80,7 @@
SetWindowWidgetDisabledState(w, 5, !_patches.servint_aircraft);
SetWindowWidgetDisabledState(w, 6, !_patches.servint_aircraft);
- SetDParam(0, v->string_id);
- SetDParam(1, v->unitnumber);
+ SetDParam(0, v->index);
DrawWindowWidgets(w);
/* Draw running cost */
@@ -173,8 +172,8 @@
switch (e->we.click.widget) {
case 2: /* rename */
v = GetVehicle(w->window_number);
- SetDParam(0, v->unitnumber);
- ShowQueryString(v->string_id, STR_A030_NAME_AIRCRAFT, 31, 150, w, CS_ALPHANUMERAL);
+ SetDParam(0, v->index);
+ ShowQueryString(STR_VEHICLE_NAME, STR_A030_NAME_AIRCRAFT, 31, 150, w, CS_ALPHANUMERAL);
break;
case 5: /* increase int */
mod = _ctrl_pressed? 5 : 10;
@@ -272,8 +271,7 @@
/* draw widgets & caption */
- SetDParam(0, v->string_id);
- SetDParam(1, v->unitnumber);
+ SetDParam(0, v->index);
DrawWindowWidgets(w);
if (v->vehstatus & VS_CRASHED) {
--- a/src/autoreplace_cmd.cpp Sun Jun 24 22:18:46 2007 +0000
+++ b/src/autoreplace_cmd.cpp Sun Jun 24 22:42:11 2007 +0000
@@ -17,6 +17,7 @@
#include "aircraft.h"
#include "cargotype.h"
#include "group.h"
+#include "strings.h"
/*
@@ -241,7 +242,8 @@
if (!IsCustomName(old_v->string_id)) {
vehicle_name[0] = '\0';
} else {
- GetName(vehicle_name, old_v->string_id & 0x7FF, lastof(vehicle_name));
+ SetDParam(0, old_v->index);
+ GetString(vehicle_name, STR_VEHICLE_NAME, lastof(vehicle_name));
}
} else { // flags & DC_EXEC not set
CommandCost tmp_move;
--- a/src/lang/english.txt Sun Jun 24 22:18:46 2007 +0000
+++ b/src/lang/english.txt Sun Jun 24 22:42:11 2007 +0000
@@ -495,7 +495,7 @@
STR_01A8_LOCAL_AUTHORITY :{BLACK}Local authority: {LTBLUE}{STRING1}
STR_01A9_NONE :None
STR_01AA_NAME :{BLACK}Name
-STR_01AB :{BLACK}{TINYFONT}{STRING}
+STR_01AB :{BLACK}{TINYFONT}{VEHICLE}
############ range for days starts
STR_01AC_1ST :1st
@@ -2594,7 +2594,7 @@
##id 0x8800
STR_8800_TRAIN_DEPOT :{WHITE}{TOWN} Train Depot
STR_8801_CITIZENS_CELEBRATE_FIRST :{BLACK}{BIGFONT}Citizens celebrate . . .{}First train arrives at {STATION}!
-STR_8802_DETAILS :{WHITE}{STRING1} (Details)
+STR_8802_DETAILS :{WHITE}{VEHICLE} (Details)
STR_8803_TRAIN_IN_THE_WAY :{WHITE}Train in the way
STR_8804 :{SETX 10}{COMMA}: {STRING1} {STRING1}
STR_8805 :{RIGHTARROW}{SETX 10}{COMMA}: {STRING1} {STRING1}
@@ -3340,4 +3340,6 @@
STR_PROFIT_GOOD_THIS_YEAR_BAD_LAST_YEAR :{TINYFONT}{BLACK}Profit this year: {GREEN}{CURRENCY} {BLACK}(last year: {RED}{CURRENCY}{BLACK})
STR_PROFIT_BAD_THIS_YEAR_BAD_LAST_YEAR :{TINYFONT}{BLACK}Profit this year: {RED}{CURRENCY} {BLACK}(last year: {RED}{CURRENCY}{BLACK})
+STR_VEHICLE_NAME :{VEHICLE}
+
########
--- a/src/order_cmd.cpp Sun Jun 24 22:18:46 2007 +0000
+++ b/src/order_cmd.cpp Sun Jun 24 22:42:11 2007 +0000
@@ -18,6 +18,7 @@
#include "saveload.h"
#include "vehicle_gui.h"
#include "cargotype.h"
+#include "strings.h"
/**
* Called if a new block is added to the order-pool
@@ -974,7 +975,8 @@
if (!IsCustomName(v->string_id)) {
bak->name[0] = '\0';
} else {
- GetName(bak->name, v->string_id & 0x7FF, lastof(bak->name));
+ SetDParam(0, v->index);
+ GetString(bak->name, STR_VEHICLE_NAME, lastof(bak->name));
}
/* If we have shared orders, store it on a special way */
--- a/src/order_gui.cpp Sun Jun 24 22:18:46 2007 +0000
+++ b/src/order_gui.cpp Sun Jun 24 22:42:11 2007 +0000
@@ -176,8 +176,7 @@
}
}
- SetDParam(0, v->string_id);
- SetDParam(1, v->unitnumber);
+ SetDParam(0, v->index);
DrawWindowWidgets(w);
y = 15;
--- a/src/roadveh_gui.cpp Sun Jun 24 22:18:46 2007 +0000
+++ b/src/roadveh_gui.cpp Sun Jun 24 22:42:11 2007 +0000
@@ -80,8 +80,7 @@
SetWindowWidgetDisabledState(w, 5, !_patches.servint_roadveh);
SetWindowWidgetDisabledState(w, 6, !_patches.servint_roadveh);
- SetDParam(0, v->string_id);
- SetDParam(1, v->unitnumber);
+ SetDParam(0, v->index);
DrawWindowWidgets(w);
/* Draw running cost */
@@ -199,8 +198,8 @@
switch (e->we.click.widget) {
case 2: /* rename */
v = GetVehicle(w->window_number);
- SetDParam(0, v->unitnumber);
- ShowQueryString(v->string_id, STR_902C_NAME_ROAD_VEHICLE, 31, 150, w, CS_ALPHANUMERAL);
+ SetDParam(0, v->index);
+ ShowQueryString(STR_VEHICLE_NAME, STR_902C_NAME_ROAD_VEHICLE, 31, 150, w, CS_ALPHANUMERAL);
break;
case 5: /* increase int */
@@ -283,8 +282,7 @@
_engine_info[v->engine_type].refit_mask == 0);
/* draw widgets & caption */
- SetDParam(0, v->string_id);
- SetDParam(1, v->unitnumber);
+ SetDParam(0, v->index);
DrawWindowWidgets(w);
if (v->u.road.crashed_ctr != 0) {
--- a/src/ship_gui.cpp Sun Jun 24 22:18:46 2007 +0000
+++ b/src/ship_gui.cpp Sun Jun 24 22:42:11 2007 +0000
@@ -38,8 +38,7 @@
SetWindowWidgetDisabledState(w, 5, !_patches.servint_ships);
SetWindowWidgetDisabledState(w, 6, !_patches.servint_ships);
- SetDParam(0, v->string_id);
- SetDParam(1, v->unitnumber);
+ SetDParam(0, v->index);
DrawWindowWidgets(w);
/* Draw running cost */
@@ -113,8 +112,8 @@
switch (e->we.click.widget) {
case 2: /* rename */
v = GetVehicle(w->window_number);
- SetDParam(0, v->unitnumber);
- ShowQueryString(v->string_id, STR_9831_NAME_SHIP, 31, 150, w, CS_ALPHANUMERAL);
+ SetDParam(0, v->index);
+ ShowQueryString(STR_VEHICLE_NAME, STR_9831_NAME_SHIP, 31, 150, w, CS_ALPHANUMERAL);
break;
case 5: /* increase int */
mod = _ctrl_pressed? 5 : 10;
@@ -208,8 +207,7 @@
SetWindowWidgetDisabledState(w, 11, !is_localplayer);
/* draw widgets & caption */
- SetDParam(0, v->string_id);
- SetDParam(1, v->unitnumber);
+ SetDParam(0, v->index);
DrawWindowWidgets(w);
if (v->breakdown_ctr == 1) {
--- a/src/strgen/strgen.cpp Sun Jun 24 22:18:46 2007 +0000
+++ b/src/strgen/strgen.cpp Sun Jun 24 22:42:11 2007 +0000
@@ -465,7 +465,6 @@
// The first string includes the second string.
{"COMPANY", EmitSingleChar, SCC_STRING1, 2, 0},
{"PLAYERNAME", EmitSingleChar, SCC_STRING1, 1, 0},
- {"VEHICLE", EmitSingleChar, SCC_STRING1, 1, 0},
{"STRING1", EmitSingleChar, SCC_STRING1, 1, C_CASE}, // included string that consumes ONE argument
{"STRING2", EmitSingleChar, SCC_STRING2, 2, C_CASE}, // included string that consumes TWO arguments
@@ -505,6 +504,7 @@
{"STATION", EmitSingleChar, SCC_STATION_NAME, 1, 0},
{"TOWN", EmitSingleChar, SCC_TOWN_NAME, 1, 0},
{"GROUP", EmitSingleChar, SCC_GROUP_NAME, 1, 0},
+ {"VEHICLE", EmitSingleChar, SCC_VEHICLE_NAME, 1, 0},
// 0x9D is used for the pseudo command SETCASE
// 0x9E is used for case switching
--- a/src/strings.cpp Sun Jun 24 22:18:46 2007 +0000
+++ b/src/strings.cpp Sun Jun 24 22:42:11 2007 +0000
@@ -29,6 +29,7 @@
#include "group.h"
#include "debug.h"
#include "newgrf_townname.h"
+#include "vehicle.h"
/* for opendir/readdir/closedir */
# include "fios.h"
@@ -861,6 +862,16 @@
break;
}
+ case SCC_VEHICLE_NAME: { // {VEHICLE}
+ const Vehicle *v = GetVehicle(GetInt32(&argv));
+
+ int64 args[1];
+ args[0] = v->unitnumber;
+
+ buff = GetStringWithArgs(buff, v->string_id, args, last);
+ break;
+ }
+
case SCC_SETCASE: { // {SETCASE}
/* This is a pseudo command, it's outputted when someone does {STRING.ack}
* The modifier is added to all subsequent GetStringWithArgs that accept the modifier. */
--- a/src/table/control_codes.h Sun Jun 24 22:18:46 2007 +0000
+++ b/src/table/control_codes.h Sun Jun 24 22:42:11 2007 +0000
@@ -27,6 +27,7 @@
SCC_STATION_NAME,
SCC_TOWN_NAME,
SCC_GROUP_NAME,
+ SCC_VEHICLE_NAME,
SCC_CURRENCY_COMPACT,
SCC_CURRENCY,
--- a/src/timetable_gui.cpp Sun Jun 24 22:18:46 2007 +0000
+++ b/src/timetable_gui.cpp Sun Jun 24 22:42:11 2007 +0000
@@ -73,8 +73,7 @@
DisableWindowWidget(w, 8);
}
- SetDParam(0, v->string_id);
- SetDParam(1, v->unitnumber);
+ SetDParam(0, v->index);
DrawWindowWidgets(w);
int y = 15;
--- a/src/train_gui.cpp Sun Jun 24 22:18:46 2007 +0000
+++ b/src/train_gui.cpp Sun Jun 24 22:42:11 2007 +0000
@@ -169,8 +169,7 @@
}
/* draw widgets & caption */
- SetDParam(0, v->string_id);
- SetDParam(1, v->unitnumber);
+ SetDParam(0, v->index);
DrawWindowWidgets(w);
if (v->u.rail.crash_anim_pos != 0) {
@@ -412,8 +411,7 @@
SetWindowWidgetDisabledState(w, 6, !_patches.servint_trains);
SetWindowWidgetDisabledState(w, 7, !_patches.servint_trains);
- SetDParam(0, v->string_id);
- SetDParam(1, v->unitnumber);
+ SetDParam(0, v->index);
DrawWindowWidgets(w);
SetDParam(1, v->age / 366);
@@ -520,8 +518,8 @@
switch (e->we.click.widget) {
case 2: /* name train */
v = GetVehicle(w->window_number);
- SetDParam(0, v->unitnumber);
- ShowQueryString(v->string_id, STR_8865_NAME_TRAIN, 31, 150, w, CS_ALPHANUMERAL);
+ SetDParam(0, v->index);
+ ShowQueryString(STR_VEHICLE_NAME, STR_8865_NAME_TRAIN, 31, 150, w, CS_ALPHANUMERAL);
break;
case 6: /* inc serv interval */
mod = _ctrl_pressed? 5 : 10;
--- a/src/vehicle_gui.cpp Sun Jun 24 22:18:46 2007 +0000
+++ b/src/vehicle_gui.cpp Sun Jun 24 22:42:11 2007 +0000
@@ -331,8 +331,7 @@
SetVScrollCount(w, WP(w, refit_d).list->num_lines);
- SetDParam(0, v->string_id);
- SetDParam(1, v->unitnumber);
+ SetDParam(0, v->index);
DrawWindowWidgets(w);
WP(w, refit_d).cargo = DrawVehicleRefitWindow(WP(w, refit_d).list, WP(w, refit_d).sel, w->vscroll.pos, w->vscroll.cap, w->resize.step_height);
@@ -1017,7 +1016,7 @@
(v->type == VEH_AIRCRAFT && v->string_id != STR_SV_AIRCRAFT_NAME)) {
/* The vehicle got a name so we will print it */
- SetDParam(0, v->string_id);
+ SetDParam(0, v->index);
DrawString(x + 19, y, STR_01AB, 0);
}