mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
* more TPlayerColor/TResource
This commit is contained in:
parent
18bd898cb1
commit
55f1c47c16
@ -80,7 +80,7 @@ struct ArmyDescriptor : public std::map<TSlot, CStackBasicDescriptor>
|
|||||||
|
|
||||||
struct DLL_LINKAGE InfoAboutArmy
|
struct DLL_LINKAGE InfoAboutArmy
|
||||||
{
|
{
|
||||||
ui8 owner;
|
TPlayerColor owner;
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
ArmyDescriptor army;
|
ArmyDescriptor army;
|
||||||
|
@ -212,7 +212,7 @@ int CObjectHandler::bankObjToIndex (const CGObjectInstance * obj)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int CGObjectInstance::getOwner() const
|
TPlayerColor CGObjectInstance::getOwner() const
|
||||||
{
|
{
|
||||||
//if (state)
|
//if (state)
|
||||||
// return state->owner;
|
// return state->owner;
|
||||||
@ -242,7 +242,7 @@ const std::string & CGObjectInstance::getHoverText() const
|
|||||||
{
|
{
|
||||||
return hoverName;
|
return hoverName;
|
||||||
}
|
}
|
||||||
void CGObjectInstance::setOwner(int ow)
|
void CGObjectInstance::setOwner(TPlayerColor ow)
|
||||||
{
|
{
|
||||||
//if (state)
|
//if (state)
|
||||||
// state->owner = ow;
|
// state->owner = ow;
|
||||||
@ -2198,12 +2198,12 @@ void CGTownInstance::fightOver( const CGHeroInstance *h, BattleResult *result )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGTownInstance::removeCapitols (ui8 owner) const
|
void CGTownInstance::removeCapitols (TPlayerColor owner) const
|
||||||
{
|
{
|
||||||
if (hasCapitol()) // search if there's an older capitol
|
if (hasCapitol()) // search if there's an older capitol
|
||||||
{
|
{
|
||||||
PlayerState* state = cb->gameState()->getPlayer (owner); //get all towns owned by player
|
PlayerState* state = cb->gameState()->getPlayer (owner); //get all towns owned by player
|
||||||
for (std::vector<ConstTransitivePtr<CGTownInstance> >::const_iterator i = state->towns.begin(); i < state->towns.end(); ++i)
|
for (auto i = state->towns.cbegin(); i < state->towns.cend(); ++i)
|
||||||
{
|
{
|
||||||
if (*i != this && (*i)->hasCapitol())
|
if (*i != this && (*i)->hasCapitol())
|
||||||
{
|
{
|
||||||
|
@ -167,15 +167,15 @@ public:
|
|||||||
CGDefInfo * defInfo;
|
CGDefInfo * defInfo;
|
||||||
ui8 animPhaseShift;
|
ui8 animPhaseShift;
|
||||||
|
|
||||||
ui8 tempOwner;
|
TPlayerColor tempOwner;
|
||||||
ui8 blockVisit; //if non-zero then blocks the tile but is visitable from neighbouring tile
|
ui8 blockVisit; //if non-zero then blocks the tile but is visitable from neighbouring tile
|
||||||
|
|
||||||
virtual ui8 getPassableness() const; //bitmap - if the bit is set the corresponding player can pass through the visitable tiles of object, even if it's blockvis; if not set - default properties from definfo are used
|
virtual ui8 getPassableness() const; //bitmap - if the bit is set the corresponding player can pass through the visitable tiles of object, even if it's blockvis; if not set - default properties from definfo are used
|
||||||
virtual int3 getSightCenter() const; //"center" tile from which the sight distance is calculated
|
virtual int3 getSightCenter() const; //"center" tile from which the sight distance is calculated
|
||||||
virtual int getSightRadious() const; //sight distance (should be used if player-owned structure)
|
virtual int getSightRadious() const; //sight distance (should be used if player-owned structure)
|
||||||
void getSightTiles(boost::unordered_set<int3, ShashInt3> &tiles) const; //returns reference to the set
|
void getSightTiles(boost::unordered_set<int3, ShashInt3> &tiles) const; //returns reference to the set
|
||||||
int getOwner() const;
|
TPlayerColor getOwner() const;
|
||||||
void setOwner(int ow);
|
void setOwner(TPlayerColor ow);
|
||||||
int getWidth() const; //returns width of object graphic in tiles
|
int getWidth() const; //returns width of object graphic in tiles
|
||||||
int getHeight() const; //returns height of object graphic in tiles
|
int getHeight() const; //returns height of object graphic in tiles
|
||||||
bool visitableAt(int x, int y) const; //returns true if object is visitable at location (x, y) form left top tile of image (x, y in tiles)
|
bool visitableAt(int x, int y) const; //returns true if object is visitable at location (x, y) form left top tile of image (x, y in tiles)
|
||||||
@ -424,7 +424,7 @@ class DLL_LINKAGE CSpecObjInfo
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~CSpecObjInfo(){};
|
virtual ~CSpecObjInfo(){};
|
||||||
ui8 player; //owner
|
TPlayerColor player; //owner
|
||||||
};
|
};
|
||||||
|
|
||||||
class DLL_LINKAGE CCreGenAsCastleInfo : public virtual CSpecObjInfo
|
class DLL_LINKAGE CCreGenAsCastleInfo : public virtual CSpecObjInfo
|
||||||
@ -637,7 +637,7 @@ public:
|
|||||||
bool hasBuilt(int buildingID, int townID) const;
|
bool hasBuilt(int buildingID, int townID) const;
|
||||||
int dailyIncome() const; //calculates daily income of this town
|
int dailyIncome() const; //calculates daily income of this town
|
||||||
int spellsAtLevel(int level, bool checkGuild) const; //levels are counted from 1 (1 - 5)
|
int spellsAtLevel(int level, bool checkGuild) const; //levels are counted from 1 (1 - 5)
|
||||||
void removeCapitols (ui8 owner) const;
|
void removeCapitols (TPlayerColor owner) const;
|
||||||
bool armedGarrison() const; //true if town has creatures in garrison or garrisoned hero
|
bool armedGarrison() const; //true if town has creatures in garrison or garrisoned hero
|
||||||
|
|
||||||
CGTownInstance();
|
CGTownInstance();
|
||||||
|
@ -1475,7 +1475,7 @@ StackOwnerLimiter::StackOwnerLimiter()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
StackOwnerLimiter::StackOwnerLimiter(ui8 Owner)
|
StackOwnerLimiter::StackOwnerLimiter(TPlayerColor Owner)
|
||||||
: owner(Owner)
|
: owner(Owner)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -828,9 +828,9 @@ public:
|
|||||||
class DLL_LINKAGE StackOwnerLimiter : public ILimiter //applies only to creatures of given alignment
|
class DLL_LINKAGE StackOwnerLimiter : public ILimiter //applies only to creatures of given alignment
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ui8 owner;
|
TPlayerColor owner;
|
||||||
StackOwnerLimiter();
|
StackOwnerLimiter();
|
||||||
StackOwnerLimiter(ui8 Owner);
|
StackOwnerLimiter(TPlayerColor Owner);
|
||||||
|
|
||||||
int limit(const BonusLimitationContext &context) const OVERRIDE;
|
int limit(const BonusLimitationContext &context) const OVERRIDE;
|
||||||
|
|
||||||
|
@ -41,14 +41,14 @@ CGameState * CPrivilagedInfoCallback::gameState ()
|
|||||||
return gs;
|
return gs;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CGameInfoCallback::getOwner(int heroID) const
|
TPlayerColor CGameInfoCallback::getOwner(int heroID) const
|
||||||
{
|
{
|
||||||
const CGObjectInstance *obj = getObj(heroID);
|
const CGObjectInstance *obj = getObj(heroID);
|
||||||
ERROR_RET_VAL_IF(!obj, "No such object!", -1);
|
ERROR_RET_VAL_IF(!obj, "No such object!", -1);
|
||||||
return gs->map->objects[heroID]->tempOwner;
|
return gs->map->objects[heroID]->tempOwner;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CGameInfoCallback::getResource(int Player, int which) const
|
TResource CGameInfoCallback::getResource(TPlayerColor Player, int which) const
|
||||||
{
|
{
|
||||||
const PlayerState *p = getPlayer(Player);
|
const PlayerState *p = getPlayer(Player);
|
||||||
ERROR_RET_VAL_IF(!p, "No player info!", -1);
|
ERROR_RET_VAL_IF(!p, "No player info!", -1);
|
||||||
@ -56,7 +56,7 @@ int CGameInfoCallback::getResource(int Player, int which) const
|
|||||||
return p->resources[which];
|
return p->resources[which];
|
||||||
}
|
}
|
||||||
|
|
||||||
const CGHeroInstance* CGameInfoCallback::getSelectedHero( int Player ) const
|
const CGHeroInstance* CGameInfoCallback::getSelectedHero( TPlayerColor Player ) const
|
||||||
{
|
{
|
||||||
const PlayerState *p = getPlayer(Player);
|
const PlayerState *p = getPlayer(Player);
|
||||||
ERROR_RET_VAL_IF(!p, "No player info!", NULL);
|
ERROR_RET_VAL_IF(!p, "No player info!", NULL);
|
||||||
@ -68,12 +68,12 @@ const CGHeroInstance* CGameInfoCallback::getSelectedHero() const
|
|||||||
return getSelectedHero(gs->currentPlayer);
|
return getSelectedHero(gs->currentPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
const PlayerSettings * CGameInfoCallback::getPlayerSettings(int color) const
|
const PlayerSettings * CGameInfoCallback::getPlayerSettings(TPlayerColor color) const
|
||||||
{
|
{
|
||||||
return &gs->scenarioOps->getIthPlayersSettings(color);
|
return &gs->scenarioOps->getIthPlayersSettings(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPrivilagedInfoCallback::getTilesInRange( boost::unordered_set<int3, ShashInt3> &tiles, int3 pos, int radious, int player/*=-1*/, int mode/*=0*/ ) const
|
void CPrivilagedInfoCallback::getTilesInRange( boost::unordered_set<int3, ShashInt3> &tiles, int3 pos, int radious, TPlayerColor player/*=-1*/, int mode/*=0*/ ) const
|
||||||
{
|
{
|
||||||
if(player >= GameConstants::PLAYER_LIMIT)
|
if(player >= GameConstants::PLAYER_LIMIT)
|
||||||
{
|
{
|
||||||
@ -103,7 +103,7 @@ void CPrivilagedInfoCallback::getTilesInRange( boost::unordered_set<int3, ShashI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPrivilagedInfoCallback::getAllTiles (boost::unordered_set<int3, ShashInt3> &tiles, int Player/*=-1*/, int level, int surface ) const
|
void CPrivilagedInfoCallback::getAllTiles (boost::unordered_set<int3, ShashInt3> &tiles, TPlayerColor Player/*=-1*/, int level, int surface ) const
|
||||||
{
|
{
|
||||||
if(Player >= GameConstants::PLAYER_LIMIT)
|
if(Player >= GameConstants::PLAYER_LIMIT)
|
||||||
{
|
{
|
||||||
@ -226,14 +226,14 @@ inline TerrainTile * CNonConstInfoCallback::getTile( int3 pos )
|
|||||||
return &gs->map->getTile(pos);
|
return &gs->map->getTile(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
const PlayerState * CGameInfoCallback::getPlayer(int color, bool verbose) const
|
const PlayerState * CGameInfoCallback::getPlayer(TPlayerColor color, bool verbose) const
|
||||||
{
|
{
|
||||||
ERROR_VERBOSE_OR_NOT_RET_VAL_IF(!hasAccess(color), verbose, "Cannot access player " << color << "info!", NULL);
|
ERROR_VERBOSE_OR_NOT_RET_VAL_IF(!hasAccess(color), verbose, "Cannot access player " << color << "info!", NULL);
|
||||||
ERROR_VERBOSE_OR_NOT_RET_VAL_IF(!vstd::contains(gs->players,color), verbose, "Cannot find player " << color << "info!", NULL);
|
ERROR_VERBOSE_OR_NOT_RET_VAL_IF(!vstd::contains(gs->players,color), verbose, "Cannot find player " << color << "info!", NULL);
|
||||||
return &gs->players[color];
|
return &gs->players[color];
|
||||||
}
|
}
|
||||||
|
|
||||||
const CTown * CGameInfoCallback::getNativeTown(int color) const
|
const CTown * CGameInfoCallback::getNativeTown(TPlayerColor color) const
|
||||||
{
|
{
|
||||||
const PlayerSettings *ps = getPlayerSettings(color);
|
const PlayerSettings *ps = getPlayerSettings(color);
|
||||||
ERROR_RET_VAL_IF(!ps, "There is no such player!", NULL);
|
ERROR_RET_VAL_IF(!ps, "There is no such player!", NULL);
|
||||||
@ -442,7 +442,7 @@ bool CGameInfoCallback::verifyPath(CPath * path, bool blockSea) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGameInfoCallback::isVisible(int3 pos, int Player) const
|
bool CGameInfoCallback::isVisible(int3 pos, TPlayerColor Player) const
|
||||||
{
|
{
|
||||||
//boost::shared_lock<boost::shared_mutex> lock(*gs->mx);
|
//boost::shared_lock<boost::shared_mutex> lock(*gs->mx);
|
||||||
return gs->map->isInTheMap(pos) && (Player == -1 || gs->isVisible(pos, Player));
|
return gs->map->isInTheMap(pos) && (Player == -1 || gs->isVisible(pos, Player));
|
||||||
@ -453,7 +453,7 @@ bool CGameInfoCallback::isVisible(int3 pos) const
|
|||||||
return isVisible(pos,player);
|
return isVisible(pos,player);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGameInfoCallback::isVisible( const CGObjectInstance *obj, int Player ) const
|
bool CGameInfoCallback::isVisible( const CGObjectInstance *obj, TPlayerColor Player ) const
|
||||||
{
|
{
|
||||||
return gs->isVisible(obj, Player);
|
return gs->isVisible(obj, Player);
|
||||||
}
|
}
|
||||||
@ -640,12 +640,12 @@ const CMapHeader * CGameInfoCallback::getMapHeader() const
|
|||||||
return gs->map;
|
return gs->map;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGameInfoCallback::hasAccess(int playerId) const
|
bool CGameInfoCallback::hasAccess(TPlayerColor playerId) const
|
||||||
{
|
{
|
||||||
return player < 0 || gs->getPlayerRelations( playerId, player );
|
return player < 0 || gs->getPlayerRelations( playerId, player );
|
||||||
}
|
}
|
||||||
|
|
||||||
int CGameInfoCallback::getPlayerStatus(int player) const
|
int CGameInfoCallback::getPlayerStatus(TPlayerColor player) const
|
||||||
{
|
{
|
||||||
const PlayerState *ps = gs->getPlayer(player, false);
|
const PlayerState *ps = gs->getPlayer(player, false);
|
||||||
if(!ps)
|
if(!ps)
|
||||||
@ -658,7 +658,7 @@ std::string CGameInfoCallback::getTavernGossip(const CGObjectInstance * townOrTa
|
|||||||
return "GOSSIP TEST";
|
return "GOSSIP TEST";
|
||||||
}
|
}
|
||||||
|
|
||||||
int CGameInfoCallback::getPlayerRelations( ui8 color1, ui8 color2 ) const
|
int CGameInfoCallback::getPlayerRelations( TPlayerColor color1, TPlayerColor color2 ) const
|
||||||
{
|
{
|
||||||
return gs->getPlayerRelations(color1, color2);
|
return gs->getPlayerRelations(color1, color2);
|
||||||
}
|
}
|
||||||
@ -668,7 +668,7 @@ bool CGameInfoCallback::canGetFullInfo(const CGObjectInstance *obj) const
|
|||||||
return !obj || hasAccess(obj->tempOwner);
|
return !obj || hasAccess(obj->tempOwner);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CGameInfoCallback::getHeroCount( int player, bool includeGarrisoned ) const
|
int CGameInfoCallback::getHeroCount( TPlayerColor player, bool includeGarrisoned ) const
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
const PlayerState *p = gs->getPlayer(player);
|
const PlayerState *p = gs->getPlayer(player);
|
||||||
@ -702,7 +702,7 @@ CGameInfoCallback::CGameInfoCallback()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CGameInfoCallback::CGameInfoCallback(CGameState *GS, int Player)
|
CGameInfoCallback::CGameInfoCallback(CGameState *GS, TPlayerColor Player)
|
||||||
{
|
{
|
||||||
gs = GS;
|
gs = GS;
|
||||||
player = Player;
|
player = Player;
|
||||||
@ -851,7 +851,7 @@ const CGTownInstance* CPlayerSpecificInfoCallback::getTownBySerial(int serialId)
|
|||||||
return p->towns[serialId];
|
return p->towns[serialId];
|
||||||
}
|
}
|
||||||
|
|
||||||
int CPlayerSpecificInfoCallback::getResourceAmount(int type) const
|
TResource CPlayerSpecificInfoCallback::getResourceAmount(int type) const
|
||||||
{
|
{
|
||||||
//boost::shared_lock<boost::shared_mutex> lock(*gs->mx);
|
//boost::shared_lock<boost::shared_mutex> lock(*gs->mx);
|
||||||
ERROR_RET_VAL_IF(player == -1, "Applicable only for player callbacks", -1);
|
ERROR_RET_VAL_IF(player == -1, "Applicable only for player callbacks", -1);
|
||||||
@ -881,12 +881,12 @@ TeamState *CNonConstInfoCallback::getTeam(ui8 teamID)
|
|||||||
return const_cast<TeamState*>(CGameInfoCallback::getTeam(teamID));
|
return const_cast<TeamState*>(CGameInfoCallback::getTeam(teamID));
|
||||||
}
|
}
|
||||||
|
|
||||||
TeamState *CNonConstInfoCallback::getPlayerTeam(ui8 color)
|
TeamState *CNonConstInfoCallback::getPlayerTeam(TPlayerColor color)
|
||||||
{
|
{
|
||||||
return const_cast<TeamState*>(CGameInfoCallback::getPlayerTeam(color));
|
return const_cast<TeamState*>(CGameInfoCallback::getPlayerTeam(color));
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerState * CNonConstInfoCallback::getPlayer( ui8 color, bool verbose )
|
PlayerState * CNonConstInfoCallback::getPlayer( TPlayerColor color, bool verbose )
|
||||||
{
|
{
|
||||||
return const_cast<PlayerState*>(CGameInfoCallback::getPlayer(color, verbose));
|
return const_cast<PlayerState*>(CGameInfoCallback::getPlayer(color, verbose));
|
||||||
}
|
}
|
||||||
@ -899,9 +899,9 @@ const TeamState * CGameInfoCallback::getTeam( ui8 teamID ) const
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TeamState * CGameInfoCallback::getPlayerTeam( ui8 teamID ) const
|
const TeamState * CGameInfoCallback::getPlayerTeam( TPlayerColor color ) const
|
||||||
{
|
{
|
||||||
const PlayerState * ps = getPlayer(teamID);
|
const PlayerState * ps = getPlayer(color);
|
||||||
if (ps)
|
if (ps)
|
||||||
return getTeam(ps->team);
|
return getTeam(ps->team);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -64,10 +64,10 @@ class DLL_LINKAGE CGameInfoCallback : public virtual CCallbackBase
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
CGameInfoCallback();
|
CGameInfoCallback();
|
||||||
CGameInfoCallback(CGameState *GS, int Player);
|
CGameInfoCallback(CGameState *GS, TPlayerColor Player);
|
||||||
bool hasAccess(int playerId) const;
|
bool hasAccess(TPlayerColor playerId) const;
|
||||||
bool isVisible(int3 pos, int Player) const;
|
bool isVisible(int3 pos, TPlayerColor Player) const;
|
||||||
bool isVisible(const CGObjectInstance *obj, int Player) const;
|
bool isVisible(const CGObjectInstance *obj, TPlayerColor Player) const;
|
||||||
bool isVisible(const CGObjectInstance *obj) const;
|
bool isVisible(const CGObjectInstance *obj) const;
|
||||||
|
|
||||||
bool canGetFullInfo(const CGObjectInstance *obj) const; //true we player owns obj or ally owns obj or privileged mode
|
bool canGetFullInfo(const CGObjectInstance *obj) const; //true we player owns obj or ally owns obj or privileged mode
|
||||||
@ -80,15 +80,15 @@ public:
|
|||||||
bool isAllowed(int type, int id); //type: 0 - spell; 1- artifact; 2 - secondary skill
|
bool isAllowed(int type, int id); //type: 0 - spell; 1- artifact; 2 - secondary skill
|
||||||
|
|
||||||
//player
|
//player
|
||||||
const PlayerState * getPlayer(int color, bool verbose = true) const;
|
const PlayerState * getPlayer(TPlayerColor color, bool verbose = true) const;
|
||||||
int getResource(int Player, int which) const;
|
TResource getResource(TPlayerColor Player, int which) const;
|
||||||
bool isVisible(int3 pos) const;
|
bool isVisible(int3 pos) const;
|
||||||
int getPlayerRelations(ui8 color1, ui8 color2) const;// 0 = enemy, 1 = ally, 2 = same player
|
int getPlayerRelations(TPlayerColor color1, TPlayerColor color2) const;// 0 = enemy, 1 = ally, 2 = same player
|
||||||
void getThievesGuildInfo(SThievesGuildInfo & thi, const CGObjectInstance * obj); //get thieves' guild info obtainable while visiting given object
|
void getThievesGuildInfo(SThievesGuildInfo & thi, const CGObjectInstance * obj); //get thieves' guild info obtainable while visiting given object
|
||||||
int getPlayerStatus(int player) const; //-1 if no such player
|
int getPlayerStatus(TPlayerColor player) const; //-1 if no such player
|
||||||
int getCurrentPlayer() const; //player that currently makes move // TODO synchronous turns
|
int getCurrentPlayer() const; //player that currently makes move // TODO synchronous turns
|
||||||
virtual int getLocalPlayer() const; //player that is currently owning given client (if not a client, then returns current player)
|
virtual int getLocalPlayer() const; //player that is currently owning given client (if not a client, then returns current player)
|
||||||
const PlayerSettings * getPlayerSettings(int color) const;
|
const PlayerSettings * getPlayerSettings(TPlayerColor color) const;
|
||||||
|
|
||||||
|
|
||||||
//armed object
|
//armed object
|
||||||
@ -97,12 +97,12 @@ public:
|
|||||||
//hero
|
//hero
|
||||||
const CGHeroInstance* getHero(int objid) const;
|
const CGHeroInstance* getHero(int objid) const;
|
||||||
const CGHeroInstance* getHeroWithSubid(int subid) const;
|
const CGHeroInstance* getHeroWithSubid(int subid) const;
|
||||||
int getHeroCount(int player, bool includeGarrisoned) const;
|
int getHeroCount(TPlayerColor player, bool includeGarrisoned) const;
|
||||||
bool getHeroInfo(const CGObjectInstance *hero, InfoAboutHero &dest) const;
|
bool getHeroInfo(const CGObjectInstance *hero, InfoAboutHero &dest) const;
|
||||||
int getSpellCost(const CSpell * sp, const CGHeroInstance * caster) const; //when called during battle, takes into account creatures' spell cost reduction
|
int getSpellCost(const CSpell * sp, const CGHeroInstance * caster) const; //when called during battle, takes into account creatures' spell cost reduction
|
||||||
int estimateSpellDamage(const CSpell * sp, const CGHeroInstance * hero) const; //estimates damage of given spell; returns 0 if spell causes no dmg
|
int estimateSpellDamage(const CSpell * sp, const CGHeroInstance * hero) const; //estimates damage of given spell; returns 0 if spell causes no dmg
|
||||||
bool verifyPath(CPath * path, bool blockSea)const;
|
bool verifyPath(CPath * path, bool blockSea)const;
|
||||||
const CGHeroInstance* getSelectedHero(int player) const; //NULL if no hero is selected
|
const CGHeroInstance* getSelectedHero(TPlayerColor player) const; //NULL if no hero is selected
|
||||||
const CGHeroInstance* getSelectedHero() const; //of current (active) player
|
const CGHeroInstance* getSelectedHero() const; //of current (active) player
|
||||||
|
|
||||||
//objects
|
//objects
|
||||||
@ -111,7 +111,7 @@ public:
|
|||||||
std::vector <const CGObjectInstance * > getVisitableObjs(int3 pos, bool verbose = true)const;
|
std::vector <const CGObjectInstance * > getVisitableObjs(int3 pos, bool verbose = true)const;
|
||||||
std::vector <const CGObjectInstance * > getFlaggableObjects(int3 pos) const;
|
std::vector <const CGObjectInstance * > getFlaggableObjects(int3 pos) const;
|
||||||
std::vector <std::string > getObjDescriptions(int3 pos)const; //returns descriptions of objects at pos in order from the lowest to the highest
|
std::vector <std::string > getObjDescriptions(int3 pos)const; //returns descriptions of objects at pos in order from the lowest to the highest
|
||||||
int getOwner(int heroID) const;
|
TPlayerColor getOwner(int heroID) const;
|
||||||
const CGObjectInstance *getObjByQuestIdentifier(int identifier) const; //NULL if object has been removed (eg. killed)
|
const CGObjectInstance *getObjByQuestIdentifier(int identifier) const; //NULL if object has been removed (eg. killed)
|
||||||
|
|
||||||
//map
|
//map
|
||||||
@ -130,11 +130,11 @@ public:
|
|||||||
int canBuildStructure(const CGTownInstance *t, int ID);//// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
|
int canBuildStructure(const CGTownInstance *t, int ID);//// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
|
||||||
std::set<int> getBuildingRequiments(const CGTownInstance *t, int ID);
|
std::set<int> getBuildingRequiments(const CGTownInstance *t, int ID);
|
||||||
virtual bool getTownInfo(const CGObjectInstance *town, InfoAboutTown &dest) const;
|
virtual bool getTownInfo(const CGObjectInstance *town, InfoAboutTown &dest) const;
|
||||||
const CTown *getNativeTown(int color) const;
|
const CTown *getNativeTown(TPlayerColor color) const;
|
||||||
|
|
||||||
//from gs
|
//from gs
|
||||||
const TeamState *getTeam(ui8 teamID) const;
|
const TeamState *getTeam(ui8 teamID) const;
|
||||||
const TeamState *getPlayerTeam(ui8 color) const;
|
const TeamState *getPlayerTeam(TPlayerColor color) const;
|
||||||
std::set<int> getBuildingRequiments(const CGTownInstance *t, int ID) const;
|
std::set<int> getBuildingRequiments(const CGTownInstance *t, int ID) const;
|
||||||
int canBuildStructure(const CGTownInstance *t, int ID) const;// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
|
int canBuildStructure(const CGTownInstance *t, int ID) const;// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
|
||||||
};
|
};
|
||||||
@ -157,10 +157,10 @@ public:
|
|||||||
std::vector <const CGObjectInstance * > getMyObjects() const; //returns all objects flagged by belonging player
|
std::vector <const CGObjectInstance * > getMyObjects() const; //returns all objects flagged by belonging player
|
||||||
std::vector <QuestInfo> getMyQuests() const;
|
std::vector <QuestInfo> getMyQuests() const;
|
||||||
|
|
||||||
int getResourceAmount(int type)const;
|
TResource getResourceAmount(int type)const;
|
||||||
TResources getResourceAmount() const;
|
TResources getResourceAmount() const;
|
||||||
const std::vector< std::vector< std::vector<ui8> > > & getVisibilityMap()const; //returns visibility map
|
const std::vector< std::vector< std::vector<ui8> > > & getVisibilityMap()const; //returns visibility map
|
||||||
const PlayerSettings * getPlayerSettings(int color) const;
|
const PlayerSettings * getPlayerSettings(TPlayerColor color) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DLL_LINKAGE CPrivilagedInfoCallback : public CGameInfoCallback
|
class DLL_LINKAGE CPrivilagedInfoCallback : public CGameInfoCallback
|
||||||
@ -168,8 +168,8 @@ class DLL_LINKAGE CPrivilagedInfoCallback : public CGameInfoCallback
|
|||||||
public:
|
public:
|
||||||
CGameState * gameState ();
|
CGameState * gameState ();
|
||||||
void getFreeTiles (std::vector<int3> &tiles) const; //used for random spawns
|
void getFreeTiles (std::vector<int3> &tiles) const; //used for random spawns
|
||||||
void getTilesInRange(boost::unordered_set<int3, ShashInt3> &tiles, int3 pos, int radious, int player=-1, int mode=0) const; //mode 1 - only unrevealed tiles; mode 0 - all, mode -1 - only unrevealed
|
void getTilesInRange(boost::unordered_set<int3, ShashInt3> &tiles, int3 pos, int radious, TPlayerColor player=-1, int mode=0) const; //mode 1 - only unrevealed tiles; mode 0 - all, mode -1 - only unrevealed
|
||||||
void getAllTiles (boost::unordered_set<int3, ShashInt3> &tiles, int player=-1, int level=-1, int surface=0) const; //returns all tiles on given level (-1 - both levels, otherwise number of level); surface: 0 - land and water, 1 - only land, 2 - only water
|
void getAllTiles (boost::unordered_set<int3, ShashInt3> &tiles, TPlayerColor player=-1, int level=-1, int surface=0) const; //returns all tiles on given level (-1 - both levels, otherwise number of level); surface: 0 - land and water, 1 - only land, 2 - only water
|
||||||
ui16 getRandomArt (int flags);
|
ui16 getRandomArt (int flags);
|
||||||
ui16 getArtSync (ui32 rand, int flags); //synchronous
|
ui16 getArtSync (ui32 rand, int flags); //synchronous
|
||||||
void pickAllowedArtsSet(std::vector<const CArtifact*> &out); //gives 3 treasures, 3 minors, 1 major -> used by Black Market and Artifact Merchant
|
void pickAllowedArtsSet(std::vector<const CArtifact*> &out); //gives 3 treasures, 3 minors, 1 major -> used by Black Market and Artifact Merchant
|
||||||
@ -180,9 +180,9 @@ public:
|
|||||||
class DLL_LINKAGE CNonConstInfoCallback : public CPrivilagedInfoCallback
|
class DLL_LINKAGE CNonConstInfoCallback : public CPrivilagedInfoCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PlayerState *getPlayer(ui8 color, bool verbose = true);
|
PlayerState *getPlayer(TPlayerColor color, bool verbose = true);
|
||||||
TeamState *getTeam(ui8 teamID);//get team by team ID
|
TeamState *getTeam(ui8 teamID);//get team by team ID
|
||||||
TeamState *getPlayerTeam(ui8 color);// get team by player color
|
TeamState *getPlayerTeam(TPlayerColor color);// get team by player color
|
||||||
CGHeroInstance *getHero(int objid);
|
CGHeroInstance *getHero(int objid);
|
||||||
CGTownInstance *getTown(int objid);
|
CGTownInstance *getTown(int objid);
|
||||||
TerrainTile * getTile(int3 pos);
|
TerrainTile * getTile(int3 pos);
|
||||||
@ -248,7 +248,7 @@ public:
|
|||||||
virtual void changeObjPos(int objid, int3 newPos, ui8 flags)=0;
|
virtual void changeObjPos(int objid, int3 newPos, ui8 flags)=0;
|
||||||
virtual void sendAndApply(CPackForClient * info)=0;
|
virtual void sendAndApply(CPackForClient * info)=0;
|
||||||
virtual void heroExchange(si32 hero1, si32 hero2)=0; //when two heroes meet on adventure map
|
virtual void heroExchange(si32 hero1, si32 hero2)=0; //when two heroes meet on adventure map
|
||||||
virtual void addQuest(int player, QuestInfo & quest){};
|
virtual void addQuest(TPlayerColor player, QuestInfo & quest){};
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Interface class for handling general game logic and actions
|
/// Interface class for handling general game logic and actions
|
||||||
|
@ -16,7 +16,7 @@ namespace Res
|
|||||||
};
|
};
|
||||||
|
|
||||||
//class to be representing a vector of resource
|
//class to be representing a vector of resource
|
||||||
class ResourceSet : public std::vector<int>
|
class ResourceSet : public std::vector<TResource>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DLL_LINKAGE ResourceSet();
|
DLL_LINKAGE ResourceSet();
|
||||||
|
Loading…
Reference in New Issue
Block a user