1
0
Fork 0

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

release/1.1
smatz 2011-01-23 17:50:24 +00:00
parent 9a1c0f139a
commit 25a22ec255
1 changed files with 7 additions and 1 deletions

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;
} }
} }
} }