1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Callback jugglery, part 1.

Fixed #252.
This commit is contained in:
Michał W. Urbańczyk
2011-05-03 03:14:18 +00:00
parent aca90abd38
commit b4144dc616
24 changed files with 1218 additions and 1216 deletions

View File

@@ -735,7 +735,7 @@ int CGameHandler::moveStack(int stack, THex dest)
CGameHandler::CGameHandler(void)
{
QID = 1;
gs = NULL;
//gs = NULL;
IObjectInterface::cb = this;
applier = new CApplier<CBaseForGHApply>;
registerTypes3(*applier);
@@ -1563,11 +1563,6 @@ ui32 CGameHandler::showBlockingDialog( BlockingDialog *iw )
return 0;
}
int CGameHandler::getCurrentPlayer()
{
return gs->currentPlayer;
}
void CGameHandler::giveResource(int player, int which, int val)
{
if(!val) return; //don't waste time on empty call
@@ -1710,11 +1705,6 @@ void CGameHandler::changeSpells( int hid, bool give, const std::set<ui32> &spell
sendAndApply(&cs);
}
int CGameHandler::getSelectedHero()
{
return IGameCallback::getSelectedHero(getCurrentPlayer())->id;
}
void CGameHandler::setObjProperty( int objid, int prop, si64 val )
{
SetObjectProperty sob;
@@ -2476,8 +2466,8 @@ bool CGameHandler::garrisonSwap( si32 tid )
// Function moves artifact from src to dst. If dst is not a backpack and is already occupied, old dst art goes to backpack and is replaced.
bool CGameHandler::moveArtifact(si32 srcHeroID, si32 destHeroID, ui16 srcSlot, ui16 destSlot)
{
CGHeroInstance *srcHero = gs->getHero(srcHeroID);
CGHeroInstance *destHero = gs->getHero(destHeroID);
const CGHeroInstance *srcHero = getHero(srcHeroID);
const CGHeroInstance *destHero = getHero(destHeroID);
ArtifactLocation src(srcHero, srcSlot), dst(destHero, destSlot);
// Make sure exchange is even possible between the two heroes.