2014-04-19 20:44:21 +03:00
/*
2014-04-20 11:58:58 +03:00
* CGameInfoCallback . h , part of VCMI engine
2014-04-19 20:44:21 +03:00
*
* Authors : listed in file AUTHORS in main folder
*
* License : GNU General Public License v2 .0 or later
* Full text of license available in license . txt file , in main folder
*
*/
2017-07-13 10:26:03 +02:00
# pragma once
2017-07-20 06:08:49 +02:00
# include "int3.h"
2023-04-05 02:26:29 +02:00
# include "ResourceSet.h" // for Res
2023-08-30 21:07:02 +02:00
# define ASSERT_IF_CALLED_WITH_PLAYER if(!getPlayerID()) {logGlobal->error(BOOST_CURRENT_FUNCTION); assert(0);}
2022-07-26 15:07:42 +02:00
VCMI_LIB_NAMESPACE_BEGIN
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
class Player ;
class Team ;
2014-04-19 20:44:21 +03:00
struct InfoWindow ;
struct PlayerSettings ;
struct CPackForClient ;
struct TerrainTile ;
2024-08-25 00:21:26 +02:00
class PlayerState ;
2014-04-19 20:44:21 +03:00
class CTown ;
struct StartInfo ;
2022-12-07 21:50:45 +02:00
struct CPathsInfo ;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
struct InfoAboutHero ;
2014-04-19 20:44:21 +03:00
struct InfoAboutTown ;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
2014-04-19 20:44:21 +03:00
struct UpgradeInfo ;
struct SThievesGuildInfo ;
class CMapHeader ;
struct TeamState ;
struct QuestInfo ;
2017-07-20 06:08:49 +02:00
class CGameState ;
2018-10-07 13:51:27 +02:00
class PathfinderConfig ;
2023-08-14 00:16:25 +02:00
struct TurnTimerInfo ;
2014-04-20 10:13:37 +03:00
2023-10-23 18:37:18 +02:00
struct ArtifactLocation ;
class CArtifactSet ;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
class CArmedInstance ;
class CGObjectInstance ;
class CGHeroInstance ;
class CGDwelling ;
class CGTeleport ;
class CGTownInstance ;
2024-08-20 16:15:50 +02:00
class IMarket ;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
2023-08-25 17:23:15 +02:00
class DLL_LINKAGE IGameInfoCallback : boost : : noncopyable
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
{
public :
//TODO: all other public methods of CGameInfoCallback
// //various
2023-08-19 21:35:44 +02:00
virtual int getDate ( Date mode = Date : : DAY ) const = 0 ; //mode=0 - total days in game, mode=1 - day of week, mode=2 - current week, mode=3 - current month
2024-08-21 21:18:26 +02:00
virtual const StartInfo * getStartInfo ( bool beforeRandomization = false ) const = 0 ;
2023-11-05 15:24:26 +02:00
virtual bool isAllowed ( SpellID id ) const = 0 ;
virtual bool isAllowed ( ArtifactID id ) const = 0 ;
virtual bool isAllowed ( SecondarySkill id ) const = 0 ;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
//player
2023-08-30 21:07:02 +02:00
virtual std : : optional < PlayerColor > getPlayerID ( ) const = 0 ;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
virtual const Player * getPlayer ( PlayerColor color ) const = 0 ;
2023-04-05 02:26:29 +02:00
// virtual int getResource(PlayerColor Player, EGameResID which) const = 0;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
// bool isVisible(int3 pos) const;
2023-08-19 20:43:50 +02:00
// PlayerRelations getPlayerRelations(PlayerColor color1, PlayerColor color2) const;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
// void getThievesGuildInfo(SThievesGuildInfo & thi, const CGObjectInstance * obj); //get thieves' guild info obtainable while visiting given object
2023-08-19 20:43:50 +02:00
// EPlayerStatus getPlayerStatus(PlayerColor player, bool verbose = true) const; //-1 if no such player
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
// const PlayerSettings * getPlayerSettings(PlayerColor color) const;
// //armed object
2022-12-25 14:03:43 +02:00
// void fillUpgradeInfo(const CArmedInstance *obj, SlotID stackPos, UpgradeInfo &out)const;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
//hero
virtual const CGHeroInstance * getHero ( ObjectInstanceID objid ) const = 0 ;
virtual const CGHeroInstance * getHeroWithSubid ( int subid ) const = 0 ;
// int getHeroCount(PlayerColor player, bool includeGarrisoned) const;
// bool getHeroInfo(const CGObjectInstance * hero, InfoAboutHero & dest, const CGObjectInstance * selectedObject = nullptr) const;
// int32_t getSpellCost(const spells::Spell * sp, const CGHeroInstance * caster) const; //when called during battle, takes into account creatures' spell cost reduction
// int64_t estimateSpellDamage(const CSpell * sp, const CGHeroInstance * hero) const; //estimates damage of given spell; returns 0 if spell causes no dmg
// const CArtifactInstance * getArtInstance(ArtifactInstanceID aid) const;
// const CGObjectInstance * getObjInstance(ObjectInstanceID oid) const;
// const CGObjectInstance * getArmyInstance(ObjectInstanceID oid) const;
//objects
virtual const CGObjectInstance * getObj ( ObjectInstanceID objid , bool verbose = true ) const = 0 ;
// std::vector <const CGObjectInstance * > getBlockingObjs(int3 pos) const;
virtual std : : vector < const CGObjectInstance * > getVisitableObjs ( int3 pos , bool verbose = true ) const = 0 ;
// std::vector <const CGObjectInstance * > getFlaggableObjects(int3 pos) const;
// const CGObjectInstance * getTopObj (int3 pos) const;
// PlayerColor getOwner(ObjectInstanceID heroID) const;
//map
// int3 guardingCreaturePosition (int3 pos) const;
// std::vector<const CGObjectInstance*> getGuardingCreatures (int3 pos) const;
// const CMapHeader * getMapHeader()const;
// int3 getMapSize() const; //returns size of map - z is 1 for one - level map and 2 for two level map
// const TerrainTile * getTile(int3 tile, bool verbose = true) const;
// std::shared_ptr<boost::multi_array<TerrainTile*, 3>> getAllVisibleTiles() const;
// bool isInTheMap(const int3 &pos) const;
//town
// const CGTownInstance* getTown(ObjectInstanceID objid) const;
// int howManyTowns(PlayerColor Player) const;
// const CGTownInstance * getTownInfo(int val, bool mode)const; //mode = 0 -> val = player town serial; mode = 1 -> val = object id (serial)
// std::vector<const CGHeroInstance *> getAvailableHeroes(const CGObjectInstance * townOrTavern) const; //heroes that can be recruited
// std::string getTavernRumor(const CGObjectInstance * townOrTavern) const;
2023-08-19 21:35:44 +02:00
// EBuildingState canBuildStructure(const CGTownInstance *t, BuildingID ID);//// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
// virtual bool getTownInfo(const CGObjectInstance * town, InfoAboutTown & dest, const CGObjectInstance * selectedObject = nullptr) const;
//from gs
// const TeamState *getTeam(TeamID teamID) const;
// const TeamState *getPlayerTeam(PlayerColor color) const;
2023-08-19 21:35:44 +02:00
// EBuildingState canBuildStructure(const CGTownInstance *t, BuildingID ID) const;// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
//teleport
// std::vector<ObjectInstanceID> getVisibleTeleportObjects(std::vector<ObjectInstanceID> ids, PlayerColor player) const;
2024-06-24 03:23:26 +02:00
// std::vector<ObjectInstanceID> getTeleportChannelEntrances(TeleportChannelID id, PlayerColor Player = PlayerColor::UNFLAGGABLE) const;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
// std::vector<ObjectInstanceID> getTeleportChannelExits(TeleportChannelID id, PlayerColor Player = PlayerColor::UNFLAGGABLE) const;
// ETeleportChannelType getTeleportChannelType(TeleportChannelID id, PlayerColor player = PlayerColor::UNFLAGGABLE) const;
// bool isTeleportChannelImpassable(TeleportChannelID id, PlayerColor player = PlayerColor::UNFLAGGABLE) const;
// bool isTeleportChannelBidirectional(TeleportChannelID id, PlayerColor player = PlayerColor::UNFLAGGABLE) const;
// bool isTeleportChannelUnidirectional(TeleportChannelID id, PlayerColor player = PlayerColor::UNFLAGGABLE) const;
// bool isTeleportEntrancePassable(const CGTeleport * obj, PlayerColor player) const;
} ;
2014-04-20 11:40:15 +03:00
2023-08-30 21:07:02 +02:00
class DLL_LINKAGE CGameInfoCallback : public IGameInfoCallback
2014-04-19 20:44:21 +03:00
{
protected :
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
CGameState * gs ; //todo: replace with protected const getter, only actual Server and Client objects should hold game state
2017-07-20 06:08:49 +02:00
2023-12-17 19:31:32 +02:00
CGameInfoCallback ( ) ;
2023-08-30 21:07:02 +02:00
CGameInfoCallback ( CGameState * GS ) ;
2023-04-16 19:42:56 +02:00
bool hasAccess ( std : : optional < PlayerColor > playerId ) const ;
2014-04-19 20:44:21 +03:00
bool canGetFullInfo ( const CGObjectInstance * obj ) const ; //true we player owns obj or ally owns obj or privileged mode
bool isOwnedOrVisited ( const CGObjectInstance * obj ) const ;
public :
//various
2023-08-19 21:35:44 +02:00
int getDate ( Date mode = Date : : DAY ) const override ; //mode=0 - total days in game, mode=1 - day of week, mode=2 - current week, mode=3 - current month
2024-08-21 21:18:26 +02:00
const StartInfo * getStartInfo ( bool beforeRandomization = false ) const override ;
2023-11-05 15:24:26 +02:00
bool isAllowed ( SpellID id ) const override ;
bool isAllowed ( ArtifactID id ) const override ;
bool isAllowed ( SecondarySkill id ) const override ;
2014-04-19 20:44:21 +03:00
//player
2023-08-30 21:07:02 +02:00
std : : optional < PlayerColor > getPlayerID ( ) const override ;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
const Player * getPlayer ( PlayerColor color ) const override ;
virtual const PlayerState * getPlayerState ( PlayerColor color , bool verbose = true ) const ;
2023-04-05 02:26:29 +02:00
virtual int getResource ( PlayerColor Player , GameResID which ) const ;
2023-08-19 20:43:50 +02:00
virtual PlayerRelations getPlayerRelations ( PlayerColor color1 , PlayerColor color2 ) const ;
2018-07-26 12:06:55 +02:00
virtual void getThievesGuildInfo ( SThievesGuildInfo & thi , const CGObjectInstance * obj ) ; //get thieves' guild info obtainable while visiting given object
2023-08-19 20:43:50 +02:00
virtual EPlayerStatus getPlayerStatus ( PlayerColor player , bool verbose = true ) const ; //-1 if no such player
2023-08-25 00:08:48 +02:00
virtual bool isPlayerMakingTurn ( PlayerColor player ) const ; //player that currently makes move // TODO synchronous turns
2018-07-26 12:06:55 +02:00
virtual const PlayerSettings * getPlayerSettings ( PlayerColor color ) const ;
2023-08-14 00:16:25 +02:00
virtual TurnTimerInfo getPlayerTurnTime ( PlayerColor color ) const ;
2014-04-19 20:44:21 +03:00
2022-12-07 21:50:45 +02:00
//map
2023-04-16 19:42:56 +02:00
virtual bool isVisible ( int3 pos , const std : : optional < PlayerColor > & Player ) const ;
virtual bool isVisible ( const CGObjectInstance * obj , const std : : optional < PlayerColor > & Player ) const ;
virtual bool isVisible ( const CGObjectInstance * obj ) const ;
2022-12-07 21:50:45 +02:00
virtual bool isVisible ( int3 pos ) const ;
2014-04-19 20:44:21 +03:00
//armed object
2022-12-25 14:03:43 +02:00
virtual void fillUpgradeInfo ( const CArmedInstance * obj , SlotID stackPos , UpgradeInfo & out ) const ;
2014-04-19 20:44:21 +03:00
//hero
2024-02-10 21:22:08 +02:00
const CGHeroInstance * getHero ( ObjectInstanceID objid ) const override ;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
const CGHeroInstance * getHeroWithSubid ( int subid ) const override ;
2018-07-26 12:06:55 +02:00
virtual int getHeroCount ( PlayerColor player , bool includeGarrisoned ) const ;
virtual bool getHeroInfo ( const CGObjectInstance * hero , InfoAboutHero & dest , const CGObjectInstance * selectedObject = nullptr ) const ;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
virtual int32_t getSpellCost ( const spells : : Spell * sp , const CGHeroInstance * caster ) const ; //when called during battle, takes into account creatures' spell cost reduction
2018-07-26 12:06:55 +02:00
virtual int64_t estimateSpellDamage ( const CSpell * sp , const CGHeroInstance * hero ) const ; //estimates damage of given spell; returns 0 if spell causes no dmg
virtual const CArtifactInstance * getArtInstance ( ArtifactInstanceID aid ) const ;
virtual const CGObjectInstance * getObjInstance ( ObjectInstanceID oid ) const ;
2024-02-01 10:43:16 +02:00
virtual const CArtifactSet * getArtSet ( const ArtifactLocation & loc ) const ;
2018-07-26 12:06:55 +02:00
//virtual const CGObjectInstance * getArmyInstance(ObjectInstanceID oid) const;
2014-04-19 20:44:21 +03:00
//objects
2024-02-10 21:22:08 +02:00
const CGObjectInstance * getObj ( ObjectInstanceID objid , bool verbose = true ) const override ;
2018-07-26 12:06:55 +02:00
virtual std : : vector < const CGObjectInstance * > getBlockingObjs ( int3 pos ) const ;
2024-02-13 16:21:30 +02:00
std : : vector < const CGObjectInstance * > getVisitableObjs ( int3 pos , bool verbose = true ) const override ;
2018-07-26 12:06:55 +02:00
virtual std : : vector < const CGObjectInstance * > getFlaggableObjects ( int3 pos ) const ;
virtual const CGObjectInstance * getTopObj ( int3 pos ) const ;
virtual PlayerColor getOwner ( ObjectInstanceID heroID ) const ;
2024-08-20 16:15:50 +02:00
virtual const IMarket * getMarket ( ObjectInstanceID objid ) const ;
2014-04-19 20:44:21 +03:00
//map
2018-07-26 12:06:55 +02:00
virtual int3 guardingCreaturePosition ( int3 pos ) const ;
virtual std : : vector < const CGObjectInstance * > getGuardingCreatures ( int3 pos ) const ;
2024-04-10 17:19:48 +02:00
virtual bool isTileGuardedUnchecked ( int3 tile ) const ;
2018-07-26 12:06:55 +02:00
virtual const CMapHeader * getMapHeader ( ) const ;
virtual int3 getMapSize ( ) const ; //returns size of map - z is 1 for one - level map and 2 for two level map
virtual const TerrainTile * getTile ( int3 tile , bool verbose = true ) const ;
2024-04-10 17:19:48 +02:00
virtual const TerrainTile * getTileUnchecked ( int3 tile ) const ;
2022-09-18 16:39:10 +02:00
virtual std : : shared_ptr < const boost : : multi_array < TerrainTile * , 3 > > getAllVisibleTiles ( ) const ;
2018-07-26 12:06:55 +02:00
virtual bool isInTheMap ( const int3 & pos ) const ;
2023-04-16 00:48:49 +02:00
virtual void getVisibleTilesInRange ( std : : unordered_set < int3 > & tiles , int3 pos , int radious , int3 : : EDistanceFormula distanceFormula = int3 : : DIST_2D ) const ;
2023-03-13 23:26:44 +02:00
virtual void calculatePaths ( const std : : shared_ptr < PathfinderConfig > & config ) ;
2022-12-07 21:50:45 +02:00
virtual void calculatePaths ( const CGHeroInstance * hero , CPathsInfo & out ) ;
2023-02-22 17:24:42 +02:00
virtual EDiggingStatus getTileDigStatus ( int3 tile , bool verbose = true ) const ;
2014-04-19 20:44:21 +03:00
//town
2018-07-26 12:06:55 +02:00
virtual const CGTownInstance * getTown ( ObjectInstanceID objid ) const ;
virtual int howManyTowns ( PlayerColor Player ) const ;
//virtual const CGTownInstance * getTownInfo(int val, bool mode)const; //mode = 0 -> val = player town serial; mode = 1 -> val = object id (serial)
virtual std : : vector < const CGHeroInstance * > getAvailableHeroes ( const CGObjectInstance * townOrTavern ) const ; //heroes that can be recruited
virtual std : : string getTavernRumor ( const CGObjectInstance * townOrTavern ) const ;
2023-08-19 21:35:44 +02:00
virtual EBuildingState canBuildStructure ( const CGTownInstance * t , BuildingID ID ) ; //// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
2015-02-06 16:36:09 +02:00
virtual bool getTownInfo ( const CGObjectInstance * town , InfoAboutTown & dest , const CGObjectInstance * selectedObject = nullptr ) const ;
2014-04-19 20:44:21 +03:00
//from gs
2018-07-26 12:06:55 +02:00
virtual const TeamState * getTeam ( TeamID teamID ) const ;
virtual const TeamState * getPlayerTeam ( PlayerColor color ) const ;
2023-08-19 21:35:44 +02:00
//virtual EBuildingState canBuildStructure(const CGTownInstance *t, BuildingID ID) const;// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
2015-03-08 15:21:14 +02:00
//teleport
2018-07-26 12:06:55 +02:00
virtual std : : vector < ObjectInstanceID > getVisibleTeleportObjects ( std : : vector < ObjectInstanceID > ids , PlayerColor player ) const ;
2024-06-24 03:23:26 +02:00
virtual std : : vector < ObjectInstanceID > getTeleportChannelEntrances ( TeleportChannelID id , PlayerColor Player = PlayerColor : : UNFLAGGABLE ) const ;
2018-07-26 12:06:55 +02:00
virtual std : : vector < ObjectInstanceID > getTeleportChannelExits ( TeleportChannelID id , PlayerColor Player = PlayerColor : : UNFLAGGABLE ) const ;
virtual ETeleportChannelType getTeleportChannelType ( TeleportChannelID id , PlayerColor player = PlayerColor : : UNFLAGGABLE ) const ;
virtual bool isTeleportChannelImpassable ( TeleportChannelID id , PlayerColor player = PlayerColor : : UNFLAGGABLE ) const ;
virtual bool isTeleportChannelBidirectional ( TeleportChannelID id , PlayerColor player = PlayerColor : : UNFLAGGABLE ) const ;
virtual bool isTeleportChannelUnidirectional ( TeleportChannelID id , PlayerColor player = PlayerColor : : UNFLAGGABLE ) const ;
virtual bool isTeleportEntrancePassable ( const CGTeleport * obj , PlayerColor player ) const ;
2014-04-19 20:44:21 +03:00
} ;
class DLL_LINKAGE CPlayerSpecificInfoCallback : public CGameInfoCallback
{
public :
2022-12-07 21:50:45 +02:00
// keep player-specific override in scope
using CGameInfoCallback : : howManyTowns ;
2018-07-26 12:06:55 +02:00
virtual int howManyTowns ( ) const ;
virtual int howManyHeroes ( bool includeGarrisoned = true ) const ;
virtual int3 getGrailPos ( double * outKnownRatio ) ;
virtual std : : vector < const CGTownInstance * > getTownsInfo ( bool onlyOur = true ) const ; //true -> only owned; false -> all visible
virtual int getHeroSerial ( const CGHeroInstance * hero , bool includeGarrisoned = true ) const ;
virtual const CGTownInstance * getTownBySerial ( int serialId ) const ; // serial id is [0, number of towns)
virtual const CGHeroInstance * getHeroBySerial ( int serialId , bool includeGarrisoned = true ) const ; // serial id is [0, number of heroes)
virtual std : : vector < const CGHeroInstance * > getHeroesInfo ( bool onlyOur = true ) const ; //true -> only owned; false -> all visible
virtual std : : vector < const CGObjectInstance * > getMyObjects ( ) const ; //returns all objects flagged by belonging player
virtual std : : vector < QuestInfo > getMyQuests ( ) const ;
2023-04-05 02:26:29 +02:00
virtual int getResourceAmount ( GameResID type ) const ;
2018-07-26 12:06:55 +02:00
virtual TResources getResourceAmount ( ) const ;
2014-04-19 20:44:21 +03:00
} ;
2022-07-26 15:07:42 +02:00
VCMI_LIB_NAMESPACE_END