From e987fe85d03011a0fb68b811fe211a39c9eb2078 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 14 Mar 2017 21:25:53 +0100 Subject: [PATCH] Add abort flag to TerrainPreloadItem --- apps/openmw/mwworld/cellpreloader.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwworld/cellpreloader.cpp b/apps/openmw/mwworld/cellpreloader.cpp index 9e9c85320..700b91b37 100644 --- a/apps/openmw/mwworld/cellpreloader.cpp +++ b/apps/openmw/mwworld/cellpreloader.cpp @@ -7,16 +7,16 @@ #include #include #include +#include #include #include #include #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" -#include "../mwworld/inventorystore.hpp" -#include "../mwworld/esmstore.hpp" #include "../mwrender/landmanager.hpp" #include "cellstore.hpp" @@ -205,6 +205,7 @@ namespace MWWorld { if (mTerrainPreloadItem) { + mTerrainPreloadItem->abort(); mTerrainPreloadItem->waitTillDone(); mTerrainPreloadItem = NULL; } @@ -370,7 +371,8 @@ namespace MWWorld { public: TerrainPreloadItem(const std::vector >& views, Terrain::World* world, const std::vector& preloadPositions) - : mTerrainViews(views) + : mAbort(false) + , mTerrainViews(views) , mWorld(world) , mPreloadPositions(preloadPositions) { @@ -378,14 +380,20 @@ namespace MWWorld virtual void doWork() { - for (unsigned int i=0; ipreload(mTerrainViews[i], mPreloadPositions[i]); mTerrainViews[i]->reset(0); } } + virtual void abort() + { + mAbort = true; + } + private: + volatile bool mAbort; std::vector > mTerrainViews; Terrain::World* mWorld; std::vector mPreloadPositions;