summaryrefslogtreecommitdiff
path: root/src/strings.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-05-18 16:21:28 +0000
committersmatz <smatz@openttd.org>2009-05-18 16:21:28 +0000
commit8808f3beea881af5652716c883a21c8031b5e390 (patch)
treebc14c65d1e66c407b72d254fc926d105eea2f1e4 /src/strings.cpp
parent5fe906e14992f7a301ae94c357e80af076ab7a63 (diff)
downloadopenttd-8808f3beea881af5652716c883a21c8031b5e390.tar.xz
(svn r16352) -Codechange: use PoolItem::GetIfValid() instead of PoolItem::IsValidID() and PoolItem::Get()
Diffstat (limited to 'src/strings.cpp')
-rw-r--r--src/strings.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/strings.cpp b/src/strings.cpp
index 00aee98a2..2e04113b5 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -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 {