Throw exception when told to use 0 threads

pull/140/head
scrawl 8 years ago
parent 209f271f5f
commit 884d306bf3

@ -158,7 +158,6 @@ namespace MWRender
: mViewer(viewer) : mViewer(viewer)
, mRootNode(rootNode) , mRootNode(rootNode)
, mResourceSystem(resourceSystem) , mResourceSystem(resourceSystem)
, mWorkQueue(new SceneUtil::WorkQueue(Settings::Manager::getInt("preload num threads", "Cells")))
, mUnrefQueue(new SceneUtil::UnrefQueue) , mUnrefQueue(new SceneUtil::UnrefQueue)
, mFogDepth(0.f) , mFogDepth(0.f)
, mUnderwaterColor(fallback->getFallbackColour("Water_UnderwaterColor")) , mUnderwaterColor(fallback->getFallbackColour("Water_UnderwaterColor"))
@ -169,6 +168,11 @@ namespace MWRender
, mFieldOfViewOverride(0.f) , mFieldOfViewOverride(0.f)
, mFieldOfViewOverridden(false) , mFieldOfViewOverridden(false)
{ {
int numThreads = Settings::Manager::getInt("preload num threads", "Cells");
if (numThreads <= 0)
throw std::runtime_error("Invalid setting: 'preload num threads' must be >0");
mWorkQueue = new SceneUtil::WorkQueue(numThreads);
resourceSystem->getSceneManager()->setParticleSystemMask(MWRender::Mask_ParticleSystem); resourceSystem->getSceneManager()->setParticleSystemMask(MWRender::Mask_ParticleSystem);
resourceSystem->getSceneManager()->setShaderPath(resourcePath + "/shaders"); resourceSystem->getSceneManager()->setShaderPath(resourcePath + "/shaders");
resourceSystem->getSceneManager()->setForceShaders(Settings::Manager::getBool("force shaders", "Shaders")); resourceSystem->getSceneManager()->setForceShaders(Settings::Manager::getBool("force shaders", "Shaders"));

Loading…
Cancel
Save