summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-09-19 19:23:23 +0000
committerfrosch <frosch@openttd.org>2011-09-19 19:23:23 +0000
commit2188383658bc980882578fddb23249775ac024aa (patch)
tree71ce7b2352aa9054830977d8dccfea2e5c48ec31 /src/vehicle.cpp
parent427dd736ae2bc3f2ae0ea07c1b50fd7252883e05 (diff)
downloadopenttd-2188383658bc980882578fddb23249775ac024aa.tar.xz
(svn r22947) -Fix: [NewGRF] Do not call CB 32 for disaster, effect vehicles or aircraft shadows/rotors.
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 890ecf6bc..e9177f092 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -632,6 +632,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
* event to the AIs and a news message to the user. If the
@@ -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