1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Merge CPrivilegedInfoCallback into CGameInfoCallback

This commit is contained in:
Ivan Savenko
2025-05-14 13:39:37 +03:00
parent b37a3dc63c
commit 6f20235d07
96 changed files with 345 additions and 384 deletions

View File

@@ -13,7 +13,7 @@
#include "../CCreatureHandler.h"
#include "../CPlayerState.h"
#include "../callback/CPrivilegedInfoCallback.h"
#include "../callback/CGameInfoCallback.h"
#include "../entities/faction/CFaction.h"
#include "../entities/faction/CTown.h"
#include "../entities/faction/CTownHandler.h"
@@ -41,12 +41,12 @@ void CArmedInstance::randomizeArmy(FactionID type)
}
}
CArmedInstance::CArmedInstance(CPrivilegedInfoCallback *cb)
CArmedInstance::CArmedInstance(CGameInfoCallback *cb)
:CArmedInstance(cb, false)
{
}
CArmedInstance::CArmedInstance(CPrivilegedInfoCallback *cb, bool isHypothetic):
CArmedInstance::CArmedInstance(CGameInfoCallback *cb, bool isHypothetic):
CGObjectInstance(cb),
CBonusSystemNode(isHypothetic),
nonEvilAlignmentMix(this, Selector::type()(BonusType::NONEVIL_ALIGNMENT_MIX)), // Take Angelic Alliance troop-mixing freedom of non-evil units into account.

View File

@@ -50,8 +50,8 @@ public:
void restoreBonusSystem(CGameState & gs) override;
//////////////////////////////////////////////////////////////////////////
CArmedInstance(CPrivilegedInfoCallback *cb);
CArmedInstance(CPrivilegedInfoCallback *cb, bool isHypothetic);
CArmedInstance(CGameInfoCallback *cb);
CArmedInstance(CGameInfoCallback *cb, bool isHypothetic);
PlayerColor getOwner() const override
{

View File

@@ -15,7 +15,7 @@
#include "../texts/CGeneralTextHandler.h"
#include "../CConfigHandler.h"
#include "../IGameSettings.h"
#include "../callback/CPrivilegedInfoCallback.h"
#include "../callback/CGameInfoCallback.h"
#include "../callback/IGameEventCallback.h"
#include "../gameState/CGameState.h"
#include "../mapObjectConstructors/CObjectClassesHandler.h"

View File

@@ -10,7 +10,7 @@
#include "StdInc.h"
#include "CGDwelling.h"
#include "../callback/CPrivilegedInfoCallback.h"
#include "../callback/CGameInfoCallback.h"
#include "../callback/IGameEventCallback.h"
#include "../serializer/JsonSerializeFormat.h"
#include "../entities/faction/CTownHandler.h"
@@ -47,7 +47,7 @@ void CGDwellingRandomizationInfo::serializeJson(JsonSerializeFormat & handler)
}
}
CGDwelling::CGDwelling(CPrivilegedInfoCallback *cb):
CGDwelling::CGDwelling(CGameInfoCallback *cb):
CArmedInstance(cb)
{}

View File

@@ -39,7 +39,7 @@ public:
std::optional<CGDwellingRandomizationInfo> randomizationInfo; //random dwelling options; not serialized
TCreaturesSet creatures; //creatures[level] -> <vector of alternative ids (base creature and upgrades, creatures amount>
CGDwelling(CPrivilegedInfoCallback *cb);
CGDwelling(CGameInfoCallback *cb);
~CGDwelling() override;
const IOwnableObject * asOwnable() const final;

View File

@@ -15,7 +15,7 @@
#include <vcmi/spells/Spell.h>
#include <vstd/RNG.h>
#include "../callback/CPrivilegedInfoCallback.h"
#include "../callback/CGameInfoCallback.h"
#include "../callback/IGameEventCallback.h"
#include "../texts/CGeneralTextHandler.h"
#include "../TerrainHandler.h"
@@ -254,7 +254,7 @@ int CGHeroInstance::movementPointsLimitCached(bool onLand, const TurnInfo * ti)
return ti->getMovePointsLimitWater();
}
CGHeroInstance::CGHeroInstance(CPrivilegedInfoCallback * cb)
CGHeroInstance::CGHeroInstance(CGameInfoCallback * cb)
: CArmedInstance(cb),
CArtifactSet(cb),
tacticFormationEnabled(false),

View File

@@ -72,7 +72,7 @@ class DLL_LINKAGE CGHeroInstance : public CArmedInstance, public IBoatGenerator,
ui32 movement; //remaining movement points
bool inTownGarrison; // if hero is in town garrison
CPrivilegedInfoCallback * getCallback() const final { return cb; }
CGameInfoCallback * getCallback() const final { return cb; }
public:
//////////////////////////////////////////////////////////////////////////
@@ -281,7 +281,7 @@ public:
/// If this hero perishes, the scenario is failed
bool isMissionCritical() const;
CGHeroInstance(CPrivilegedInfoCallback *cb);
CGHeroInstance(CGameInfoCallback *cb);
virtual ~CGHeroInstance();
PlayerColor getOwner() const override;

View File

@@ -11,7 +11,7 @@
#include "StdInc.h"
#include "CGMarket.h"
#include "../callback/CPrivilegedInfoCallback.h"
#include "../callback/CGameInfoCallback.h"
#include "../callback/IGameEventCallback.h"
#include "../texts/CGeneralTextHandler.h"
#include "../CCreatureHandler.h"
@@ -78,7 +78,7 @@ std::set<EMarketMode> CGMarket::availableModes() const
return getMarketHandler()->availableModes();
}
CGMarket::CGMarket(CPrivilegedInfoCallback *cb)
CGMarket::CGMarket(CGameInfoCallback *cb)
: CGObjectInstance(cb)
, IMarket(cb)
{}

View File

@@ -22,7 +22,7 @@ protected:
std::shared_ptr<MarketInstanceConstructor> getMarketHandler() const;
public:
CGMarket(CPrivilegedInfoCallback *cb);
CGMarket(CGameInfoCallback *cb);
///IObjectInterface
void onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance * h) const override; //open trading window
void initObj(vstd::RNG & rand) override;//set skills for trade

View File

@@ -14,7 +14,7 @@
#include "CGHeroInstance.h"
#include "ObjectTemplate.h"
#include "../callback/CPrivilegedInfoCallback.h"
#include "../callback/CGameInfoCallback.h"
#include "../callback/IGameEventCallback.h"
#include "../gameState/CGameState.h"
#include "../texts/CGeneralTextHandler.h"
@@ -31,7 +31,7 @@
VCMI_LIB_NAMESPACE_BEGIN
//TODO: remove constructor
CGObjectInstance::CGObjectInstance(CPrivilegedInfoCallback *cb):
CGObjectInstance::CGObjectInstance(CGameInfoCallback *cb):
IObjectInterface(cb),
pos(-1,-1,-1),
ID(Obj::NO_OBJ),

View File

@@ -45,7 +45,7 @@ public:
std::string instanceName;
CGObjectInstance(CPrivilegedInfoCallback *cb);
CGObjectInstance(CGameInfoCallback *cb);
~CGObjectInstance() override;
MapObjectID getObjGroupIndex() const override;

View File

@@ -18,7 +18,7 @@
#include "../CSkillHandler.h"
#include "../StartInfo.h"
#include "../callback/CPrivilegedInfoCallback.h"
#include "../callback/CGameInfoCallback.h"
#include "../callback/IGameEventCallback.h"
#include "../constants/StringConstants.h"
#include "../networkPacks/PacksForClient.h"

View File

@@ -11,7 +11,7 @@
#include "StdInc.h"
#include "CGResource.h"
#include "../callback/CPrivilegedInfoCallback.h"
#include "../callback/CGameInfoCallback.h"
#include "../callback/IGameEventCallback.h"
#include "../mapObjectConstructors/CommonConstructors.h"
#include "../texts/CGeneralTextHandler.h"

View File

@@ -24,7 +24,7 @@
#include "../CPlayerState.h"
#include "../StartInfo.h"
#include "../TerrainHandler.h"
#include "../callback/CPrivilegedInfoCallback.h"
#include "../callback/CGameInfoCallback.h"
#include "../callback/IGameEventCallback.h"
#include "../entities/building/CBuilding.h"
#include "../entities/faction/CTownHandler.h"
@@ -264,7 +264,7 @@ TownFortifications CGTownInstance::fortificationsLevel() const
return result;
}
CGTownInstance::CGTownInstance(CPrivilegedInfoCallback *cb):
CGTownInstance::CGTownInstance(CGameInfoCallback *cb):
CGDwelling(cb),
IMarket(cb),
built(0),

View File

@@ -207,7 +207,7 @@ public:
/// Returns true if provided war machine is available in any of built buildings of this town
bool isWarMachineAvailable(ArtifactID) const;
CGTownInstance(CPrivilegedInfoCallback *cb);
CGTownInstance(CGameInfoCallback *cb);
virtual ~CGTownInstance();
///IObjectInterface overrides

View File

@@ -17,7 +17,7 @@
#include "../texts/CGeneralTextHandler.h"
#include "CGCreature.h"
#include "../IGameSettings.h"
#include "../callback/CPrivilegedInfoCallback.h"
#include "../callback/CGameInfoCallback.h"
#include "../callback/IGameEventCallback.h"
#include "../entities/artifact/CArtifact.h"
#include "../entities/hero/CHeroHandler.h"

View File

@@ -14,7 +14,7 @@
#include "../CPlayerState.h"
#include "../IGameSettings.h"
#include "../battle/BattleLayout.h"
#include "../callback/CPrivilegedInfoCallback.h"
#include "../callback/CGameInfoCallback.h"
#include "../callback/IGameEventCallback.h"
#include "../gameState/CGameState.h"
#include "../mapObjectConstructors/AObjectTypeHandler.h"
@@ -355,7 +355,7 @@ void CRewardableObject::initObj(vstd::RNG & rand)
getObjectHandler()->configureObject(this, rand);
}
CRewardableObject::CRewardableObject(CPrivilegedInfoCallback *cb)
CRewardableObject::CRewardableObject(CGameInfoCallback *cb)
:CArmedInstance(cb)
{}

View File

@@ -77,7 +77,7 @@ public:
void setPropertyDer(ObjProperty what, ObjPropertyID identifier) override;
CRewardableObject(CPrivilegedInfoCallback *cb);
CRewardableObject(CGameInfoCallback *cb);
std::string getHoverText(PlayerColor player) const override;
std::string getHoverText(const CGHeroInstance * hero) const override;

View File

@@ -14,7 +14,7 @@
#include "CGHeroInstance.h"
#include "../CPlayerState.h"
#include "../callback/CPrivilegedInfoCallback.h"
#include "../callback/CGameInfoCallback.h"
#include "../callback/IGameEventCallback.h"
#include "../gameState/CGameState.h"
#include "../mapObjectConstructors/FlaggableInstanceConstructor.h"

View File

@@ -140,7 +140,7 @@ int IMarket::availableUnits(const EMarketMode mode, const int marketItemSerial)
}
}
IMarket::IMarket(CPrivilegedInfoCallback *cb)
IMarket::IMarket(CGameInfoCallback *cb)
:altarArtifactsStorage(std::make_unique<CArtifactSetAltar>(cb))
{
}

View File

@@ -18,19 +18,19 @@ VCMI_LIB_NAMESPACE_BEGIN
class DLL_LINKAGE IMarket : public virtual Serializeable, boost::noncopyable
{
public:
explicit IMarket(CPrivilegedInfoCallback *cb);
explicit IMarket(CGameInfoCallback *cb);
~IMarket();
class CArtifactSetAltar : public CArtifactSet
{
CPrivilegedInfoCallback *cb;
CGameInfoCallback *cb;
public:
CArtifactSetAltar(CPrivilegedInfoCallback *cb)
CArtifactSetAltar(CGameInfoCallback *cb)
: CArtifactSet(cb)
, cb(cb)
{}
CPrivilegedInfoCallback * getCallback() const override {return cb;};
CGameInfoCallback * getCallback() const override {return cb;};
ArtBearer bearerType() const override {return ArtBearer::ALTAR;};
};

View File

@@ -15,7 +15,7 @@
#include "MiscObjects.h"
#include "../TerrainHandler.h"
#include "../callback/CPrivilegedInfoCallback.h"
#include "../callback/CGameInfoCallback.h"
#include "../callback/IGameEventCallback.h"
#include "../mapObjects/CGHeroInstance.h"
#include "../networkPacks/PacksForClient.h"

View File

@@ -28,7 +28,7 @@ class BoatId;
class CGObjectInstance;
class CStackInstance;
class CGHeroInstance;
class CPrivilegedInfoCallback;
class CGameInfoCallback;
class IGameEventCallback;
class ResourceSet;
class int3;

View File

@@ -12,7 +12,7 @@
#include "MiscObjects.h"
#include "../bonuses/Propagators.h"
#include "../callback/CPrivilegedInfoCallback.h"
#include "../callback/CGameInfoCallback.h"
#include "../callback/IGameEventCallback.h"
#include "../constants/StringConstants.h"
#include "../entities/artifact/ArtifactUtils.h"
@@ -483,7 +483,7 @@ void CGSubterraneanGate::initObj(vstd::RNG & rand)
type = BOTH;
}
void CGSubterraneanGate::postInit(CPrivilegedInfoCallback * cb) //matches subterranean gates into pairs
void CGSubterraneanGate::postInit(CGameInfoCallback * cb) //matches subterranean gates into pairs
{
//split on underground and surface gates
std::vector<CGSubterraneanGate *> gatesSplit[2]; //surface and underground gates
@@ -986,7 +986,7 @@ void CGMagi::onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance *
}
}
CGBoat::CGBoat(CPrivilegedInfoCallback * cb)
CGBoat::CGBoat(CGameInfoCallback * cb)
: CGObjectInstance(cb)
{
direction = 4;

View File

@@ -257,7 +257,7 @@ class DLL_LINKAGE CGSubterraneanGate : public CGMonolith
public:
using CGMonolith::CGMonolith;
static void postInit(CPrivilegedInfoCallback * cb);
static void postInit(CGameInfoCallback * cb);
template <typename Handler> void serialize(Handler &h)
{
@@ -312,7 +312,7 @@ public:
AnimationPath overlayAnimation; //waves animations
std::array<AnimationPath, PlayerColor::PLAYER_LIMIT_I> flagAnimations;
CGBoat(CPrivilegedInfoCallback * cb);
CGBoat(CGameInfoCallback * cb);
bool isCoastVisitable() const override;
void setBoardedHero(const CGHeroInstance * hero);

View File

@@ -12,7 +12,7 @@
#include "TownBuildingInstance.h"
#include "CGTownInstance.h"
#include "../callback/CPrivilegedInfoCallback.h"
#include "../callback/CGameInfoCallback.h"
#include "../callback/IGameEventCallback.h"
#include "../mapObjects/CGHeroInstance.h"
#include "../entities/building/CBuilding.h"
@@ -21,7 +21,7 @@
VCMI_LIB_NAMESPACE_BEGIN
TownBuildingInstance::TownBuildingInstance(CPrivilegedInfoCallback * cb)
TownBuildingInstance::TownBuildingInstance(CGameInfoCallback * cb)
: IObjectInterface(cb)
, town(nullptr)
{}
@@ -62,7 +62,7 @@ int3 TownBuildingInstance::anchorPos() const
return town->anchorPos();
}
TownRewardableBuildingInstance::TownRewardableBuildingInstance(CPrivilegedInfoCallback *cb)
TownRewardableBuildingInstance::TownRewardableBuildingInstance(CGameInfoCallback *cb)
: TownBuildingInstance(cb)
{}

View File

@@ -23,7 +23,7 @@ class DLL_LINKAGE TownBuildingInstance : public IObjectInterface
///basic class for town structures handled as map objects
public:
TownBuildingInstance(CGTownInstance * town, const BuildingID & index);
TownBuildingInstance(CPrivilegedInfoCallback *cb);
TownBuildingInstance(CGameInfoCallback *cb);
CGTownInstance * town;
@@ -78,7 +78,7 @@ public:
void blockingDialogAnswered(IGameEventCallback & gameEvents, const CGHeroInstance *hero, int32_t answer) const override;
TownRewardableBuildingInstance(CGTownInstance * town, const BuildingID & index, vstd::RNG & rand);
TownRewardableBuildingInstance(CPrivilegedInfoCallback *cb);
TownRewardableBuildingInstance(CGameInfoCallback *cb);
template <typename Handler> void serialize(Handler &h)
{