# HG changeset patch # User peter1138 # Date 1149870907 0 # Node ID 5a7d98543356cccdc4ea6b9320987af7ee2ba9d9 # Parent ca5dc33ebcc8c25dc6cb3a683696497479ed9a3d (svn r5201) - NewGRF: add loading of default refit costs. This information is not yet used diff --git a/engine.h b/engine.h --- a/engine.h +++ b/engine.h @@ -75,6 +75,7 @@ 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 --- a/newgrf.c +++ b/newgrf.c @@ -406,6 +406,10 @@ 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 @@ /* 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 --- 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