Changeset - r28204:545150246005
[Not reviewed]
master
0 1 0
Jonathan G Rennison - 7 months ago 2023-11-28 21:59:00
j.g.rennison@gmail.com
Fix: Deleting towns did not check for waypoints referencing the town
1 file changed with 6 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/town_cmd.cpp
Show inline comments
 
@@ -14,12 +14,13 @@
 
#include "landscape.h"
 
#include "viewport_func.h"
 
#include "viewport_kdtree.h"
 
#include "command_func.h"
 
#include "industry.h"
 
#include "station_base.h"
 
#include "waypoint_base.h"
 
#include "station_kdtree.h"
 
#include "company_base.h"
 
#include "news_func.h"
 
#include "error.h"
 
#include "object.h"
 
#include "genworld.h"
 
@@ -3037,12 +3038,17 @@ CommandCost CmdDeleteTown(DoCommandFlag 
 
			/* We can only automatically delete oil rigs *if* there's no vehicle on them. */
 
			CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, st->airport.tile);
 
			if (ret.Failed()) return ret;
 
		}
 
	}
 

	
 
	/* Waypoints refer to towns. */
 
	for (const Waypoint *wp : Waypoint::Iterate()) {
 
		if (wp->town == t) return CMD_ERROR;
 
	}
 

	
 
	/* Depots refer to towns. */
 
	for (const Depot *d : Depot::Iterate()) {
 
		if (d->town == t) return CMD_ERROR;
 
	}
 

	
 
	/* Check all tiles for town ownership. First check for bridge tiles, as
0 comments (0 inline, 0 general)