ignore building rules when not in game (i.e. editor)
This commit is contained in:
parent
ffc888ec8d
commit
5f490b8dea
1 changed files with 15 additions and 13 deletions
|
@ -453,22 +453,24 @@ CUnit *CanBuildHere(const CUnit *unit, const CUnitType &type, const Vec2i &pos)
|
|||
}
|
||||
}
|
||||
|
||||
size_t count = type.BuildingRules.size();
|
||||
if (count > 0) {
|
||||
for (unsigned int i = 0; i < count; ++i) {
|
||||
CBuildRestriction *rule = type.BuildingRules[i];
|
||||
CUnit *ontoptarget = NULL;
|
||||
// All checks processed, did we really have success
|
||||
if (rule->Check(unit, type, pos, ontoptarget)) {
|
||||
// We passed a full ruleset return
|
||||
if (unit == NULL) {
|
||||
return ontoptarget ? ontoptarget : (CUnit *)1;
|
||||
} else {
|
||||
return ontoptarget ? ontoptarget : const_cast<CUnit *>(unit);
|
||||
if (GameCycle != 0) {
|
||||
size_t count = type.BuildingRules.size();
|
||||
if (count > 0) {
|
||||
for (unsigned int i = 0; i < count; ++i) {
|
||||
CBuildRestriction *rule = type.BuildingRules[i];
|
||||
CUnit *ontoptarget = NULL;
|
||||
// All checks processed, did we really have success
|
||||
if (rule->Check(unit, type, pos, ontoptarget)) {
|
||||
// We passed a full ruleset return
|
||||
if (unit == NULL) {
|
||||
return ontoptarget ? ontoptarget : (CUnit *)1;
|
||||
} else {
|
||||
return ontoptarget ? ontoptarget : const_cast<CUnit *>(unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (unit == NULL) ? (CUnit *)1 : const_cast<CUnit *>(unit);
|
||||
|
|
Loading…
Reference in a new issue