From 8411b3b9fe2a27789fb5c36b2165c2c6c8c5708a Mon Sep 17 00:00:00 2001 From: peter1138 Date: Fri, 20 Oct 2006 11:53:29 +0000 Subject: (svn r6855) - Codechange: When displaying a "quantity of cargo" string, use the {CARGO} command and supply the cargo type and quantity, instead of manually looking up the cargo type's string. --- aircraft_gui.c | 4 ++-- build_vehicle_gui.c | 2 +- engine_gui.c | 7 +++---- industry_gui.c | 8 ++++---- lang/english.txt | 30 +++++++++++++++--------------- roadveh_gui.c | 4 ++-- ship_gui.c | 4 ++-- station_gui.c | 4 ++-- train_gui.c | 6 +++--- vehicle_gui.c | 2 +- 10 files changed, 35 insertions(+), 36 deletions(-) diff --git a/aircraft_gui.c b/aircraft_gui.c index 39f6c7a3d..3800254e6 100644 --- a/aircraft_gui.c +++ b/aircraft_gui.c @@ -95,10 +95,10 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e) DrawString(60, y, STR_A011_BUILT_VALUE, 0); y += 10; - SetDParam(0, _cargoc.names_long[v->cargo_type]); + SetDParam(0, v->cargo_type); SetDParam(1, v->cargo_cap); u = v->next; - SetDParam(2, _cargoc.names_long[u->cargo_type]); + SetDParam(2, u->cargo_type); SetDParam(3, u->cargo_cap); DrawString(60, y, (u->cargo_cap != 0) ? STR_A019_CAPACITY : STR_A01A_CAPACITY, 0); y += 14; diff --git a/build_vehicle_gui.c b/build_vehicle_gui.c index 002e69429..ce7f91a83 100644 --- a/build_vehicle_gui.c +++ b/build_vehicle_gui.c @@ -231,7 +231,7 @@ void DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number) } else { /* Note, if the default capacity is selected by the refit capacity * callback, then the capacity shown is likely to be incorrect. */ - SetDParam(0, _cargoc.names_long[cargo]); + SetDParam(0, cargo); SetDParam(1, AircraftDefaultCargoCapacity(cargo, engine_number)); SetDParam(2, STR_9842_REFITTABLE); DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0); diff --git a/engine_gui.c b/engine_gui.c index 8009994ae..90ea19140 100644 --- a/engine_gui.c +++ b/engine_gui.c @@ -136,7 +136,7 @@ static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw) SetDParam(4, rvi->running_cost_base * _price.running_rail[rvi->running_cost_class] >> 8 << multihead); if (rvi->capacity != 0) { - SetDParam(5, _cargoc.names_long[rvi->cargo_type]); + SetDParam(5, rvi->cargo_type); SetDParam(6, rvi->capacity << multihead); } else { SetDParam(5, STR_8838_N_A); @@ -219,9 +219,8 @@ static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw) SetDParam(0, (_price.roadveh_base >> 3) * rvi->base_cost >> 5); SetDParam(1, rvi->max_speed / 2); SetDParam(2, rvi->running_cost * _price.roadveh_running >> 8); - + SetDParam(3, rvi->cargo_type); SetDParam(4, rvi->capacity); - SetDParam(3, _cargoc.names_long[rvi->cargo_type]); DrawStringMultiCenter(x, y, STR_902A_COST_SPEED_RUNNING_COST, maxw); } @@ -257,7 +256,7 @@ static void DrawShipEngineInfo(EngineID engine, int x, int y, int maxw) const ShipVehicleInfo *svi = ShipVehInfo(engine); SetDParam(0, svi->base_cost * (_price.ship_base >> 3) >> 5); SetDParam(1, svi->max_speed / 2); - SetDParam(2, _cargoc.names_long[svi->cargo_type]); + SetDParam(2, svi->cargo_type); SetDParam(3, svi->capacity); SetDParam(4, svi->running_cost * _price.ship_running >> 8); DrawStringMultiCenter(x, y, STR_982E_COST_MAX_SPEED_CAPACITY, maxw); diff --git a/industry_gui.c b/industry_gui.c index d0be15e9a..a5c9258bc 100644 --- a/industry_gui.c +++ b/industry_gui.c @@ -315,7 +315,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e) if (i->produced_cargo[0] != CT_INVALID) { DrawString(2, 117, STR_482A_PRODUCTION_LAST_MONTH, 0); - SetDParam(0, _cargoc.names_long[i->produced_cargo[0]]); + SetDParam(0, i->produced_cargo[0]); SetDParam(1, i->total_production[0]); SetDParam(2, i->pct_transported[0] * 100 >> 8); @@ -327,7 +327,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e) } if (i->produced_cargo[1] != CT_INVALID) { - SetDParam(0, _cargoc.names_long[i->produced_cargo[1]]); + SetDParam(0, i->produced_cargo[1]); SetDParam(1, i->total_production[1]); SetDParam(2, i->pct_transported[1] * 100 >> 8); DrawString(4 + (IsProductionAlterable(i) ? 30 : 0), 137, STR_482B_TRANSPORTED, 0); @@ -600,11 +600,11 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e) SetDParam(0, i->index); if (i->produced_cargo[0] != CT_INVALID) { - SetDParam(1, _cargoc.names_long[i->produced_cargo[0]]); + SetDParam(1, i->produced_cargo[0]); SetDParam(2, i->total_production[0]); if (i->produced_cargo[1] != CT_INVALID) { - SetDParam(3, _cargoc.names_long[i->produced_cargo[1]]); + SetDParam(3, i->produced_cargo[1]); SetDParam(4, i->total_production[1]); SetDParam(5, i->pct_transported[0] * 100 >> 8); SetDParam(6, i->pct_transported[1] * 100 >> 8); diff --git a/lang/english.txt b/lang/english.txt index bf64c92e9..383e3c213 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -13,8 +13,8 @@ STR_0005 :{RED}{CURRENCY6 STR_EMPTY : STR_0007_FLAT_LAND_REQUIRED :{WHITE}Flat land required STR_0008_WAITING :{BLACK}Waiting: {WHITE}{STRING} -STR_0009 :{WHITE}{STRING1} -STR_000A_EN_ROUTE_FROM :{WHITE}{STRING1}{YELLOW} (en-route from +STR_0009 :{WHITE}{CARGO} +STR_000A_EN_ROUTE_FROM :{WHITE}{CARGO}{YELLOW} (en-route from STR_000B :{YELLOW}{STATION}) STR_000C_ACCEPTS :{BLACK}Accepts: {WHITE} STR_000D_ACCEPTS :{BLACK}Accepts: {GOLD} @@ -285,7 +285,7 @@ STR_013C_CARGO :{BLACK}Cargo STR_013D_INFORMATION :{BLACK}Information STR_013E_CAPACITIES :{BLACK}Capacities STR_013E_TOTAL_CARGO :{BLACK}Total Cargo -STR_013F_CAPACITY :{BLACK}Capacity: {LTBLUE}{STRING1} +STR_013F_CAPACITY :{BLACK}Capacity: {LTBLUE}{CARGO} STR_013F_TOTAL_CAPACITY_TEXT :{BLACK}Total cargo capacity of this train: STR_013F_TOTAL_CAPACITY :{LTBLUE}- {CARGO} ({SHORTCARGO}) STR_0140_NEW_GAME :{BLACK}New Game @@ -1235,8 +1235,8 @@ STR_CONSTRUCT_TOFFEE_QUARRY_TIP :{BLACK}Fund Tof STR_CONSTRUCT_SUGAR_MINE_TIP :{BLACK}Construct Sugar Mine STR_INDUSTRYDIR_CAPTION :{WHITE}Industries -STR_INDUSTRYDIR_ITEM :{ORANGE}{INDUSTRY}{BLACK} ({STRING1}){YELLOW} ({COMMA}% transported) -STR_INDUSTRYDIR_ITEM_TWO :{ORANGE}{INDUSTRY}{BLACK} ({STRING1}/{STRING1}){YELLOW} ({COMMA}%/{COMMA}% transported) +STR_INDUSTRYDIR_ITEM :{ORANGE}{INDUSTRY}{BLACK} ({CARGO}){YELLOW} ({COMMA}% transported) +STR_INDUSTRYDIR_ITEM_TWO :{ORANGE}{INDUSTRY}{BLACK} ({CARGO}/{CARGO}){YELLOW} ({COMMA}%/{COMMA}% transported) STR_INDUSTRYDIR_ITEM_NOPROD :{ORANGE}{INDUSTRY} STR_INDUSTRY_TOO_CLOSE :{WHITE}...too close to another industry @@ -1843,7 +1843,7 @@ STR_4829_REQUIRES :{BLACK}Requires ############ range for requires ends STR_482A_PRODUCTION_LAST_MONTH :{BLACK}Production last month: -STR_482B_TRANSPORTED :{YELLOW}{STRING1}{BLACK} ({COMMA}% transported) +STR_482B_TRANSPORTED :{YELLOW}{CARGO}{BLACK} ({COMMA}% transported) STR_482C_CENTER_THE_MAIN_VIEW_ON :{BLACK}Centre the main view on industry location STR_482D_NEW_UNDER_CONSTRUCTION :{BLACK}{BIGFONT}New {STRING} under construction near {TOWN}! STR_482E_NEW_BEING_PLANTED_NEAR :{BLACK}{BIGFONT}New {STRING} being planted near {TOWN}! @@ -2583,7 +2583,7 @@ STR_8858_MAKE_THE_HIGHLIGHTED_ORDER :{BLACK}Make the STR_SERVICE_HINT :{BLACK}Skip this order unless a service is needed STR_8859_NEW_NOW_AVAILABLE :{BLACK}{BIGFONT}New {STRING} now available! STR_885A :{BLACK}{BIGFONT}{STRING} -STR_VEHICLE_INFO_COST_WEIGHT_SPEED_POWER :{BLACK}Cost: {CURRENCY} Weight: {WEIGHT_S}{}Speed: {VELOCITY} Power: {POWER}{}Running Cost: {CURRENCY}/yr{}Capacity: {STRING1} +STR_VEHICLE_INFO_COST_WEIGHT_SPEED_POWER :{BLACK}Cost: {CURRENCY} Weight: {WEIGHT_S}{}Speed: {VELOCITY} Power: {POWER}{}Running Cost: {CURRENCY}/yr{}Capacity: {CARGO} STR_885C_BROKEN_DOWN :{RED}Broken down STR_885D_AGE_RUNNING_COST_YR :{BLACK}Age: {LTBLUE}{STRING2}{BLACK} Running Cost: {LTBLUE}{CURRENCY}/yr STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED :{BLACK}Weight: {LTBLUE}{WEIGHT_S} {BLACK}Power: {LTBLUE}{POWER}{BLACK} Max. speed: {LTBLUE}{VELOCITY} @@ -2624,7 +2624,7 @@ STR_900E_MAX_SPEED :{BLACK}Max. spe 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_9012_CAPACITY :{BLACK}Capacity: {LTBLUE}{STRING1} +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... STR_9015_CAN_T_STOP_START_ROAD_VEHICLE :{WHITE}Can't stop/start road vehicle... @@ -2651,7 +2651,7 @@ STR_9026_ROAD_VEHICLE_SELECTION :{BLACK}Road veh STR_9027_BUILD_THE_HIGHLIGHTED_ROAD :{BLACK}Build the highlighted road vehicle STR_9028_NEW_ROAD_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}New road vehicle now available! STR_9029 :{BLACK}{BIGFONT}{STRING} -STR_902A_COST_SPEED_RUNNING_COST :{BLACK}Cost: {CURRENCY}{}Speed: {VELOCITY}{}Running Cost: {CURRENCY}/yr{}Capacity: {STRING1} +STR_902A_COST_SPEED_RUNNING_COST :{BLACK}Cost: {CURRENCY}{}Speed: {VELOCITY}{}Running Cost: {CURRENCY}/yr{}Capacity: {CARGO} STR_902C_NAME_ROAD_VEHICLE :{WHITE}Name road vehicle STR_902D_CAN_T_NAME_ROAD_VEHICLE :{WHITE}Can't name road vehicle... @@ -2698,7 +2698,7 @@ STR_9813_MAX_SPEED :{BLACK}Max. spe 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_9817_CAPACITY :{BLACK}Capacity: {LTBLUE}{STRING1} +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... STR_981A_UNABLE_TO_FIND_LOCAL_DEPOT :{WHITE}Unable to find local depot @@ -2724,7 +2724,7 @@ STR_982A_SEND_SHIP_TO_DEPOT :{BLACK}Send shi STR_982B_SHOW_SHIP_DETAILS :{BLACK}Show ship details STR_982C_NEW_SHIP_NOW_AVAILABLE :{BLACK}{BIGFONT}New ship now available! STR_982D :{BLACK}{BIGFONT}{STRING} -STR_982E_COST_MAX_SPEED_CAPACITY :{BLACK}Cost: {CURRENCY} Max. Speed: {VELOCITY}{}Capacity: {STRING1}{}Running Cost: {CURRENCY}/yr +STR_982E_COST_MAX_SPEED_CAPACITY :{BLACK}Cost: {CURRENCY} Max. Speed: {VELOCITY}{}Capacity: {CARGO}{}Running Cost: {CURRENCY}/yr STR_982F_NAME_SHIP :{BLACK}Name ship STR_9831_NAME_SHIP :{WHITE}Name ship @@ -2742,7 +2742,7 @@ STR_983C_REFIT_SHIP :{BLACK}Refit sh STR_983D_SELECT_TYPE_OF_CARGO_FOR :{BLACK}Select type of cargo for ship to carry STR_983E_REFIT_SHIP_TO_CARRY_HIGHLIGHTED :{BLACK}Refit ship to carry highlighted cargo type STR_983F_SELECT_CARGO_TYPE_TO_CARRY :{GOLD}Select cargo type to carry: -STR_9840_NEW_CAPACITY_COST_OF_REFIT :{BLACK}New capacity: {GOLD}{STRING1}{}{BLACK}Cost of refit: {GOLD}{CURRENCY} +STR_9840_NEW_CAPACITY_COST_OF_REFIT :{BLACK}New capacity: {GOLD}{CARGO}{}{BLACK}Cost of refit: {GOLD}{CURRENCY} STR_9841_CAN_T_REFIT_SHIP :{WHITE}Can't refit ship... STR_9842_REFITTABLE :(refittable) STR_GO_TO_SHIP_DEPOT :Go to {TOWN} Ship Depot @@ -2777,8 +2777,8 @@ STR_A014_AIRCRAFT_IS_WAITING_IN :{WHITE}Aircraft STR_A015_AIRCRAFT_IN_THE_WAY :{WHITE}Aircraft in the way STR_A016_CAN_T_STOP_START_AIRCRAFT :{WHITE}Can't stop/start aircraft... STR_A017_AIRCRAFT_IS_IN_FLIGHT :{WHITE}Aircraft is in flight -STR_A019_CAPACITY :{BLACK}Capacity: {LTBLUE}{STRING1}, {STRING1} -STR_A01A_CAPACITY :{BLACK}Capacity: {LTBLUE}{STRING1} +STR_A019_CAPACITY :{BLACK}Capacity: {LTBLUE}{CARGO}, {CARGO} +STR_A01A_CAPACITY :{BLACK}Capacity: {LTBLUE}{CARGO} STR_A01B_AIRCRAFT_MUST_BE_STOPPED :{WHITE}Aircraft must be stopped in hangar STR_A01C_CAN_T_SELL_AIRCRAFT :{WHITE}Can't sell aircraft... STR_A01D_AIRPORT_CONSTRUCTION :Airport construction @@ -3013,7 +3013,7 @@ STR_PURCHASE_INFO_COST_WEIGHT :{BLACK}Cost: {G STR_PURCHASE_INFO_SPEED_POWER :{BLACK}Speed: {GOLD}{VELOCITY}{BLACK} Power: {GOLD}{POWER} STR_PURCHASE_INFO_SPEED :{BLACK}Speed: {GOLD}{VELOCITY} STR_PURCHASE_INFO_RUNNINGCOST :{BLACK}Running Cost: {GOLD}{CURRENCY}/yr -STR_PURCHASE_INFO_CAPACITY :{BLACK}Capacity: {GOLD}{STRING1} {STRING} +STR_PURCHASE_INFO_CAPACITY :{BLACK}Capacity: {GOLD}{CARGO} {STRING} STR_PURCHASE_INFO_DESIGNED_LIFE :{BLACK}Designed: {GOLD}{NUM}{BLACK} Life: {GOLD}{COMMA} years STR_PURCHASE_INFO_RELIABILITY :{BLACK}Max. Reliability: {GOLD}{COMMA}% STR_PURCHASE_INFO_COST :{BLACK}Cost: {GOLD}{CURRENCY} diff --git a/roadveh_gui.c b/roadveh_gui.c index e86127205..93863a63b 100644 --- a/roadveh_gui.c +++ b/roadveh_gui.c @@ -47,7 +47,7 @@ void DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number) y += 10; /* Cargo type + capacity */ - SetDParam(0, _cargoc.names_long[rvi->cargo_type]); + SetDParam(0, rvi->cargo_type); SetDParam(1, rvi->capacity); SetDParam(2, refittable ? STR_9842_REFITTABLE : STR_EMPTY); DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0); @@ -141,7 +141,7 @@ static void RoadVehDetailsWndProc(Window *w, WindowEvent *e) SetDParam(2, v->value); DrawString(34, 57, STR_9011_BUILT_VALUE, 0); - SetDParam(0, _cargoc.names_long[v->cargo_type]); + SetDParam(0, v->cargo_type); SetDParam(1, v->cargo_cap); DrawString(34, 67, STR_9012_CAPACITY, 0); diff --git a/ship_gui.c b/ship_gui.c index 3d16ec0b2..9c7a68686 100644 --- a/ship_gui.c +++ b/ship_gui.c @@ -40,7 +40,7 @@ void DrawShipPurchaseInfo(int x, int y, EngineID engine_number) y += 10; /* Cargo type + capacity */ - SetDParam(0, _cargoc.names_long[svi->cargo_type]); + SetDParam(0, svi->cargo_type); SetDParam(1, svi->capacity); SetDParam(2, svi->refittable ? STR_9842_REFITTABLE : STR_EMPTY); DrawString(x,y, STR_PURCHASE_INFO_CAPACITY, 0); @@ -140,7 +140,7 @@ static void ShipDetailsWndProc(Window *w, WindowEvent *e) SetDParam(2, v->value); DrawString(74, 57, STR_9816_BUILT_VALUE, 0); - SetDParam(0, _cargoc.names_long[v->cargo_type]); + SetDParam(0, v->cargo_type); SetDParam(1, v->cargo_cap); DrawString(74, 67, STR_9817_CAPACITY, 0); diff --git a/station_gui.c b/station_gui.c index eb095f8d9..a28a54393 100644 --- a/station_gui.c +++ b/station_gui.c @@ -612,7 +612,7 @@ static void DrawStationViewWindow(Window *w) if ( st->goods[i].enroute_from == station_id) { if (--pos < 0) { SetDParam(1, waiting); - SetDParam(0, _cargoc.names_long[i]); + SetDParam(0, i); DrawStringRightAligned(x + 234, y, STR_0009, 0); y += 10; } @@ -620,7 +620,7 @@ static void DrawStationViewWindow(Window *w) /* enroute */ if (--pos < 0) { SetDParam(1, waiting); - SetDParam(0, _cargoc.names_long[i]); + SetDParam(0, i); DrawStringRightAligned(x + 234, y, STR_000A_EN_ROUTE_FROM, 0); y += 10; } diff --git a/train_gui.c b/train_gui.c index 6e49831d2..e89dec050 100644 --- a/train_gui.c +++ b/train_gui.c @@ -272,7 +272,7 @@ void DrawTrainEnginePurchaseInfo(int x, int y, EngineID engine_number) SetDParam(0, STR_8838_N_A); SetDParam(2, STR_EMPTY); if (rvi->capacity != 0) { - SetDParam(0, _cargoc.names_long[rvi->cargo_type]); + SetDParam(0, rvi->cargo_type); SetDParam(1, (rvi->capacity * (CountArticulatedParts(engine_number) + 1)) << multihead); SetDParam(2, STR_9842_REFITTABLE); } @@ -320,7 +320,7 @@ void DrawTrainWagonPurchaseInfo(int x, int y, EngineID engine_number) SetDParam(0, STR_8838_N_A); SetDParam(2, STR_EMPTY); if (rvi->capacity != 0) { - SetDParam(0, _cargoc.names_long[rvi->cargo_type]); + SetDParam(0, rvi->cargo_type); SetDParam(1, rvi->capacity * (CountArticulatedParts(engine_number) + 1)); SetDParam(2, refittable ? STR_9842_REFITTABLE : STR_EMPTY); } @@ -969,7 +969,7 @@ static void TrainDetailsInfoTab(const Vehicle *v, int x, int y) static void TrainDetailsCapacityTab(const Vehicle *v, int x, int y) { if (v->cargo_cap != 0) { - SetDParam(0, _cargoc.names_long[v->cargo_type]); + SetDParam(0, v->cargo_type); SetDParam(1, v->cargo_cap); DrawString(x, y, STR_013F_CAPACITY, 0); } diff --git a/vehicle_gui.c b/vehicle_gui.c index 41bb10a67..1787bda48 100644 --- a/vehicle_gui.c +++ b/vehicle_gui.c @@ -359,7 +359,7 @@ static void VehicleRefitWndProc(Window *w, WindowEvent *e) cost = DoCommand(v->tile, v->index, WP(w,refit_d).cargo->cargo | WP(w,refit_d).cargo->subtype << 8, DC_QUERY_COST, cost); if (!CmdFailed(cost)) { - SetDParam(0, _cargoc.names_long[WP(w,refit_d).cargo->cargo]); + SetDParam(0, WP(w,refit_d).cargo->cargo); SetDParam(1, _returned_refit_capacity); SetDParam(2, cost); DrawString(2, w->widget[5].top + 1, STR_9840_NEW_CAPACITY_COST_OF_REFIT, 0); -- cgit v1.2.3-70-g09d2