(svn r10368) -Fix: when renaming waypoints, ownership was only checked client-side, not in the command.
authorpeter1138
Wed, 27 Jun 2007 23:40:21 +0000
changeset 7597 73cfa9943246
parent 7596 c145bb65405e
child 7598 c12c2d7e0b55
(svn r10368) -Fix: when renaming waypoints, ownership was only checked client-side, not in the command.
src/waypoint.cpp
--- a/src/waypoint.cpp	Wed Jun 27 23:26:40 2007 +0000
+++ b/src/waypoint.cpp	Wed Jun 27 23:40:21 2007 +0000
@@ -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);