diff --git a/source/graphics/MapGenerator.cpp b/source/graphics/MapGenerator.cpp index 1499eee03c..bda965c6cb 100644 --- a/source/graphics/MapGenerator.cpp +++ b/source/graphics/MapGenerator.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2017 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -118,12 +118,10 @@ bool CMapGeneratorWorker::Run() } // Init RNG seed - u32 seed; - if (!m_ScriptInterface->GetProperty(settingsVal, "Seed", seed)) - { // No seed specified + u32 seed = 0; + if (!m_ScriptInterface->HasProperty(settingsVal, "Seed") || + !m_ScriptInterface->GetProperty(settingsVal, "Seed", seed)) LOGWARNING("CMapGeneratorWorker::Run: No seed value specified - using 0"); - seed = 0; - } m_MapGenRNG.seed(seed); diff --git a/source/simulation2/Simulation2.cpp b/source/simulation2/Simulation2.cpp index fef97bf016..a52a4c8ce6 100644 --- a/source/simulation2/Simulation2.cpp +++ b/source/simulation2/Simulation2.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2016 Wildfire Games. +/* Copyright (C) 2017 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -794,7 +794,8 @@ void CSimulation2::SetMapSettings(JS::HandleValue settings) m->m_MapSettings = settings; u32 seed = 0; - if (!m->m_ComponentManager.GetScriptInterface().GetProperty(m->m_MapSettings, "Seed", seed)) + if (!m->m_ComponentManager.GetScriptInterface().HasProperty(m->m_MapSettings, "Seed") || + !m->m_ComponentManager.GetScriptInterface().GetProperty(m->m_MapSettings, "Seed", seed)) LOGWARNING("CSimulation2::SetInitAttributes: No seed value specified - using %d", seed); m->m_ComponentManager.SetRNGSeed(seed);