2008-12-27 03:01:59 +02:00
# ifndef __IGAMECALLBACK_H__
# define __IGAMECALLBACK_H__
# include "../global.h"
# include <vector>
# include <set>
# include "../client/FunctionList.h"
2009-02-04 15:40:54 +02:00
struct SetMovePoints ;
struct GiveBonus ;
2008-12-27 03:01:59 +02:00
class CGObjectInstance ;
class CGTownInstance ;
class CGHeroInstance ;
struct SelectionDialog ;
struct YesNoDialog ;
struct InfoWindow ;
struct MetaString ;
struct ShowInInfobox ;
struct BattleResult ;
class CGameState ;
2009-02-08 08:42:15 +02:00
struct PlayerSettings ;
2008-12-27 03:01:59 +02:00
class DLL_EXPORT IGameCallback
{
protected :
CGameState * gs ;
public :
virtual ~ IGameCallback ( ) { } ;
virtual int getOwner ( int heroID ) ;
virtual int getResource ( int player , int which ) ;
virtual int getDate ( int mode = 0 ) ;
virtual const CGObjectInstance * getObj ( int objid ) ;
virtual const CGHeroInstance * getHero ( int objid ) ;
virtual const CGTownInstance * getTown ( int objid ) ;
virtual const CGHeroInstance * getSelectedHero ( int player ) ; //NULL if no hero is selected
virtual int getCurrentPlayer ( ) = 0 ;
2009-02-08 08:42:15 +02:00
virtual int getSelectedHero ( ) = 0 ;
virtual const PlayerSettings * getPlayerSettings ( int color ) ;
2009-02-14 21:12:40 +02:00
virtual int getHeroCount ( int player , bool includeGarrisoned ) ;
2008-12-27 03:01:59 +02:00
//do sth
virtual void changeSpells ( int hid , bool give , const std : : set < ui32 > & spells ) = 0 ;
virtual void removeObject ( int objid ) = 0 ;
virtual void setBlockVis ( int objid , bool bv ) = 0 ;
virtual void setOwner ( int objid , ui8 owner ) = 0 ;
virtual void setHoverName ( int objid , MetaString * name ) = 0 ;
virtual void setObjProperty ( int objid , int prop , int val ) = 0 ;
virtual void changePrimSkill ( int ID , int which , int val , bool abs = false ) = 0 ;
2009-01-11 00:08:18 +02:00
virtual void changeSecSkill ( int ID , int which , int val , bool abs = false ) = 0 ;
2008-12-27 03:01:59 +02:00
virtual void showInfoDialog ( InfoWindow * iw ) = 0 ;
virtual void showYesNoDialog ( YesNoDialog * iw , const CFunctionList < void ( ui32 ) > & callback ) = 0 ;
virtual void showSelectionDialog ( SelectionDialog * iw , const CFunctionList < void ( ui32 ) > & callback ) = 0 ; //returns question id
virtual void giveResource ( int player , int which , int val ) = 0 ;
virtual void showCompInfo ( ShowInInfobox * comp ) = 0 ;
virtual void heroVisitCastle ( int obj , int heroID ) = 0 ;
virtual void stopHeroVisitCastle ( int obj , int heroID ) = 0 ;
virtual void giveHeroArtifact ( int artid , int hid , int position ) = 0 ; //pos==-1 - first free slot in backpack=0; pos==-2 - default if available or backpack
virtual void startBattleI ( const CCreatureSet * army1 , const CCreatureSet * army2 , int3 tile , const CGHeroInstance * hero1 , const CGHeroInstance * hero2 , boost : : function < void ( BattleResult * ) > cb ) = 0 ; //use hero=NULL for no hero
virtual void startBattleI ( int heroID , CCreatureSet army , int3 tile , boost : : function < void ( BattleResult * ) > cb ) = 0 ; //for hero<=>neutral army
virtual void setAmount ( int objid , ui32 val ) = 0 ;
virtual void moveHero ( int hid , int3 pos , bool instant ) = 0 ;
2009-02-04 15:40:54 +02:00
virtual void giveHeroBonus ( GiveBonus * bonus ) = 0 ;
virtual void setMovePoints ( SetMovePoints * smp ) = 0 ;
2009-02-06 13:15:39 +02:00
virtual void setManaPoints ( int hid , int val ) = 0 ;
2009-02-14 21:12:40 +02:00
virtual void giveHero ( int id , int player ) = 0 ;
2009-02-20 12:36:15 +02:00
virtual void changeObjPos ( int objid , int3 newPos , ui8 flags ) = 0 ;
2008-12-27 03:01:59 +02:00
} ;
# endif // __IGAMECALLBACK_H__