diff options
author | smatz <smatz@openttd.org> | 2011-01-23 17:50:24 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2011-01-23 17:50:24 +0000 |
commit | 25a22ec255289ed3dcc6f8f615924657faaa2027 (patch) | |
tree | 7cc41ed1688497915560749832bc5208902a0580 | |
parent | 9a1c0f139aeafd3ff550d0689e3a4c227927f0e5 (diff) | |
download | openttd-25a22ec255289ed3dcc6f8f615924657faaa2027.tar.xz |
(svn r21903) -Codechange: warn only once for a train that has invalid length, not for each its wagon with invalid length
-rw-r--r-- | src/train_cmd.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 108e75597..ccc644666 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -104,6 +104,7 @@ static void RailVehicleLengthChanged(const Train *u) void CheckTrainsLengths() { const Train *v; + bool first = true; FOR_ALL_TRAINS(v) { if (v->First() == v && !(v->vehstatus & VS_CRASHED)) { @@ -116,7 +117,12 @@ void CheckTrainsLengths() SetDParam(1, v->owner); ShowErrorMessage(STR_BROKEN_VEHICLE_LENGTH, INVALID_STRING_ID, WL_CRITICAL); - if (!_networking) DoCommandP(0, PM_PAUSED_ERROR, 1, CMD_PAUSE); + if (!_networking && first) { + first = false; + DoCommandP(0, PM_PAUSED_ERROR, 1, CMD_PAUSE); + } + /* Break so we warn only once for each train. */ + break; } } } |