summaryrefslogtreecommitdiff
path: root/src/waypoint.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-09-14 15:48:49 +0000
committersmatz <smatz@openttd.org>2008-09-14 15:48:49 +0000
commitc5960b4be1608be0e502dfeb35ef9cee3a08253a (patch)
tree8be3655fafd3b59264bb83873abeda0f3d0d9e2e /src/waypoint.cpp
parent6ce4fe40f7b17dcd7a76f0b2a88038726934cd71 (diff)
downloadopenttd-c5960b4be1608be0e502dfeb35ef9cee3a08253a.tar.xz
(svn r14322) -Fix (r10368): possible assert when renaming removed waypoint
Diffstat (limited to 'src/waypoint.cpp')
-rw-r--r--src/waypoint.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/waypoint.cpp b/src/waypoint.cpp
index e36668db6..cc7415367 100644
--- a/src/waypoint.cpp
+++ b/src/waypoint.cpp
@@ -381,12 +381,10 @@ static bool IsUniqueWaypointName(const char *name)
*/
CommandCost CmdRenameWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- Waypoint *wp;
-
if (!IsValidWaypointID(p1)) return CMD_ERROR;
- wp = GetWaypoint(p1);
- if (!CheckTileOwnership(wp->xy)) return CMD_ERROR;
+ Waypoint *wp = GetWaypoint(p1);
+ if (!CheckOwnership(wp->owner)) return CMD_ERROR;
if (!StrEmpty(_cmd_text)) {
if (strlen(_cmd_text) >= MAX_LENGTH_WAYPOINT_NAME_BYTES) return CMD_ERROR;