summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Nelson <peter@fuzzle.org>2019-01-19 20:59:27 +0000
committerPeterN <peter@fuzzle.org>2019-01-19 23:11:17 +0000
commit4daaec1a9458b2df7215bd2b330cf0cd6797ebf3 (patch)
treeef7714064d4a59af530534280289cb882416d861 /src
parent81330b8d6edee68c38717462737fbfca6420701d (diff)
downloadopenttd-4daaec1a9458b2df7215bd2b330cf0cd6797ebf3.tar.xz
Change: Invalidate ship path caches if pathfinder choice or forbid-90-degree turns are changed.
Diffstat (limited to 'src')
-rw-r--r--src/settings.cpp9
-rw-r--r--src/table/settings.ini3
2 files changed, 12 insertions, 0 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index 3e61cc87f..ae797e09b 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1312,6 +1312,15 @@ static bool MaxVehiclesChanged(int32 p1)
return true;
}
+static bool InvalidateShipPathCache(int32 p1)
+{
+ Ship *s;
+ FOR_ALL_SHIPS(s) {
+ s->path.clear();
+ }
+ return true;
+}
+
#ifdef ENABLE_NETWORK
diff --git a/src/table/settings.ini b/src/table/settings.ini
index bb6159693..7afdd8080 100644
--- a/src/table/settings.ini
+++ b/src/table/settings.ini
@@ -42,6 +42,7 @@ static bool InvalidateCompanyInfrastructureWindow(int32 p1);
static bool InvalidateCompanyWindow(int32 p1);
static bool ZoomMinMaxChanged(int32 p1);
static bool MaxVehiclesChanged(int32 p1);
+static bool InvalidateShipPathCache(int32 p1);
#ifdef ENABLE_NETWORK
static bool UpdateClientName(int32 p1);
@@ -820,6 +821,7 @@ var = pf.forbid_90_deg
def = false
str = STR_CONFIG_SETTING_FORBID_90_DEG
strhelp = STR_CONFIG_SETTING_FORBID_90_DEG_HELPTEXT
+proc = InvalidateShipPathCache
cat = SC_EXPERT
[SDT_VAR]
@@ -942,6 +944,7 @@ interval = 1
str = STR_CONFIG_SETTING_PATHFINDER_FOR_SHIPS
strhelp = STR_CONFIG_SETTING_PATHFINDER_FOR_SHIPS_HELPTEXT
strval = STR_CONFIG_SETTING_PATHFINDER_OPF
+proc = InvalidateShipPathCache
cat = SC_EXPERT
[SDT_BOOL]