(svn r4513) Codechange : Assemble a bit the scattered parts of Cargo types.
authorbelugas
Sat, 22 Apr 2006 01:37:31 +0000
changeset 3616 7ba7353d6561
parent 3615 59b36aaa050a
child 3617 adb048cba867
(svn r4513) Codechange : Assemble a bit the scattered parts of Cargo types.
misc.c
strings.c
table/landscape_const.h
--- a/misc.c	Sat Apr 22 00:10:38 2006 +0000
+++ b/misc.c	Sat Apr 22 01:37:31 2006 +0000
@@ -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 @@
 	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));
--- a/strings.c	Sat Apr 22 00:10:38 2006 +0000
+++ b/strings.c	Sat Apr 22 01:37:31 2006 +0000
@@ -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 @@
 				// 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];
--- a/table/landscape_const.h	Sat Apr 22 00:10:38 2006 +0000
+++ b/table/landscape_const.h	Sat Apr 22 01:37:31 2006 +0000
@@ -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 @@
 			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 @@
 			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 @@
 		{7, 3, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3},
 	},
 
-
 	{
 		/* desert names */
 		{
@@ -110,6 +156,22 @@
 			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 @@
 			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