- added an extra NULL check to new max unit check

This commit is contained in:
Mark Vejvoda 2010-10-11 15:58:10 +00:00
parent d80127f697
commit 67c1c52caa
1 changed files with 5 additions and 5 deletions

View File

@ -173,16 +173,16 @@ bool Faction::reqsOk(const RequirableType *rt) const{
}
//required upgrades
for(int i=0; i<rt->getUpgradeReqCount(); ++i){
if(!upgradeManager.isUpgraded(rt->getUpgradeReq(i))){
for(int i=0; i<rt->getUpgradeReqCount(); ++i) {
if(upgradeManager.isUpgraded(rt->getUpgradeReq(i)) == false) {
return false;
}
}
if(dynamic_cast<const UnitType *>(rt) != NULL ){
if(dynamic_cast<const UnitType *>(rt) != NULL ) {
const UnitType *producedUnitType=(UnitType *) rt;
if(producedUnitType->getMaxUnitCount()>0){
if(producedUnitType->getMaxUnitCount()<=getCountForMaxUnitCount(producedUnitType)){
if(producedUnitType != NULL && producedUnitType->getMaxUnitCount() > 0) {
if(producedUnitType->getMaxUnitCount() <= getCountForMaxUnitCount(producedUnitType)) {
return false;
}
}