summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-03-13 21:28:40 +0000
committerfrosch <frosch@openttd.org>2009-03-13 21:28:40 +0000
commit4129b418ccab3ed2bc6b7ab196e99d401ca67599 (patch)
tree8317c89e21d332e45318d53d44851fe0a13c0a4a /src/train_cmd.cpp
parente6353a1a221bee43d2f04b060f62d3ea41633483 (diff)
downloadopenttd-4129b418ccab3ed2bc6b7ab196e99d401ca67599.tar.xz
(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.
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 8cccb6763..eede8507d 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -178,23 +178,7 @@ static void RailVehicleLengthChanged(const Vehicle *u)
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 @@ static CommandCost CmdBuildRailWagon(EngineID engine, TileIndex tile, DoCommandF
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 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1,
}
GetCompany(_current_company)->num_engines[p1]++;
+
+ CheckConsistencyOfArticulatedVehicle(v);
}
return value;