(svn r16352) -Codechange: use PoolItem::GetIfValid() instead of PoolItem::IsValidID() and PoolItem::Get()

This commit is contained in:
smatz
2009-05-18 16:21:28 +00:00
parent 5fe906e149
commit 8808f3beea
35 changed files with 201 additions and 305 deletions

View File

@@ -846,8 +846,9 @@ static char *FormatString(char *buff, const char *str, const int64 *argv, uint c
case SCC_STATION_NAME: { // {STATION}
StationID sid = GetInt32(&argv);
const Station *st = Station::GetIfValid(sid);
if (!Station::IsValidID(sid)) {
if (st == NULL) {
/* The station doesn't exist anymore. The only place where we might
* be "drawing" an invalid station is in the case of cargo that is
* in transit. */
@@ -855,7 +856,6 @@ static char *FormatString(char *buff, const char *str, const int64 *argv, uint c
break;
}
const Station *st = Station::Get(sid);
if (st->name != NULL) {
buff = strecpy(buff, st->name, last);
} else {