(svn r13125) -Fix [FS#2000](r12913): [autoreplace] failing replacement and restoring a vehicle will no longer decrease the vehicle count in groups
authorbjarni
Fri, 16 May 2008 21:04:49 +0000
changeset 10581 7255fef8c069
parent 10580 d605ae456266
child 10582 412f937a27d9
(svn r13125) -Fix [FS#2000](r12913): [autoreplace] failing replacement and restoring a vehicle will no longer decrease the vehicle count in groups
src/vehicle.cpp
--- a/src/vehicle.cpp	Fri May 16 20:08:20 2008 +0000
+++ b/src/vehicle.cpp	Fri May 16 21:04:49 2008 +0000
@@ -2757,7 +2757,11 @@
 		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;