From 5be32627b7826a5081338dcc9d52c94511ce5b1d Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 12 Sep 2021 17:36:47 +0100 Subject: [PATCH] Fix extra aspects variable not being set for newly generated maps --- src/genworld.cpp | 2 ++ src/signal.cpp | 13 ++++++++++++- src/signal_func.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/genworld.cpp b/src/genworld.cpp index 0d6338f030..bee2d868a3 100644 --- a/src/genworld.cpp +++ b/src/genworld.cpp @@ -34,6 +34,7 @@ #include "string_func.h" #include "thread.h" #include "tgp.h" +#include "signal_func.h" #include "safeguards.h" @@ -312,6 +313,7 @@ void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_setti /* Load the right landscape stuff, and the NewGRFs! */ GfxLoadSprites(); + InitialiseExtraAspectsVariable(); LoadStringWidthTable(); /* Re-init the windowing system */ diff --git a/src/signal.cpp b/src/signal.cpp index e1efee9043..ea8be4fe7c 100644 --- a/src/signal.cpp +++ b/src/signal.cpp @@ -1467,7 +1467,7 @@ void UpdateAllSignalAspects() } } -void UpdateExtraAspectsVariable() +static uint8 DetermineExtraAspectsVariable() { uint8 new_extra_aspects = 0; @@ -1481,6 +1481,12 @@ void UpdateExtraAspectsVariable() } } + return new_extra_aspects; +} + +void UpdateExtraAspectsVariable() +{ + uint8 new_extra_aspects = DetermineExtraAspectsVariable(); if (new_extra_aspects != _extra_aspects) { _extra_aspects = new_extra_aspects; @@ -1488,3 +1494,8 @@ void UpdateExtraAspectsVariable() MarkWholeScreenDirty(); } } + +void InitialiseExtraAspectsVariable() +{ + _extra_aspects = DetermineExtraAspectsVariable(); +} diff --git a/src/signal_func.h b/src/signal_func.h index 33311c488e..a01e3f293b 100644 --- a/src/signal_func.h +++ b/src/signal_func.h @@ -176,6 +176,7 @@ void UpdateAspectDeferred(TileIndex tile, Trackdir trackdir); void FlushDeferredAspectUpdates(); void UpdateAllSignalAspects(); void UpdateExtraAspectsVariable(); +void InitialiseExtraAspectsVariable(); inline uint8 GetForwardAspectFollowingTrackAndIncrement(TileIndex tile, Trackdir trackdir) {