summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2008-05-16 21:04:49 +0000
committerbjarni <bjarni@openttd.org>2008-05-16 21:04:49 +0000
commit5469686001aa00ab071afa62ba1a857b03d34a59 (patch)
tree7fdb8d02d2b1831b738b1547d2af321f91252932 /src
parentced7ee3043dceb421840746f676628afbdad71ef (diff)
downloadopenttd-5469686001aa00ab071afa62ba1a857b03d34a59.tar.xz
(svn r13125) -Fix [FS#2000](r12913): [autoreplace] failing replacement and restoring a vehicle will no longer decrease the vehicle count in groups
Diffstat (limited to 'src')
-rw-r--r--src/vehicle.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 93a6ef5b5..b559a8fc7 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -2757,7 +2757,11 @@ Vehicle* BackuppedVehicle::RestoreBackupVehicle(Vehicle *v, Player *p)
memcpy(dest, backup, sizeof(Vehicle));
/* We decreased the engine count when we sold the engines so we will increase it again. */
- if (IsEngineCountable(backup)) p->num_engines[backup->engine_type]++;
+ if (IsEngineCountable(backup)) {
+ p->num_engines[backup->engine_type]++;
+ if (IsValidGroupID(backup->group_id)) GetGroup(backup->group_id)->num_engines[backup->engine_type]++;
+ if (backup->IsPrimaryVehicle()) IncreaseGroupNumVehicle(backup->group_id);
+ }
/* Update hash. */
Vehicle *dummy = dest;