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) {
|
||||
uint8 prop = grf_load_byte(&buf);
|
||||
bool ignoring = false;
|
||||
|
||||
if (feature == GSF_STATION)
|
||||
// stations don't share those common properties
|
||||
goto run_handler;
|
||||
|
||||
switch (feature) {
|
||||
case GSF_TRAIN:
|
||||
case GSF_ROAD:
|
||||
case GSF_SHIP:
|
||||
case GSF_AIRCRAFT:
|
||||
/* Common properties for vehicles */
|
||||
switch (prop) {
|
||||
case 0x00: { /* Introduction date */
|
||||
FOR_EACH_OBJECT {
|
||||
|
@ -1106,17 +1109,25 @@ static void VehicleChangeInfo(byte *buf, int len)
|
|||
FOR_EACH_OBJECT {
|
||||
grf_load_byte(&buf);
|
||||
}
|
||||
goto ignoring;
|
||||
}
|
||||
default: {
|
||||
run_handler:
|
||||
if (handler[feature](engine, numinfo, prop, &buf, bufend - buf)) {
|
||||
ignoring:
|
||||
grfmsg(GMS_NOTICE, "VehicleChangeInfo: Ignoring property %x (not implemented).", prop);
|
||||
}
|
||||
ignoring = true;
|
||||
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