diff options
author | frosch <frosch@openttd.org> | 2011-11-01 00:26:22 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2011-11-01 00:26:22 +0000 |
commit | be5fffd133b1865586754cfe2b29d0bfb0dba4c9 (patch) | |
tree | a84218a842c0b04e895c9449f71ec255fd0002ef /src | |
parent | acc3c75951c4db0873db794b657697774f0ff9e9 (diff) | |
download | openttd-be5fffd133b1865586754cfe2b29d0bfb0dba4c9.tar.xz |
(svn r23076) -Codechange: Separate code for NewGRF and default refit masks more strictly.
Diffstat (limited to 'src')
-rw-r--r-- | src/newgrf.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index a7982be35..7655d0bad 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -7948,12 +7948,13 @@ static void CalculateRefitMasks() FOR_ALL_ENGINES(e) { EngineID engine = e->index; EngineInfo *ei = &e->info; - uint32 mask = 0; - uint32 not_mask = 0; - uint32 xor_mask = 0; /* Did the newgrf specify any refitting? If not, use defaults. */ if (_gted[engine].refitmask_valid) { + uint32 mask = 0; + uint32 not_mask = 0; + uint32 xor_mask = 0; + if (ei->refit_mask != 0) { const GRFFile *file = _gted[engine].refitmask_grf; if (file == NULL) file = e->GetGRF(); @@ -7985,7 +7986,11 @@ static void CalculateRefitMasks() if (_gted[engine].cargo_disallowed & cs->classes) SetBit(not_mask, cs->Index()); } } + + ei->refit_mask = ((mask & ~not_mask) ^ xor_mask) & _cargo_mask; } else { + uint32 xor_mask = 0; + /* Don't apply default refit mask to wagons nor engines with no capacity */ if (e->type != VEH_TRAIN || (e->u.rail.capacity != 0 && e->u.rail.railveh_type != RAILVEH_WAGON)) { const CargoLabel *cl = _default_refitmasks[e->type]; @@ -7998,9 +8003,9 @@ static void CalculateRefitMasks() SetBit(xor_mask, cargo); } } - } - ei->refit_mask = ((mask & ~not_mask) ^ xor_mask) & _cargo_mask; + ei->refit_mask = xor_mask & _cargo_mask; + } /* Check if this engine's cargo type is valid. If not, set to the first refittable * cargo type. Finally disable the vehicle, if there is still no cargo. */ |