- added an invlaid value check to the units field
This commit is contained in:
parent
1984c61386
commit
8918b11320
|
@ -833,7 +833,11 @@ void Map::putUnitCells(Unit *unit, const Vec2i &pos) {
|
||||||
assert(getCell(currPos)->getUnit(unit->getCurrField()) == NULL);
|
assert(getCell(currPos)->getUnit(unit->getCurrField()) == NULL);
|
||||||
if(getCell(currPos)->getUnit(unit->getCurrField()) != NULL) {
|
if(getCell(currPos)->getUnit(unit->getCurrField()) != NULL) {
|
||||||
// throw runtime_error("getCell(currPos)->getUnit(unit->getCurrField()) != NULL");
|
// throw runtime_error("getCell(currPos)->getUnit(unit->getCurrField()) != NULL");
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] ERROR [getCell(currPos)->getUnit(unit->getCurrField()) != NULL] currPos [%s] unit [%s] cell unit [%s]\n",__FILE__,__FUNCTION__,__LINE__,currPos.getString().c_str(),unit->toString().c_str(),getCell(currPos)->getUnit(unit->getCurrField())->toString().c_str());
|
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] ERROR [getCell(currPos)->getUnit(unit->getCurrField()) != NULL] currPos [%s] unit [%s] cell unit [%s]\n",
|
||||||
|
__FILE__,__FUNCTION__,__LINE__,
|
||||||
|
currPos.getString().c_str(),
|
||||||
|
unit->toString().c_str(),
|
||||||
|
getCell(currPos)->getUnit(unit->getCurrField())->toString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
getCell(currPos)->setUnit(unit->getCurrField(), unit);
|
getCell(currPos)->setUnit(unit->getCurrField(), unit);
|
||||||
|
|
|
@ -59,12 +59,12 @@ public:
|
||||||
Cell();
|
Cell();
|
||||||
|
|
||||||
//get
|
//get
|
||||||
Unit *getUnit(int field) const {return units[field];}
|
Unit *getUnit(int field) const { if(field >= fieldCount) { throw runtime_error("Invalid field value" + intToStr(field));} return units[field];}
|
||||||
Unit *getUnitWithEmptyCellMap(int field) const {return unitsWithEmptyCellMap[field];}
|
Unit *getUnitWithEmptyCellMap(int field) const { if(field >= fieldCount) { throw runtime_error("Invalid field value" + intToStr(field));} return unitsWithEmptyCellMap[field];}
|
||||||
float getHeight() const {return height;}
|
float getHeight() const {return height;}
|
||||||
|
|
||||||
void setUnit(int field, Unit *unit) {units[field]= unit;}
|
void setUnit(int field, Unit *unit) { if(field >= fieldCount) { throw runtime_error("Invalid field value" + intToStr(field));} units[field]= unit;}
|
||||||
void setUnitWithEmptyCellMap(int field, Unit *unit) {unitsWithEmptyCellMap[field]= unit;}
|
void setUnitWithEmptyCellMap(int field, Unit *unit) { if(field >= fieldCount) { throw runtime_error("Invalid field value" + intToStr(field));} unitsWithEmptyCellMap[field]= unit;}
|
||||||
void setHeight(float height) {this->height= height;}
|
void setHeight(float height) {this->height= height;}
|
||||||
|
|
||||||
bool isFree(Field field) const;
|
bool isFree(Field field) const;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user