1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

More fixes to not place obstacles on wall parts

This commit is contained in:
AlexVinS 2016-09-24 04:55:48 +03:00
parent cffc4b2ab5
commit 7618e294c2
2 changed files with 10 additions and 9 deletions

View File

@ -70,7 +70,8 @@ namespace SiegeStuffThatShouldBeMovedToHandlers // <=== TODO
std::make_pair(45, EWallPart::INDESTRUCTIBLE_PART), std::make_pair(45, EWallPart::INDESTRUCTIBLE_PART),
std::make_pair(62, EWallPart::INDESTRUCTIBLE_PART), std::make_pair(62, EWallPart::INDESTRUCTIBLE_PART),
std::make_pair(112, EWallPart::INDESTRUCTIBLE_PART), std::make_pair(112, EWallPart::INDESTRUCTIBLE_PART),
std::make_pair(147, EWallPart::INDESTRUCTIBLE_PART) std::make_pair(147, EWallPart::INDESTRUCTIBLE_PART),
std::make_pair(165, EWallPart::INDESTRUCTIBLE_PART)
}; };
static EWallPart::EWallPart hexToWallPart(BattleHex hex) static EWallPart::EWallPart hexToWallPart(BattleHex hex)

View File

@ -430,14 +430,14 @@ bool ObstacleMechanics::isHexAviable(const CBattleInfoCallback * cb, const Battl
{ {
EWallPart::EWallPart part = cb->battleHexToWallPart(hex); EWallPart::EWallPart part = cb->battleHexToWallPart(hex);
if(part != EWallPart::INVALID) if(part == EWallPart::INVALID)
{ return true;//no fortification here
if(static_cast<int>(part) < 0) else if(static_cast<int>(part) < 0)
return false;//indestuctible part, cant be checked by battleGetWallState return false;//indestuctible part (cant be checked by battleGetWallState)
else if(part == EWallPart::BOTTOM_TOWER || part == EWallPart::UPPER_TOWER)
if(cb->battleGetWallState(part) != EWallState::DESTROYED && cb->battleGetWallState(part) != EWallState::NONE) return false;//destructible, but should not be available
return false; else if(cb->battleGetWallState(part) != EWallState::DESTROYED && cb->battleGetWallState(part) != EWallState::NONE)
} return false;
} }
return true; return true;