- added new attribute for tileset objects named "height". Air units will try to fly above the height of units and objects now (up to a max of terrain height + 15)

This commit is contained in:
Mark Vejvoda
2010-10-30 04:05:48 +00:00
parent 465ae629ba
commit dec9dfe653
6 changed files with 39 additions and 9 deletions

View File

@@ -241,13 +241,17 @@ XmlAttribute *XmlNode::getAttribute(unsigned int i) const{
return attributes[i];
}
XmlAttribute *XmlNode::getAttribute(const string &name) const{
XmlAttribute *XmlNode::getAttribute(const string &name,bool mustExist) const {
for(unsigned int i=0; i<attributes.size(); ++i){
if(attributes[i]->getName()==name){
return attributes[i];
}
}
throw runtime_error("\"" + getName() + "\" node doesn't have a attribute named \"" + name + "\"");
if(mustExist == true) {
throw runtime_error("\"" + getName() + "\" node doesn't have a attribute named \"" + name + "\"");
}
return NULL;
}
XmlNode *XmlNode::getChild(unsigned int i) const {