summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-06-09 16:35:07 +0000
committerpeter1138 <peter1138@openttd.org>2006-06-09 16:35:07 +0000
commitdfa60b08327d2689641696d44319771c19343249 (patch)
tree84c58a3de0a48d2647e22cdeb29951db60bee62e
parent901e2d02b1dd5664a9580f503674516feb910f83 (diff)
downloadopenttd-dfa60b08327d2689641696d44319771c19343249.tar.xz
(svn r5201) - NewGRF: add loading of default refit costs. This information is not yet used
-rw-r--r--engine.h1
-rw-r--r--newgrf.c20
-rw-r--r--table/engines.h4
3 files changed, 19 insertions, 6 deletions
diff --git a/engine.h b/engine.h
index 88429b2ab..465011f2c 100644
--- a/engine.h
+++ b/engine.h
@@ -75,6 +75,7 @@ typedef struct EngineInfo {
byte railtype:4;
byte climates:4;
uint32 refit_mask;
+ byte refit_cost;
byte misc_flags;
byte callbackmask;
} EngineInfo;
diff --git a/newgrf.c b/newgrf.c
index 7b1e84e95..01c432787 100644
--- a/newgrf.c
+++ b/newgrf.c
@@ -406,6 +406,10 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
FOR_EACH_OBJECT rvi[i].pow_wag_power = grf_load_word(&buf);
break;
+ case 0x1C: /* Refit cost */
+ FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf);
+ break;
+
case 0x1D: /* Refit cargo */
FOR_EACH_OBJECT ei[i].refit_mask = grf_load_dword(&buf);
break;
@@ -457,7 +461,6 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
/* TODO */
/* Fall-through for unimplemented one byte long properties. */
- case 0x1C: /* Refit cost */
case 0x1F: /* Tractive effort */
case 0x20: /* Air drag */
case 0x26: /* Retire vehicle early */
@@ -552,6 +555,10 @@ static bool RoadVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
FOR_EACH_OBJECT ei[i].callbackmask = grf_load_byte(&buf);
break;
+ case 0x1A: /* Refit cost */
+ FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf);
+ break;
+
case 0x1C: /* Miscellaneous flags */
FOR_EACH_OBJECT ei[i].misc_flags = grf_load_byte(&buf);
break;
@@ -566,7 +573,6 @@ static bool RoadVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
case 0x18: /* Tractive effort */
case 0x19: /* Air drag */
- case 0x1A: /* Refit cost */
case 0x1B: /* Retire vehicle early */
/* TODO */
FOR_EACH_OBJECT grf_load_byte(&buf);
@@ -656,6 +662,10 @@ static bool ShipVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
FOR_EACH_OBJECT ei[i].callbackmask = grf_load_byte(&buf);
break;
+ case 0x13: /* Refit cost */
+ FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf);
+ break;
+
case 0x17: /* Miscellaneous flags */
FOR_EACH_OBJECT ei[i].misc_flags = grf_load_byte(&buf);
break;
@@ -668,7 +678,6 @@ static bool ShipVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
FOR_EACH_OBJECT cargo_disallowed[SHIP_ENGINES_INDEX + engine + i] = grf_load_word(&buf);
break;
- case 0x13: /* Refit cost */
case 0x14: /* Ocean speed fraction */
case 0x15: /* Canal speed fraction */
case 0x16: /* Retire vehicle early */
@@ -753,6 +762,10 @@ static bool AircraftVehicleChangeInfo(uint engine, int numinfo, int prop, byte *
FOR_EACH_OBJECT ei[i].callbackmask = grf_load_byte(&buf);
break;
+ case 0x15: /* Refit cost */
+ FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf);
+ break;
+
case 0x17: /* Miscellaneous flags */
FOR_EACH_OBJECT ei[i].misc_flags = grf_load_byte(&buf);
break;
@@ -765,7 +778,6 @@ static bool AircraftVehicleChangeInfo(uint engine, int numinfo, int prop, byte *
FOR_EACH_OBJECT cargo_disallowed[AIRCRAFT_ENGINES_INDEX + engine + i] = grf_load_word(&buf);
break;
- case 0x15: /* Refit cost */
case 0x16: /* Retire vehicle early */
/* TODO */
FOR_EACH_OBJECT grf_load_byte(&buf);
diff --git a/table/engines.h b/table/engines.h
index 6d2487d5c..efa2b5836 100644
--- a/table/engines.h
+++ b/table/engines.h
@@ -15,7 +15,7 @@
* @param e Rail Type of the vehicle
* @param f Bitmask of the climates
*/
-#define MK(a, b, c, d, e, f) { a, b, c, d, e, f, 0, 0, 0 }
+#define MK(a, b, c, d, e, f) { a, b, c, d, e, f, 0, 0, 0, 0 }
/** Writes the properties of a train carriage into the EngineInfo struct.
* @see EngineInfo
* @param a Introduction date
@@ -23,7 +23,7 @@
* @param f Bitmask of the climates
* @note the 0x80 in parameter b sets the "is carriage bit"
*/
-#define MW(a, b, c, d, e, f) { a, b | 0x80, c, d, e, f, 0, 0, 0 }
+#define MW(a, b, c, d, e, f) { a, b | 0x80, c, d, e, f, 0, 0, 0, 0 }
// Rail types
// R = Conventional railway