diff options
-rw-r--r-- | misc.c | 16 | ||||
-rw-r--r-- | strings.c | 3 | ||||
-rw-r--r-- | table/landscape_const.h | 82 |
3 files changed, 85 insertions, 16 deletions
@@ -19,6 +19,7 @@ #include "vehicle_gui.h" #include "variables.h" #include "ai/ai.h" +#include "table/landscape_const.h" extern void StartupEconomy(void); @@ -392,30 +393,19 @@ uint ConvertIntDate(uint date) return ConvertYMDToDay(year, month, day); } -typedef struct LandscapePredefVar { - StringID names[NUM_CARGO]; - byte weights[NUM_CARGO]; - StringID sprites[NUM_CARGO]; - uint16 initial_cargo_payment[NUM_CARGO]; - byte transit_days_table_1[NUM_CARGO]; - byte transit_days_table_2[NUM_CARGO]; - byte road_veh_by_cargo_start[NUM_CARGO]; - byte road_veh_by_cargo_count[NUM_CARGO]; -} LandscapePredefVar; -#include "table/landscape_const.h" // Calculate constants that depend on the landscape type. void InitializeLandscapeVariables(bool only_constants) { - const LandscapePredefVar *lpd; + const CargoTypesValues *lpd; uint i; StringID str; - lpd = &_landscape_predef_var[_opt.landscape]; + lpd = &_cargo_types_base_values[_opt.landscape]; memcpy(_cargoc.ai_roadveh_start, lpd->road_veh_by_cargo_start,sizeof(lpd->road_veh_by_cargo_start)); memcpy(_cargoc.ai_roadveh_count, lpd->road_veh_by_cargo_count,sizeof(lpd->road_veh_by_cargo_count)); @@ -17,6 +17,7 @@ #include "industry.h" #include "variables.h" #include "newgrf_text.h" +#include "table/landscape_const.h" char _userstring[128]; @@ -584,7 +585,7 @@ static char *FormatString(char *buff, const char *str, const int32 *argv, uint c // Short description of cargotypes. Layout: // 8-bit = cargo type // 16-bit = cargo count - StringID cargo_str = _cargo_string_list[_opt_ptr->landscape][GetInt32(&argv)]; + StringID cargo_str = _cargo_types_base_values[_opt_ptr->landscape].units_volume[GetInt32(&argv)]; switch (cargo_str) { case STR_TONS: { int32 args[1]; diff --git a/table/landscape_const.h b/table/landscape_const.h index 8cf1083c0..672bafd80 100644 --- a/table/landscape_const.h +++ b/table/landscape_const.h @@ -1,6 +1,21 @@ /* $Id$ */ -static const LandscapePredefVar _landscape_predef_var[4] = { +typedef struct CargoTypesValues { + StringID names[NUM_CARGO]; + StringID units_volume[NUM_CARGO]; + byte weights[NUM_CARGO]; + SpriteID sprites[NUM_CARGO]; + + uint16 initial_cargo_payment[NUM_CARGO]; + byte transit_days_table_1[NUM_CARGO]; + byte transit_days_table_2[NUM_CARGO]; + + byte road_veh_by_cargo_start[NUM_CARGO]; + byte road_veh_by_cargo_count[NUM_CARGO]; +} CargoTypesValues; + + +static const CargoTypesValues _cargo_types_base_values[4] = { { /* normal names */ { @@ -17,6 +32,22 @@ static const LandscapePredefVar _landscape_predef_var[4] = { STR_0019_VALUABLES, STR_000E, }, + + { /* normal units of volume */ + STR_PASSENGERS, + STR_TONS, + STR_BAGS, + STR_LITERS, + STR_ITEMS, + STR_CRATES, + STR_TONS, + STR_TONS, + STR_TONS, + STR_TONS, + STR_BAGS, + STR_RES_OTHER + }, + /* normal weights */ { 1, 16, 4, 16, 3, 8, 16, 16, 16, 16, 2, 0, @@ -63,6 +94,22 @@ static const LandscapePredefVar _landscape_predef_var[4] = { STR_0020_GOLD, STR_001E_FOOD, }, + + { /* hilly units of volume */ + STR_PASSENGERS, + STR_TONS, + STR_BAGS, + STR_LITERS, + STR_ITEMS, + STR_CRATES, + STR_TONS, + STR_TONS, + STR_RES_OTHER, + STR_TONS, + STR_BAGS, + STR_TONS + }, + /* hilly weights */ { 1, 16, 4, 16, 3, 8, 16, 16, 0, 16, 8, 16 @@ -93,7 +140,6 @@ static const LandscapePredefVar _landscape_predef_var[4] = { {7, 3, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3}, }, - { /* desert names */ { @@ -110,6 +156,22 @@ static const LandscapePredefVar _landscape_predef_var[4] = { STR_001D_DIAMONDS, STR_001E_FOOD }, + + { /* desert units of volume */ + STR_PASSENGERS, + STR_LITERS, + STR_BAGS, + STR_LITERS, + STR_TONS, + STR_CRATES, + STR_TONS, + STR_TONS, + STR_TONS, + STR_LITERS, + STR_BAGS, + STR_TONS + }, + /* desert weights */ { 1, 16, 4, 16, 16, 8, 16, 16, 16, 16, 2, 16, @@ -156,6 +218,22 @@ static const LandscapePredefVar _landscape_predef_var[4] = { STR_002C_PLASTIC, STR_002D_FIZZY_DRINKS, }, + + { /* candy unitrs of volume */ + STR_PASSENGERS, + STR_TONS, + STR_BAGS, + STR_NOTHING, + STR_NOTHING, + STR_TONS, + STR_TONS, + STR_LITERS, + STR_TONS, + STR_NOTHING, + STR_LITERS, + STR_NOTHING + }, + /* candy weights */ { 1, 16, 4, 2, 4, 5, 16, 16, 16, 1, 16, 2 |