mirror of https://github.com/OpenTTD/OpenTTD
Fix: NewGRF Global variables 0D, 0E and 1E refer to wrong GRFFile.
These variables used GrfProcessingState, which is only valid while loading GRFs, after which they always point to the last loaded GRFFile.pull/13986/head
parent
936d78fefc
commit
ea272261f7
|
@ -458,11 +458,11 @@ bool GetGlobalVariable(uint8_t param, uint32_t *value, const GRFFile *grffile)
|
|||
}
|
||||
|
||||
case 0x0D: // TTD Version, 00=DOS, 01=Windows
|
||||
*value = _cur.grfconfig->palette & GRFP_USE_MASK;
|
||||
*value = GetGRFConfig(grffile->grfid)->palette & GRFP_USE_MASK;
|
||||
return true;
|
||||
|
||||
case 0x0E: // Y-offset for train sprites
|
||||
*value = _cur.grffile->traininfo_vehicle_pitch;
|
||||
*value = grffile->traininfo_vehicle_pitch;
|
||||
return true;
|
||||
|
||||
case 0x0F: // Rail track type cost factors
|
||||
|
@ -509,7 +509,7 @@ bool GetGlobalVariable(uint8_t param, uint32_t *value, const GRFFile *grffile)
|
|||
|
||||
/* Add the local flags */
|
||||
assert(!bits.Test(GrfMiscBit::TrainWidth32Pixels));
|
||||
if (_cur.grffile->traininfo_vehicle_width == VEHICLEINFO_FULL_VEHICLE_WIDTH) bits.Set(GrfMiscBit::TrainWidth32Pixels);
|
||||
if (grffile->traininfo_vehicle_width == VEHICLEINFO_FULL_VEHICLE_WIDTH) bits.Set(GrfMiscBit::TrainWidth32Pixels);
|
||||
|
||||
*value = bits.base();
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue