mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
* much better callback function declaration (previous version inspired me to write a new coding guideline)
This commit is contained in:
parent
13a5a820d0
commit
100dad889a
@ -1889,7 +1889,7 @@ void CGameState::calculatePaths(const CGHeroInstance *hero, CPathsInfo &out, int
|
||||
* @return int3(-1, -1, -1) if the tile is unguarded, or the position of
|
||||
* the monster guarding the tile.
|
||||
*/
|
||||
const std::vector<CGObjectInstance*> CGameState::guardingCreatures (int3 pos) const
|
||||
std::vector<CGObjectInstance*> CGameState::guardingCreatures (int3 pos) const
|
||||
{
|
||||
std::vector<CGObjectInstance*> guards;
|
||||
const int3 originalPos = pos;
|
||||
|
@ -423,7 +423,7 @@ public:
|
||||
bool getPath(int3 src, int3 dest, const CGHeroInstance * hero, CPath &ret); //calculates path between src and dest; returns pointer to newly allocated CPath or NULL if path does not exists
|
||||
void calculatePaths(const CGHeroInstance *hero, CPathsInfo &out, int3 src = int3(-1,-1,-1), int movement = -1); //calculates possible paths for hero, by default uses current hero position and movement left; returns pointer to newly allocated CPath or NULL if path does not exists
|
||||
int3 guardingCreaturePosition (int3 pos) const;
|
||||
const std::vector<CGObjectInstance*> guardingCreatures (int3 pos) const;
|
||||
std::vector<CGObjectInstance*> guardingCreatures (int3 pos) const;
|
||||
int victoryCheck(ui8 player) const; //checks if given player is winner; -1 if std victory, 1 if special victory, 0 else
|
||||
int lossCheck(ui8 player) const; //checks if given player is loser; -1 if std loss, 1 if special, 0 else
|
||||
ui8 checkForStandardWin() const; //returns color of player that accomplished standard victory conditions or 255 if no winner
|
||||
|
@ -386,10 +386,15 @@ int3 CGameInfoCallback::guardingCreaturePosition (int3 pos) const
|
||||
return gs->guardingCreaturePosition(pos);
|
||||
}
|
||||
|
||||
const std::vector<CGObjectInstance*> CGameInfoCallback::getGuardingCreatures (int3 pos) const
|
||||
std::vector<const CGObjectInstance*> CGameInfoCallback::getGuardingCreatures (int3 pos) const
|
||||
{
|
||||
ERROR_RET_VAL_IF(!isVisible(pos), "Tile is not visible!", std::vector<CGObjectInstance*>());
|
||||
return gs->guardingCreatures (pos);
|
||||
ERROR_RET_VAL_IF(!isVisible(pos), "Tile is not visible!", std::vector<const CGObjectInstance*>());
|
||||
std::vector<const CGObjectInstance*> ret;
|
||||
BOOST_FOREACH(auto cr, gs->guardingCreatures(pos))
|
||||
{
|
||||
ret.push_back(cr);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool CGameInfoCallback::getHeroInfo( const CGObjectInstance *hero, InfoAboutHero &dest ) const
|
||||
|
@ -116,7 +116,7 @@ public:
|
||||
|
||||
//map
|
||||
int3 guardingCreaturePosition (int3 pos) const;
|
||||
const std::vector<CGObjectInstance*> getGuardingCreatures (int3 pos) const;
|
||||
std::vector<const CGObjectInstance*> getGuardingCreatures (int3 pos) const;
|
||||
const CMapHeader * getMapHeader()const;
|
||||
int3 getMapSize() const; //returns size of map - z is 1 for one - level map and 2 for two level map
|
||||
const TerrainTile * getTile(int3 tile, bool verbose = true) const;
|
||||
|
Loading…
Reference in New Issue
Block a user