1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-31 22:05:10 +02:00
This commit is contained in:
Trevor Standley 2009-08-04 09:46:51 +00:00
parent 07828ab335
commit 8805102b6e
2 changed files with 17 additions and 1 deletions

View File

@ -308,6 +308,14 @@ std::vector < const CGHeroInstance *> CCallback::getHeroesInfo(bool onlyOur) con
} }
return ret; return ret;
} }
std::map<int,CBuilding *> CCallback::getCBuildingsByID(const CGTownInstance * tn) const
{
return CGI->buildh->buildings[tn->subID];
}
const CCreature * CCallback::getCCreatureByID(int ID) const
{
return &CGI->creh->creatures[ID];
}
bool CCallback::isVisible(int3 pos) const bool CCallback::isVisible(int3 pos) const
{ {

View File

@ -10,6 +10,7 @@
//(boost using this lib during compilation i dont know what for exactly) //(boost using this lib during compilation i dont know what for exactly)
#endif #endif
#include "lib/CGameState.h" #include "lib/CGameState.h"
#include <map>
/* /*
* CCallback.h, part of VCMI engine * CCallback.h, part of VCMI engine
@ -20,7 +21,7 @@
* Full text of license available in license.txt file, in main folder * Full text of license available in license.txt file, in main folder
* *
*/ */
class CBuilding;
class CGHeroInstance; class CGHeroInstance;
class CGameState; class CGameState;
struct CPath; struct CPath;
@ -126,6 +127,11 @@ public:
virtual int getHeroSerial(const CGHeroInstance * hero)const =0; virtual int getHeroSerial(const CGHeroInstance * hero)const =0;
virtual const StartInfo * getStartInfo()const =0; virtual const StartInfo * getStartInfo()const =0;
//get static info
//TODO: is there a better way for the AI to access this data? In WoG it isn't static.
virtual const CCreature * getCCreatureByID(int ID) const= 0;
virtual std::map<int, CBuilding *> getCBuildingsByID(const CGTownInstance * tn) const= 0;
//hero //hero
virtual int howManyHeroes(bool includeGarrisoned = true)const =0; virtual int howManyHeroes(bool includeGarrisoned = true)const =0;
virtual const CGHeroInstance * getHeroInfo(int val, int mode=2)const =0; //mode = 0 -> val = serial; mode = 1 -> val = ID virtual const CGHeroInstance * getHeroInfo(int val, int mode=2)const =0; //mode = 0 -> val = serial; mode = 1 -> val = ID
@ -253,6 +259,8 @@ public:
bool getPath(int3 src, int3 dest, const CGHeroInstance * hero, CPath &ret); bool getPath(int3 src, int3 dest, const CGHeroInstance * hero, CPath &ret);
bool getHeroInfo(const CGObjectInstance *hero, InfoAboutHero &dest) const; bool getHeroInfo(const CGObjectInstance *hero, InfoAboutHero &dest) const;
bool getTownInfo(const CGObjectInstance *town, InfoAboutTown &dest) const; bool getTownInfo(const CGObjectInstance *town, InfoAboutTown &dest) const;
const CCreature * getCCreatureByID(int ID) const;
std::map<int, CBuilding *> getCBuildingsByID(const CGTownInstance * tn) const;
//battle //battle
int battleGetBattlefieldType(); // 1. sand/shore 2. sand/mesas 3. dirt/birches 4. dirt/hills 5. dirt/pines 6. grass/hills 7. grass/pines 8. lava 9. magic plains 10. snow/mountains 11. snow/trees 12. subterranean 13. swamp/trees 14. fiery fields 15. rock lands 16. magic clouds 17. lucid pools 18. holy ground 19. clover field 20. evil fog 21. "favourable winds" text on magic plains background 22. cursed ground 23. rough 24. ship to ship 25. ship int battleGetBattlefieldType(); // 1. sand/shore 2. sand/mesas 3. dirt/birches 4. dirt/hills 5. dirt/pines 6. grass/hills 7. grass/pines 8. lava 9. magic plains 10. snow/mountains 11. snow/trees 12. subterranean 13. swamp/trees 14. fiery fields 15. rock lands 16. magic clouds 17. lucid pools 18. holy ground 19. clover field 20. evil fog 21. "favourable winds" text on magic plains background 22. cursed ground 23. rough 24. ship to ship 25. ship