changeset 7101:488bb393b04d draft

(svn r10368) -Fix: when renaming waypoints, ownership was only checked client-side, not in the command.
author peter1138 <peter1138@openttd.org>
date Wed, 27 Jun 2007 23:40:21 +0000
parents 3b7f7bb62dfc
children 5e6f06e130c3
files src/waypoint.cpp
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/waypoint.cpp
+++ b/src/waypoint.cpp
@@ -371,6 +371,9 @@
 
 	if (!IsValidWaypointID(p1)) return CMD_ERROR;
 
+	wp = GetWaypoint(p1);
+	if (!CheckTileOwnership(wp->xy)) return CMD_ERROR;
+
 	if (!StrEmpty(_cmd_text)) {
 		if (!IsUniqueWaypointName(_cmd_text)) return_cmd_error(STR_NAME_MUST_BE_UNIQUE);
 
@@ -379,7 +382,6 @@
 		if (str == 0) return CMD_ERROR;
 
 		if (flags & DC_EXEC) {
-			wp = GetWaypoint(p1);
 			if (wp->string != STR_NULL) DeleteName(wp->string);
 
 			wp->string = str;
@@ -392,7 +394,6 @@
 		}
 	} else {
 		if (flags & DC_EXEC) {
-			wp = GetWaypoint(p1);
 			if (wp->string != STR_NULL) DeleteName(wp->string);
 
 			MakeDefaultWaypointName(wp);