summaryrefslogtreecommitdiff
path: root/src/waypoint_cmd.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/waypoint_cmd.cpp
parent5fe906e14992f7a301ae94c357e80af076ab7a63 (diff)
downloadopenttd-8808f3beea881af5652716c883a21c8031b5e390.tar.xz
(svn r16352) -Codechange: use PoolItem::GetIfValid() instead of PoolItem::IsValidID() and PoolItem::Get()
Diffstat (limited to 'src/waypoint_cmd.cpp')
-rw-r--r--src/waypoint_cmd.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp
index 301835361..468d216cb 100644
--- a/src/waypoint_cmd.cpp
+++ b/src/waypoint_cmd.cpp
@@ -314,10 +314,8 @@ static bool IsUniqueWaypointName(const char *name)
*/
CommandCost CmdRenameWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
- if (!Waypoint::IsValidID(p1)) return CMD_ERROR;
-
- Waypoint *wp = Waypoint::Get(p1);
- if (!CheckOwnership(wp->owner)) return CMD_ERROR;
+ Waypoint *wp = Waypoint::GetIfValid(p1);
+ if (wp == NULL || !CheckOwnership(wp->owner)) return CMD_ERROR;
bool reset = StrEmpty(text);