1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-24 12:44:10 +01:00

(svn r22993) [1.1] -Backport from trunk:

- Fix: The savegame description and loading of savegames would crash with savegames from a patched stable (which did not bump the savegame version) [FS#4778] (r22958, r22957)
- Fix: Guard from reading outside the silly name list (r22955)
- Fix: [NewGRF] Properly limit the length of strings in a choice list (r22952)
- Fix: [NewGRF] Do not call CB 32 for disaster, effect vehicles or aircraft shadows/rotors (r22947)
This commit is contained in:
rubidium
2011-10-04 20:15:50 +00:00
parent 997a4aee46
commit 3daf4d012b
9 changed files with 40 additions and 17 deletions

View File

@@ -634,6 +634,21 @@ bool Vehicle::IsEngineCountable() const
}
}
/**
* Check whether Vehicle::engine_type has any meaning.
* @return true if the vehicle has a useable engine type.
*/
bool Vehicle::HasEngineType() const
{
switch (this->type) {
case VEH_AIRCRAFT: return Aircraft::From(this)->IsNormalAircraft();
case VEH_TRAIN:
case VEH_ROAD:
case VEH_SHIP: return true;
default: return false;
}
}
/**
* Handle the pathfinding result, especially the lost status.
* If the vehicle is now lost and wasn't previously fire an
@@ -784,7 +799,7 @@ static void RunVehicleDayProc()
if (v == NULL) continue;
/* Call the 32-day callback if needed */
if ((v->day_counter & 0x1F) == 0) {
if ((v->day_counter & 0x1F) == 0 && v->HasEngineType()) {
uint16 callback = GetVehicleCallback(CBID_VEHICLE_32DAY_CALLBACK, 0, 0, v->engine_type, v);
if (callback != CALLBACK_FAILED) {
if (HasBit(callback, 0)) TriggerVehicle(v, VEHICLE_TRIGGER_CALLBACK_32); // Trigger vehicle trigger 10