1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

First part of object instance API cleanup

- removed passability() method in favour of passableFor(PlayerColor)
- moved operator < code to map handler
- updated class documentation
This commit is contained in:
Ivan Savenko
2014-06-24 02:26:36 +03:00
parent c7dc4c05b8
commit 5ebc0e8614
13 changed files with 151 additions and 157 deletions

View File

@@ -644,25 +644,22 @@ void CGTownInstance::newTurn() const
}
}
}
/*
int3 CGTownInstance::getSightCenter() const
{
return pos - int3(2,0,0);
}
ui8 CGTownInstance::getPassableness() const
*/
bool CGTownInstance::passableFor(PlayerColor color) const
{
if (!armedGarrison())//empty castle - anyone can visit
return GameConstants::ALL_PLAYERS;
return true;
if ( tempOwner == PlayerColor::NEUTRAL )//neutral guarded - no one can visit
return 0;
return false;
ui8 mask = 0;
TeamState * ts = cb->gameState()->getPlayerTeam(tempOwner);
for(PlayerColor it : ts->players)
mask |= 1<<it.getNum();//allies - add to possible visitors
return mask;
if (cb->getPlayerRelations(tempOwner, color) != PlayerRelations::ENEMIES)
return true;
return false;
}
void CGTownInstance::getOutOffsets( std::vector<int3> &offsets ) const