Changeset - r7059:0c2dc932a6ae
[Not reviewed]
master
0 11 0
peter1138 - 17 years ago 2007-06-25 14:46:32
peter1138@openttd.org
(svn r10324) -Codechange: reference engine names by index
11 files changed with 37 insertions and 20 deletions:
0 comments (0 inline, 0 general)
src/aircraft_gui.cpp
Show inline comments
 
@@ -136,7 +136,7 @@ static void AircraftDetailsWndProc(Windo
 

	
 
			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);
src/autoreplace_gui.cpp
Show inline comments
 
@@ -288,7 +288,8 @@ static void ReplaceVehicleWndProc(Window
 
				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);
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -140,12 +140,14 @@ static int CDECL EngineNameSorter(const 
 

	
 
	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, in
 
		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(Windo
 
					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;
 
		}
src/engine_gui.cpp
Show inline comments
 
@@ -78,7 +78,8 @@ static void EnginePreviewWndProc(Window 
 
		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(co
 
{
 
	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);
src/lang/english.txt
Show inline comments
 
@@ -2669,8 +2669,8 @@ STR_882A_END_OF_ORDERS                  
 
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                      
 
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            
 
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            
 
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            
 
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 
 
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}
src/roadveh_gui.cpp
Show inline comments
 
@@ -117,7 +117,7 @@ static void RoadVehDetailsWndProc(Window
 

	
 
		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);
src/ship_gui.cpp
Show inline comments
 
@@ -82,8 +82,8 @@ static void ShipDetailsWndProc(Window *w
 

	
 
		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);
 

	
src/strgen/strgen.cpp
Show inline comments
 
@@ -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},
src/strings.cpp
Show inline comments
 
@@ -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, co
 
				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));
 

	
src/table/control_codes.h
Show inline comments
 
@@ -32,6 +32,7 @@ enum {
 
	SCC_COMPANY_NAME,
 
	SCC_COMPANY_NUM,
 
	SCC_PLAYER_NAME,
 
	SCC_ENGINE_NAME,
 

	
 
	SCC_CURRENCY_COMPACT,
 
	SCC_CURRENCY,
src/train_gui.cpp
Show inline comments
 
@@ -342,11 +342,11 @@ static void TrainDetailsCargoTab(const V
 
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);
0 comments (0 inline, 0 general)