Added a check to catch the error that a typeID does not exist in Compositions.xml.
This commit is contained in:
parent
6004651adc
commit
bb30aee8d3
@ -127,10 +127,12 @@ void Loader::load(std::string filePath, Level* level, std::string compositionsPa
|
|||||||
int thisType = queryInt(thisComposition, "typeID");
|
int thisType = queryInt(thisComposition, "typeID");
|
||||||
//iterate over all compositions in Compositions.xml to find the one corresponding to the current composition
|
//iterate over all compositions in Compositions.xml to find the one corresponding to the current composition
|
||||||
XMLElement* composition = compositions->FirstChildElement("composition");
|
XMLElement* composition = compositions->FirstChildElement("composition");
|
||||||
|
bool typeExists = false;
|
||||||
for(; composition; composition=composition->NextSiblingElement("composition")){
|
for(; composition; composition=composition->NextSiblingElement("composition")){
|
||||||
int compositionType = queryInt(composition, "typeID");
|
int compositionType = queryInt(composition, "typeID");
|
||||||
//corect composition found
|
//corect composition found
|
||||||
if(thisType == compositionType){
|
if(thisType == compositionType){
|
||||||
|
typeExists = true;
|
||||||
//iterate over all objects of the composition
|
//iterate over all objects of the composition
|
||||||
XMLElement* xmlObject = composition->FirstChildElement("object");
|
XMLElement* xmlObject = composition->FirstChildElement("object");
|
||||||
int objectNum = 0;
|
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
|
}//iterating over all lights of the composition
|
||||||
}//corect composition found
|
}//corect composition found
|
||||||
}//iterating over all compositions in Compositions.xml
|
}//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
|
}//iterating over all compositions in Level.xml
|
||||||
|
|
||||||
//load triggers
|
//load triggers
|
||||||
|
Loading…
Reference in New Issue
Block a user