1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-28 17:09:10 +00:00

(svn r21903) -Codechange: warn only once for a train that has invalid length, not for each its wagon with invalid length

This commit is contained in:
smatz
2011-01-23 17:50:24 +00:00
parent 9a1c0f139a
commit 25a22ec255

View File

@@ -104,6 +104,7 @@ static void RailVehicleLengthChanged(const Train *u)
void CheckTrainsLengths() void CheckTrainsLengths()
{ {
const Train *v; const Train *v;
bool first = true;
FOR_ALL_TRAINS(v) { FOR_ALL_TRAINS(v) {
if (v->First() == v && !(v->vehstatus & VS_CRASHED)) { if (v->First() == v && !(v->vehstatus & VS_CRASHED)) {
@@ -116,7 +117,12 @@ void CheckTrainsLengths()
SetDParam(1, v->owner); SetDParam(1, v->owner);
ShowErrorMessage(STR_BROKEN_VEHICLE_LENGTH, INVALID_STRING_ID, WL_CRITICAL); 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;
} }
} }
} }