Changeset - r18140:559810a8b286
[Not reviewed]
master
0 2 0
frosch - 13 years ago 2011-10-03 17:19:54
frosch@openttd.org
(svn r22975) -Codechange: Do not store Group::num_vehicle in the savegame, but compute it like num_engines on load.
2 files changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/engine.cpp
Show inline comments
 
@@ -477,6 +477,7 @@ void SetCachedEngineCounts()
 
	/* Recalculate */
 
	Group *g;
 
	FOR_ALL_GROUPS(g) {
 
		g->num_vehicle = 0;
 
		free(g->num_engines);
 
		g->num_engines = CallocT<EngineID>(engines);
 
	}
 
@@ -496,6 +497,7 @@ void SetCachedEngineCounts()
 
		assert(v->owner == g->owner);
 

	
 
		g->num_engines[v->engine_type]++;
 
		if (v->IsPrimaryVehicle()) g->num_vehicle++;
 
	}
 
}
 

	
src/saveload/group_sl.cpp
Show inline comments
 
@@ -17,7 +17,7 @@
 
static const SaveLoad _group_desc[] = {
 
  SLE_CONDVAR(Group, name,           SLE_NAME,    0, 83),
 
  SLE_CONDSTR(Group, name,           SLE_STR, 0, 84, SL_MAX_VERSION),
 
  SLE_VAR(Group, num_vehicle,        SLE_UINT16),
 
  SLE_CONDNULL(2,                                 0, 163), // num_vehicle
 
  SLE_VAR(Group, owner,              SLE_UINT8),
 
  SLE_VAR(Group, vehicle_type,       SLE_UINT8),
 
  SLE_VAR(Group, replace_protection, SLE_BOOL),
0 comments (0 inline, 0 general)