From 956b59a8b807fb00fe52f9705b1a36d3bbcba70c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20F=C3=BCndgens?= Date: Wed, 4 Mar 2015 18:04:17 +0100 Subject: [PATCH] Added a check to catch the error that a typeID does not exist in Compositions.xml. --- loader.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/loader.cc b/loader.cc index cbba55a..09ed843 100644 --- a/loader.cc +++ b/loader.cc @@ -127,10 +127,12 @@ void Loader::load(std::string filePath, Level* level, std::string compositionsPa int thisType = queryInt(thisComposition, "typeID"); //iterate over all compositions in Compositions.xml to find the one corresponding to the current composition XMLElement* composition = compositions->FirstChildElement("composition"); + bool typeExists = false; for(; composition; composition=composition->NextSiblingElement("composition")){ int compositionType = queryInt(composition, "typeID"); //corect composition found if(thisType == compositionType){ + typeExists = true; //iterate over all objects of the composition XMLElement* xmlObject = composition->FirstChildElement("object"); int objectNum = 0; @@ -311,6 +313,9 @@ void Loader::load(std::string filePath, Level* level, std::string compositionsPa }//iterating over all lights of the composition }//corect composition found }//iterating over all compositions in Compositions.xml + if (!typeExists){ + std::cout << "The typeID " << thisType << " exists in the level xml but is not a Compositions." << std::endl; + } }//iterating over all compositions in Level.xml //load triggers