mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 07:29:44 +00:00
(svn r10470) -Fix: clamp station build date to 16 bit value for newgrf, preventing overflow and incorrect graphics shown past a certain date.
This commit is contained in:
parent
576128159a
commit
0543657b75
@ -378,7 +378,7 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
|
|||||||
case 0x42: return 0; // Rail type (XXX Get current type from GUI?)
|
case 0x42: return 0; // Rail type (XXX Get current type from GUI?)
|
||||||
case 0x43: return _current_player; // Station owner
|
case 0x43: return _current_player; // Station owner
|
||||||
case 0x44: return 2; // PBS status
|
case 0x44: return 2; // PBS status
|
||||||
case 0xFA: return max(_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0); // Build date
|
case 0xFA: return clamp(_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0, 65535); // Build date, clamped to a 16 bit value
|
||||||
}
|
}
|
||||||
|
|
||||||
*available = false;
|
*available = false;
|
||||||
@ -420,7 +420,7 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
|
|||||||
case 0xF3: return st->bus_stops->status;
|
case 0xF3: return st->bus_stops->status;
|
||||||
case 0xF6: return st->airport_flags;
|
case 0xF6: return st->airport_flags;
|
||||||
case 0xF7: return GB(st->airport_flags, 8, 8);
|
case 0xF7: return GB(st->airport_flags, 8, 8);
|
||||||
case 0xFA: return max(st->build_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0);
|
case 0xFA: return clamp(st->build_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0, 65535);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle cargo variables with parameter, 0x60 to 0x65 */
|
/* Handle cargo variables with parameter, 0x60 to 0x65 */
|
||||||
|
Loading…
Reference in New Issue
Block a user