diff options
-rw-r--r-- | lang/english.txt | 4 | ||||
-rw-r--r-- | saveload.c | 2 | ||||
-rw-r--r-- | settings.c | 1 | ||||
-rw-r--r-- | settings_gui.c | 5 | ||||
-rw-r--r-- | train.h | 2 | ||||
-rw-r--r-- | train_cmd.c | 16 | ||||
-rw-r--r-- | train_gui.c | 9 | ||||
-rw-r--r-- | variables.h | 2 |
8 files changed, 34 insertions, 7 deletions
diff --git a/lang/english.txt b/lang/english.txt index f1e72fef3..4d57418f8 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -286,8 +286,10 @@ STR_013D_INFORMATION :{BLACK}Informat STR_013E_CAPACITIES :{BLACK}Capacities STR_013E_TOTAL_CARGO :{BLACK}Total Cargo STR_013F_CAPACITY :{BLACK}Capacity: {LTBLUE}{CARGO} +STR_CAPACITY_MULT :{BLACK}Capacity: {LTBLUE}{CARGO} (x{NUM}) STR_013F_TOTAL_CAPACITY_TEXT :{BLACK}Total cargo capacity of this train: STR_013F_TOTAL_CAPACITY :{LTBLUE}- {CARGO} ({SHORTCARGO}) +STR_TOTAL_CAPACITY_MULT :{LTBLUE}- {CARGO} ({SHORTCARGO}) (x{NUM}) STR_0140_NEW_GAME :{BLACK}New Game STR_0141_LOAD_GAME :{BLACK}Load Game STR_SINGLE_PLAYER :{BLACK}Single player @@ -1025,6 +1027,7 @@ STR_CONFIG_PATCHES_AUTOSCROLL :{LTBLUE}Pan win STR_CONFIG_PATCHES_BRIBE :{LTBLUE}Allow bribing of the local authority: {ORANGE}{STRING1} STR_CONFIG_PATCHES_NONUNIFORM_STATIONS :{LTBLUE}Nonuniform stations: {ORANGE}{STRING1} STR_CONFIG_PATCHES_NEW_PATHFINDING_ALL :{LTBLUE}New global pathfinding (NPF, overrides NTP): {ORANGE}{STRING1} +STR_CONFIG_PATCHES_FREIGHT_TRAINS :{LTBLUE}Weight multiplier for freight to simulate heavy trains: {ORANGE}{STRING} STR_CONFIG_PATCHES_SMALL_AIRPORTS :{LTBLUE}Always allow small airports: {ORANGE}{STRING1} @@ -2498,6 +2501,7 @@ STR_INVALID_ORDER :{RED} (Invalid STR_UNKNOWN_DESTINATION :unknown destination STR_8812_EMPTY :{LTBLUE}Empty STR_8813_FROM :{LTBLUE}{CARGO} from {STATION} +STR_FROM_MULT :{LTBLUE}{CARGO} from {STATION} (x{NUM}) STR_8814_TRAIN_IS_WAITING_IN_DEPOT :{WHITE}Train {COMMA} is waiting in depot STR_8815_NEW_VEHICLES :{BLACK}New Vehicles STR_8816 :{BLACK}- diff --git a/saveload.c b/saveload.c index 00df02bdb..9acdb7461 100644 --- a/saveload.c +++ b/saveload.c @@ -30,7 +30,7 @@ #include "variables.h" #include <setjmp.h> -const uint16 SAVEGAME_VERSION = 38; +const uint16 SAVEGAME_VERSION = 39; uint16 _sl_version; /// the major savegame version identifier byte _sl_minor_version; /// the minor savegame version, DO NOT USE! diff --git a/settings.c b/settings.c index 4e94a97e6..3bd825e68 100644 --- a/settings.c +++ b/settings.c @@ -1322,6 +1322,7 @@ const SettingDesc _patch_settings[] = { SDT_BOOL(Patches, no_servicing_if_no_breakdowns, 0, 0, false, STR_CONFIG_PATCHES_NOSERVICE, NULL), SDT_BOOL(Patches, wagon_speed_limits, 0, 0, true, STR_CONFIG_PATCHES_WAGONSPEEDLIMITS, NULL), SDT_CONDBOOL(Patches, disable_elrails, 38, SL_MAX_VERSION, 0, 0, false, STR_CONFIG_PATCHES_DISABLE_ELRAILS, SettingsDisableElrail), + SDT_CONDVAR(Patches, freight_trains, SLE_UINT8, 39, SL_MAX_VERSION, 0, 0, 1, 1, 255, 1, STR_CONFIG_PATCHES_FREIGHT_TRAINS, NULL), /***************************************************************************/ /* Station section of the GUI-configure patches window */ diff --git a/settings_gui.c b/settings_gui.c index ebdc58df6..996b9f340 100644 --- a/settings_gui.c +++ b/settings_gui.c @@ -647,6 +647,7 @@ static const char *_patches_vehicles[] = { "no_servicing_if_no_breakdowns", "wagon_speed_limits", "disable_elrails", + "freight_trains", }; typedef struct PatchEntry { @@ -889,7 +890,7 @@ static const Widget _patches_selection_widgets[] = { { WWT_CLOSEBOX, RESIZE_NONE, 10, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, { WWT_CAPTION, RESIZE_NONE, 10, 11, 369, 0, 13, STR_CONFIG_PATCHES_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, { WWT_PANEL, RESIZE_NONE, 10, 0, 369, 14, 41, 0x0, STR_NULL}, -{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 42, 360, 0x0, STR_NULL}, +{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 42, 370, 0x0, STR_NULL}, { WWT_TEXTBTN, RESIZE_NONE, 3, 10, 96, 16, 27, STR_CONFIG_PATCHES_GUI, STR_NULL}, { WWT_TEXTBTN, RESIZE_NONE, 3, 97, 183, 16, 27, STR_CONFIG_PATCHES_CONSTRUCTION, STR_NULL}, @@ -901,7 +902,7 @@ static const Widget _patches_selection_widgets[] = { }; static const WindowDesc _patches_selection_desc = { - WDP_CENTER, WDP_CENTER, 370, 361, + WDP_CENTER, WDP_CENTER, 370, 371, WC_GAME_OPTIONS,0, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _patches_selection_widgets, @@ -222,4 +222,6 @@ uint CountArticulatedParts(EngineID engine_type); int CheckTrainInDepot(const Vehicle *v, bool needs_to_be_stopped); void CcCloneTrain(bool success, TileIndex tile, uint32 p1, uint32 p2); +byte FreightWagonMult(const Vehicle *v); + #endif /* TRAIN_H */ diff --git a/train_cmd.c b/train_cmd.c index a38c9d02e..33303a152 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -40,6 +40,20 @@ static const byte _vehicle_initial_x_fract[4] = {10, 8, 4, 8}; static const byte _vehicle_initial_y_fract[4] = { 8, 4, 8, 10}; static const byte _state_dir_table[4] = { 0x20, 8, 0x10, 4 }; + +/** Return the cargo weight multiplier to use for a rail vehicle + * @param v Vehicle (wagon) to get multiplier for + * @return Cargo weight multiplier + */ +byte FreightWagonMult(const Vehicle *v) +{ + assert(v->type == VEH_Train); + // XXX NewCargos introduces a specific "is freight" flag for this test. + if (v->cargo_type == CT_PASSENGERS || v->cargo_type == CT_MAIL) return 1; + return _patches.freight_trains; +} + + /** * Recalculates the cached weight of a train and its vehicles. Should be called each time the cargo on * the consist changes. @@ -52,7 +66,7 @@ static void TrainCargoChanged(Vehicle* v) for (u = v; u != NULL; u = u->next) { const RailVehicleInfo *rvi = RailVehInfo(u->engine_type); - uint32 vweight = (_cargoc.weights[u->cargo_type] * u->cargo_count) / 16; + uint32 vweight = (_cargoc.weights[u->cargo_type] * u->cargo_count * FreightWagonMult(u)) / 16; // Vehicle weight is not added for articulated parts. if (!IsArticulatedPart(u)) { diff --git a/train_gui.c b/train_gui.c index ffb36ea4e..5d208799e 100644 --- a/train_gui.c +++ b/train_gui.c @@ -951,7 +951,8 @@ static void TrainDetailsCargoTab(const Vehicle *v, int x, int y) SetDParam(0, v->cargo_type); SetDParam(1, num); SetDParam(2, v->cargo_source); - str = STR_8813_FROM; + SetDParam(3, _patches.freight_trains); + str = FreightWagonMult(v) > 1 ? STR_FROM_MULT : STR_8813_FROM; } DrawString(x, y, str, 0); } @@ -976,7 +977,8 @@ static void TrainDetailsCapacityTab(const Vehicle *v, int x, int y) if (v->cargo_cap != 0) { SetDParam(0, v->cargo_type); SetDParam(1, v->cargo_cap); - DrawString(x, y, STR_013F_CAPACITY, 0); + SetDParam(2, _patches.freight_trains); + DrawString(x, y, FreightWagonMult(v) > 1 ? STR_CAPACITY_MULT : STR_013F_CAPACITY, 0); } } @@ -1113,7 +1115,8 @@ static void DrawTrainDetailsWindow(Window *w) SetDParam(1, act_cargo[i]); // {CARGO} #2 SetDParam(2, i); // {SHORTCARGO} #1 SetDParam(3, max_cargo[i]); // {SHORTCARGO} #2 - DrawString(x, y + 2, STR_013F_TOTAL_CAPACITY, 0); + SetDParam(4, _patches.freight_trains); + DrawString(x, y + 2, FreightWagonMult(v) > 1 ? STR_TOTAL_CAPACITY_MULT : STR_013F_TOTAL_CAPACITY, 0); } } } diff --git a/variables.h b/variables.h index 15d2404f6..cf5e7702a 100644 --- a/variables.h +++ b/variables.h @@ -213,6 +213,8 @@ typedef struct Patches { bool population_in_label; // Show the population of a town in his label? + uint8 freight_trains; ///< Value to multiply the weight of cargo by + /** YAPF settings */ YapfSettings yapf; |