mirror of https://github.com/OpenTTD/OpenTTD
(svn r2947) Reorder some code to prepare for future enhancements and get rid of some gotos (peter1138)
parent
b84e36d717
commit
42813c5426
35
newgrf.c
35
newgrf.c
|
@ -1053,11 +1053,14 @@ static void VehicleChangeInfo(byte *buf, int len)
|
||||||
|
|
||||||
while (numprops-- && buf < bufend) {
|
while (numprops-- && buf < bufend) {
|
||||||
uint8 prop = grf_load_byte(&buf);
|
uint8 prop = grf_load_byte(&buf);
|
||||||
|
bool ignoring = false;
|
||||||
|
|
||||||
if (feature == GSF_STATION)
|
switch (feature) {
|
||||||
// stations don't share those common properties
|
case GSF_TRAIN:
|
||||||
goto run_handler;
|
case GSF_ROAD:
|
||||||
|
case GSF_SHIP:
|
||||||
|
case GSF_AIRCRAFT:
|
||||||
|
/* Common properties for vehicles */
|
||||||
switch (prop) {
|
switch (prop) {
|
||||||
case 0x00: { /* Introduction date */
|
case 0x00: { /* Introduction date */
|
||||||
FOR_EACH_OBJECT {
|
FOR_EACH_OBJECT {
|
||||||
|
@ -1106,17 +1109,25 @@ static void VehicleChangeInfo(byte *buf, int len)
|
||||||
FOR_EACH_OBJECT {
|
FOR_EACH_OBJECT {
|
||||||
grf_load_byte(&buf);
|
grf_load_byte(&buf);
|
||||||
}
|
}
|
||||||
goto ignoring;
|
ignoring = true;
|
||||||
}
|
|
||||||
default: {
|
|
||||||
run_handler:
|
|
||||||
if (handler[feature](engine, numinfo, prop, &buf, bufend - buf)) {
|
|
||||||
ignoring:
|
|
||||||
grfmsg(GMS_NOTICE, "VehicleChangeInfo: Ignoring property %x (not implemented).", prop);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (handler[feature](engine, numinfo, prop, &buf, bufend - buf))
|
||||||
|
ignoring = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (handler[feature](engine, numinfo, prop, &buf, bufend - buf))
|
||||||
|
ignoring = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ignoring)
|
||||||
|
grfmsg(GMS_NOTICE, "VehicleChangeInfo: Ignoring property %x (not implemented).", prop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue