From 47ff6a87a3c54b55722d114eba6a699da3fb329e Mon Sep 17 00:00:00 2001 From: Kindi <2538602-Kuyondo@users.noreply.gitlab.com> Date: Fri, 3 Dec 2021 16:05:18 +0000 Subject: [PATCH] Raise a warning when entering non-existent region --- CHANGELOG.md | 1 + apps/openmw/mwscript/skyextensions.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 778df6e680..0d85fbc865 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,7 @@ Bug #6343: Magic projectile speed doesn't take race weight into account Bug #6347: PlaceItem/PlaceItemCell/PlaceAt should work with levelled creatures Bug #6354: SFX abruptly cut off after crossing max distance; implement soft fading of sound effects + Bug #6358: Changeweather command does not report an error when entering non-existent region Bug #6363: Some scripts in Morrowland fail to work Bug #6376: Creatures should be able to use torches Bug #6386: Artifacts in water reflection due to imprecise screen-space coordinate computation diff --git a/apps/openmw/mwscript/skyextensions.cpp b/apps/openmw/mwscript/skyextensions.cpp index 4f4891b424..81984ad7b7 100644 --- a/apps/openmw/mwscript/skyextensions.cpp +++ b/apps/openmw/mwscript/skyextensions.cpp @@ -11,6 +11,8 @@ #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" +#include "../mwworld/esmstore.hpp" + #include "interpretercontext.hpp" namespace MWScript @@ -91,7 +93,11 @@ namespace MWScript Interpreter::Type_Integer id = runtime[0].mInteger; runtime.pop(); - MWBase::Environment::get().getWorld()->changeWeather(region, id); + const ESM::Region* reg = MWBase::Environment::get().getWorld()->getStore().get().search(region); + if (reg) + MWBase::Environment::get().getWorld()->changeWeather(region, id); + else + runtime.getContext().report("Warning: Region \"" + region + "\" was not found"); } };