mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
4a8ae4ed9a
* new file in vcmi lib: IGameCallback.cpp
36 lines
930 B
C++
36 lines
930 B
C++
#define VCMI_DLL
|
|
#include "IGameCallback.h"
|
|
#include "../CGameState.h"
|
|
#include "../map.h"
|
|
#include "../hch/CObjectHandler.h"
|
|
|
|
const CGObjectInstance* IGameCallback::getObj(int objid)
|
|
{
|
|
return gs->map->objects[objid];
|
|
}
|
|
const CGHeroInstance* IGameCallback::getHero(int objid)
|
|
{
|
|
return dynamic_cast<const CGHeroInstance*>(gs->map->objects[objid]);
|
|
}
|
|
const CGTownInstance* IGameCallback::getTown(int objid)
|
|
{
|
|
return dynamic_cast<const CGTownInstance*>(gs->map->objects[objid]);
|
|
}
|
|
|
|
int IGameCallback::getOwner(int heroID)
|
|
{
|
|
return gs->map->objects[heroID]->tempOwner;
|
|
}
|
|
int IGameCallback::getResource(int player, int which)
|
|
{
|
|
return gs->players.find(player)->second.resources[which];
|
|
}
|
|
int IGameCallback::getDate(int mode)
|
|
{
|
|
return gs->getDate(mode);
|
|
}
|
|
|
|
const CGHeroInstance* IGameCallback::getSelectedHero( int player )
|
|
{
|
|
return getHero(gs->players.find(player)->second.currentSelection);
|
|
} |