diff src/train_cmd.cpp @ 11351:11acaad65229 draft

(svn r15701) -Fix [FS#2595]: Blame NewGRFs returning inconsistent information in purchase-list/after building before users have a chance to blame OpenTTD for incorrectly autorenewing/-replacing.
author frosch <frosch@openttd.org>
date Fri, 13 Mar 2009 21:28:40 +0000
parents fc99317cb85b
children 82c90cd591ab
line wrap: on
line diff
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -178,23 +178,7 @@
 	uint32 grfid = engine->grffile->grfid;
 	GRFConfig *grfconfig = GetGRFConfig(grfid);
 	if (GamelogGRFBugReverse(grfid, engine->internal_id) || !HasBit(grfconfig->grf_bugs, GBUG_VEH_LENGTH)) {
-		SetBit(grfconfig->grf_bugs, GBUG_VEH_LENGTH);
-		SetDParamStr(0, grfconfig->name);
-		SetDParam(1, u->engine_type);
-		ShowErrorMessage(STR_NEWGRF_BROKEN_VEHICLE_LENGTH, STR_NEWGRF_BROKEN, 0, 0);
-
-		/* debug output */
-		char buffer[512];
-
-		SetDParamStr(0, grfconfig->name);
-		GetString(buffer, STR_NEWGRF_BROKEN, lastof(buffer));
-		DEBUG(grf, 0, "%s", buffer + 3);
-
-		SetDParam(1, u->engine_type);
-		GetString(buffer, STR_NEWGRF_BROKEN_VEHICLE_LENGTH, lastof(buffer));
-		DEBUG(grf, 0, "%s", buffer + 3);
-
-		if (!_networking) _pause_game = -1;
+		ShowNewGrfVehicleError(u->engine_type, STR_NEWGRF_BROKEN, STR_NEWGRF_BROKEN_VEHICLE_LENGTH, GBUG_VEH_LENGTH, true);
 	}
 }
 
@@ -678,6 +662,8 @@
 			InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Train window
 		}
 		GetCompany(_current_company)->num_engines[engine]++;
+
+		CheckConsistencyOfArticulatedVehicle(v);
 	}
 
 	return value;
@@ -857,6 +843,8 @@
 		}
 
 		GetCompany(_current_company)->num_engines[p1]++;
+
+		CheckConsistencyOfArticulatedVehicle(v);
 	}
 
 	return value;