Changeset - r13948:ab833d93e755
[Not reviewed]
master
0 2 0
rubidium - 15 years ago 2009-12-13 22:17:12
rubidium@openttd.org
(svn r18494) -Fix (r18474): crash when moving non-engine to new free wagon chain and group count was off when moving a front engine within the same train and the new front isn't an engine.
2 files changed with 8 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/group_cmd.cpp
Show inline comments
 
@@ -373,7 +373,7 @@ void SetTrainGroupID(Train *v, GroupID n
 
{
 
	if (!Group::IsValidID(new_g) && !IsDefaultGroupID(new_g)) return;
 

	
 
	assert(v->IsFrontEngine());
 
	assert(v->IsFrontEngine() || IsDefaultGroupID(new_g));
 

	
 
	for (Vehicle *u = v; u != NULL; u = u->Next()) {
 
		if (u->IsEngineCountable()) UpdateNumEngineGroup(u->engine_type, u->group_id, new_g);
src/train_cmd.cpp
Show inline comments
 
@@ -1441,8 +1441,13 @@ CommandCost CmdMoveRailVehicle(TileIndex
 
			/* We are going to be move to another train. So we
 
			 * are no part of this group anymore. In case we
 
			 * are not moving group... well, then we do not need
 
			 * to move. */
 
			if (dst_head != NULL && dst_head != src) DecreaseGroupNumVehicle(src->group_id);
 
			 * to move.
 
			 * Or we are moving to later in the train and our
 
			 * new head isn't a front engine anymore.
 
			 */
 
			if (dst_head != NULL ? dst_head != src : !src_head->IsFrontEngine()) {
 
				DecreaseGroupNumVehicle(src->group_id);
 
			}
 

	
 
			/* Delete orders, group stuff and the unit number as we're not the
 
			 * front of any vehicle anymore. */
0 comments (0 inline, 0 general)