(svn r4960) - NewGRF: explicitly handle unsupported variables, instead of returning -1.

This commit is contained in:
peter1138
2006-05-23 19:36:50 +00:00
parent f6c5b3e78a
commit ae8f4f8d9a
4 changed files with 34 additions and 26 deletions

View File

@@ -309,7 +309,7 @@ static void StationSetTriggers(const ResolverObject *object, int triggers)
}
static uint32 StationGetVariable(const ResolverObject *object, byte variable, byte parameter)
static uint32 StationGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available)
{
const Station *st = object->u.station.st;
TileIndex tile = object->u.station.tile;
@@ -326,8 +326,10 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
case 0x43: return _current_player; /* Station owner */
case 0x44: return 2; /* PBS status */
case 0xFA: return _date; /* Build date */
default: return -1;
}
*available = false;
return -1;
}
switch (variable) {
@@ -390,6 +392,7 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
DEBUG(grf, 1)("Unhandled station property 0x%X", variable);
*available = false;
return -1;
}