mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 23:50:25 +00:00
Fix: Deleting towns did not check for waypoints referencing the town
This commit is contained in:
parent
7b0afec11f
commit
8437b20fed
@ -17,6 +17,7 @@
|
||||
#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"
|
||||
@ -3040,6 +3041,11 @@ CommandCost CmdDeleteTown(DoCommandFlag flags, TownID town_id)
|
||||
}
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
Loading…
Reference in New Issue
Block a user