IGameCallback.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #define VCMI_DLL
  2. #include "IGameCallback.h"
  3. #include "../CGameState.h"
  4. #include "../map.h"
  5. #include "../hch/CObjectHandler.h"
  6. #include "../StartInfo.h"
  7. const CGObjectInstance* IGameCallback::getObj(int objid)
  8. {
  9. return gs->map->objects[objid];
  10. }
  11. const CGHeroInstance* IGameCallback::getHero(int objid)
  12. {
  13. return dynamic_cast<const CGHeroInstance*>(gs->map->objects[objid]);
  14. }
  15. const CGTownInstance* IGameCallback::getTown(int objid)
  16. {
  17. return dynamic_cast<const CGTownInstance*>(gs->map->objects[objid]);
  18. }
  19. int IGameCallback::getOwner(int heroID)
  20. {
  21. return gs->map->objects[heroID]->tempOwner;
  22. }
  23. int IGameCallback::getResource(int player, int which)
  24. {
  25. return gs->players.find(player)->second.resources[which];
  26. }
  27. int IGameCallback::getDate(int mode)
  28. {
  29. return gs->getDate(mode);
  30. }
  31. const CGHeroInstance* IGameCallback::getSelectedHero( int player )
  32. {
  33. return getHero(gs->players.find(player)->second.currentSelection);
  34. }
  35. const PlayerSettings * IGameCallback::getPlayerSettings( int color )
  36. {
  37. return &gs->scenarioOps->getIthPlayersSettings(color);
  38. }