2014-04-19 21:44:21 +04:00
/*
2014-04-20 12:58:58 +04:00
* CGameInfoCallback . h , part of VCMI engine
2014-04-19 21:44:21 +04: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 11:26:03 +03:00
# pragma once
2025-05-26 22:52:34 +02:00
# include "MapInfoCallback.h"
2023-08-30 22:07:02 +03:00
2022-07-26 16:07:42 +03:00
VCMI_LIB_NAMESPACE_BEGIN
2025-05-11 11:58:09 +03:00
struct SThievesGuildInfo ;
2025-05-14 15:50:13 +03:00
class Player ;
2025-05-14 13:39:37 +03:00
2025-05-26 22:52:34 +02:00
class DLL_LINKAGE CGameInfoCallback : public MapInfoCallback
2014-04-19 21:44:21 +04:00
{
protected :
2025-05-26 22:52:34 +02:00
const CMap * getMapConstPtr ( ) const override ;
2023-04-16 20:42:56 +03:00
bool hasAccess ( std : : optional < PlayerColor > playerId ) const ;
2014-04-19 21:44:21 +04:00
bool canGetFullInfo ( const CGObjectInstance * obj ) const ; //true we player owns obj or ally owns obj or privileged mode
public :
//various
2025-09-27 03:25:45 +02:00
2023-08-19 22:35:44 +03: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
2025-03-03 14:46:15 +00:00
const StartInfo * getStartInfo ( ) const override ;
2025-05-14 15:50:13 +03:00
const StartInfo * getInitialStartInfo ( ) const ;
2014-04-19 21:44:21 +04:00
//player
2025-09-27 03:25:45 +02:00
2025-05-14 15:50:13 +03:00
virtual std : : optional < PlayerColor > getPlayerID ( ) const ;
const Player * getPlayer ( PlayerColor color ) const ;
const PlayerState * getPlayerState ( PlayerColor color , bool verbose = true ) const override ;
int getResource ( PlayerColor Player , GameResID which ) const override ;
PlayerRelations getPlayerRelations ( PlayerColor color1 , PlayerColor color2 ) const override ;
void getThievesGuildInfo ( SThievesGuildInfo & thi , const CGObjectInstance * obj ) ;
EPlayerStatus getPlayerStatus ( PlayerColor player , bool verbose = true ) const override ;
bool isPlayerMakingTurn ( PlayerColor player ) const ;
const PlayerSettings * getPlayerSettings ( PlayerColor color ) const override ;
TurnTimerInfo getPlayerTurnTime ( PlayerColor color ) const ;
2014-04-19 21:44:21 +04:00
2022-12-07 21:50:45 +02:00
//map
2025-09-27 03:25:45 +02:00
2025-05-14 15:50:13 +03:00
bool isVisibleFor ( int3 pos , PlayerColor player ) const override ;
bool isVisibleFor ( const CGObjectInstance * obj , PlayerColor player ) const override ;
bool isVisible ( const CGObjectInstance * obj ) const ;
bool isVisible ( int3 pos ) const ;
2022-12-07 21:50:45 +02:00
2014-04-19 21:44:21 +04:00
//armed object
2025-09-27 03:25:45 +02:00
2025-05-14 15:50:13 +03:00
void fillUpgradeInfo ( const CArmedInstance * obj , SlotID stackPos , UpgradeInfo & out ) const ;
2014-04-19 21:44:21 +04:00
//hero
2025-09-27 03:25:45 +02:00
2025-05-14 15:50:13 +03:00
int getHeroCount ( PlayerColor player , bool includeGarrisoned ) const override ;
2025-05-27 18:38:44 +03:00
std : : vector < const CGHeroInstance * > getHeroes ( PlayerColor player ) const ;
2025-05-14 15:50:13 +03:00
bool getHeroInfo ( const CGObjectInstance * hero , InfoAboutHero & dest , const CGObjectInstance * selectedObject = nullptr ) const ;
int32_t getSpellCost ( const spells : : Spell * sp , const CGHeroInstance * caster ) const ;
int64_t estimateSpellDamage ( const CSpell * sp , const CGHeroInstance * hero ) const ;
const CArtifactSet * getArtSet ( const ArtifactLocation & loc ) const ;
2014-04-19 21:44:21 +04:00
//objects
2025-09-27 03:25:45 +02:00
const CGObjectInstance * getObj ( ObjectInstanceID objId , bool verbose = true ) const override ; // Get with some checks and visibility checks. Raw get is MapInfoCallback::getObjInstance
2025-05-14 15:50:13 +03:00
std : : vector < const CGObjectInstance * > getBlockingObjs ( int3 pos ) const ;
std : : vector < const CGObjectInstance * > getVisitableObjs ( int3 pos , bool verbose = true ) const ;
2025-03-03 13:49:54 +00:00
std : : vector < const CGObjectInstance * > getAllVisitableObjs ( ) const ;
2025-05-14 15:50:13 +03:00
std : : vector < const CGObjectInstance * > getFlaggableObjects ( int3 pos ) const ;
const CGObjectInstance * getTopObj ( int3 pos ) const override ;
const IMarket * getMarket ( ObjectInstanceID objid ) const ;
2014-04-19 21:44:21 +04:00
//map
2025-09-27 03:25:45 +02:00
2025-05-15 21:23:54 +03:00
int3 guardingCreaturePosition ( int3 pos ) const override ;
std : : vector < const CGObjectInstance * > getGuardingCreatures ( int3 pos ) const override ;
2025-07-13 17:25:26 +03:00
bool isTileGuardedUnchecked ( int3 tile ) const override ;
2025-05-14 15:50:13 +03:00
const TerrainTile * getTile ( int3 tile , bool verbose = true ) const override ;
const TerrainTile * getTileUnchecked ( int3 tile ) const override ;
2025-06-29 20:55:23 +03:00
void getVisibleTilesInRange ( FowTilesType & tiles , int3 pos , int radious , int3 : : EDistanceFormula distanceFormula = int3 : : DIST_2D ) const ;
2025-05-14 15:50:13 +03:00
void calculatePaths ( const std : : shared_ptr < PathfinderConfig > & config ) const override ;
EDiggingStatus getTileDigStatus ( int3 tile , bool verbose = true ) const override ;
2025-05-15 21:23:54 +03:00
bool checkForVisitableDir ( const int3 & src , const int3 & dst ) const override ;
2014-04-19 21:44:21 +04:00
//town
2025-09-27 03:25:45 +02:00
2025-05-14 15:50:13 +03:00
int howManyTowns ( PlayerColor Player ) const ;
std : : vector < const CGHeroInstance * > getAvailableHeroes ( const CGObjectInstance * townOrTavern ) const ;
std : : string getTavernRumor ( const CGObjectInstance * townOrTavern ) const ;
2025-05-20 20:38:13 +03:00
EBuildingState canBuildStructure ( const CGTownInstance * t , BuildingID ID ) const ;
2025-05-14 15:50:13 +03:00
bool getTownInfo ( const CGObjectInstance * town , InfoAboutTown & dest , const CGObjectInstance * selectedObject = nullptr ) const ;
2014-04-19 21:44:21 +04:00
//from gs
2025-09-27 03:25:45 +02:00
2025-05-14 15:50:13 +03:00
const TeamState * getTeam ( TeamID teamID ) const override ;
const TeamState * getPlayerTeam ( PlayerColor color ) const override ;
2015-03-08 16:21:14 +03:00
//teleport
2025-09-27 03:25:45 +02:00
2025-05-14 15:50:13 +03:00
std : : vector < ObjectInstanceID > getVisibleTeleportObjects ( std : : vector < ObjectInstanceID > ids , PlayerColor player ) const override ;
std : : vector < ObjectInstanceID > getTeleportChannelEntrances ( TeleportChannelID id , PlayerColor Player = PlayerColor : : UNFLAGGABLE ) const override ;
std : : vector < ObjectInstanceID > getTeleportChannelExits ( TeleportChannelID id , PlayerColor Player = PlayerColor : : UNFLAGGABLE ) const override ;
ETeleportChannelType getTeleportChannelType ( TeleportChannelID id , PlayerColor player = PlayerColor : : UNFLAGGABLE ) const ;
bool isTeleportChannelImpassable ( TeleportChannelID id , PlayerColor player = PlayerColor : : UNFLAGGABLE ) const override ;
bool isTeleportChannelBidirectional ( TeleportChannelID id , PlayerColor player = PlayerColor : : UNFLAGGABLE ) const override ;
bool isTeleportChannelUnidirectional ( TeleportChannelID id , PlayerColor player = PlayerColor : : UNFLAGGABLE ) const override ;
bool isTeleportEntrancePassable ( const CGTeleport * obj , PlayerColor player ) const override ;
2025-05-14 13:39:37 +03:00
//used for random spawns
2025-09-27 03:25:45 +02:00
2025-08-15 00:19:51 +02:00
void getFreeTiles ( std : : vector < int3 > & tiles , bool skipIfNearbyGuarded ) const ;
2025-06-29 20:55:23 +03:00
void getTilesInRange ( FowTilesType & tiles , const int3 & pos , int radius , ETileVisibility mode , std : : optional < PlayerColor > player = std : : optional < PlayerColor > ( ) , int3 : : EDistanceFormula formula = int3 : : DIST_2D ) const override ;
void getAllTiles ( FowTilesType & tiles , std : : optional < PlayerColor > player , int level , const std : : function < bool ( const TerrainTile * ) > & filter ) const override ;
2025-05-14 13:39:37 +03:00
2025-05-20 20:38:13 +03:00
void getAllowedSpells ( std : : vector < SpellID > & out , std : : optional < ui16 > level = std : : nullopt ) const ;
2025-05-14 13:39:37 +03:00
# if SCRIPTING_ENABLED
2025-05-14 15:50:13 +03:00
virtual scripting : : Pool * getGlobalContextPool ( ) const override ;
2025-05-14 13:39:37 +03:00
# endif
2014-04-19 21:44:21 +04:00
} ;
2022-07-26 16:07:42 +03:00
VCMI_LIB_NAMESPACE_END