mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Merge CPrivilegedInfoCallback into CGameInfoCallback
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
#include "../Goals/Goals.h"
|
#include "../Goals/Goals.h"
|
||||||
#include "../AIGateway.h"
|
#include "../AIGateway.h"
|
||||||
#include "../Engine/Nullkiller.h"
|
#include "../Engine/Nullkiller.h"
|
||||||
#include "../../../lib/callback/CPrivilegedInfoCallback.h"
|
#include "../../../lib/callback/CGameInfoCallback.h"
|
||||||
#include "../../../lib/mapping/CMap.h"
|
#include "../../../lib/mapping/CMap.h"
|
||||||
#include "../../../lib/mapObjects/MapObjects.h"
|
#include "../../../lib/mapObjects/MapObjects.h"
|
||||||
#include "../../../lib/pathfinder/CPathfinder.h"
|
#include "../../../lib/pathfinder/CPathfinder.h"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "AINodeStorage.h"
|
#include "AINodeStorage.h"
|
||||||
#include "Actions/TownPortalAction.h"
|
#include "Actions/TownPortalAction.h"
|
||||||
#include "../Goals/Goals.h"
|
#include "../Goals/Goals.h"
|
||||||
#include "../../../lib/callback/CPrivilegedInfoCallback.h"
|
#include "../../../lib/callback/CGameInfoCallback.h"
|
||||||
#include "../../../lib/mapping/CMap.h"
|
#include "../../../lib/mapping/CMap.h"
|
||||||
#include "../../../lib/mapObjects/MapObjects.h"
|
#include "../../../lib/mapObjects/MapObjects.h"
|
||||||
#include "../../../lib/pathfinder/CPathfinder.h"
|
#include "../../../lib/pathfinder/CPathfinder.h"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#include <vcmi/Environment.h>
|
#include <vcmi/Environment.h>
|
||||||
|
|
||||||
#include "../lib/callback/IClient.h"
|
#include "../lib/callback/IClient.h"
|
||||||
#include "../lib/callback/CPrivilegedInfoCallback.h"
|
#include "../lib/callback/CGameInfoCallback.h"
|
||||||
#include "../lib/ConditionalWait.h"
|
#include "../lib/ConditionalWait.h"
|
||||||
#include "../lib/ResourceSet.h"
|
#include "../lib/ResourceSet.h"
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Class which handles client - server logic
|
/// Class which handles client - server logic
|
||||||
class CClient : public CPrivilegedInfoCallback, public Environment, public IClient
|
class CClient : public CGameInfoCallback, public Environment, public IClient
|
||||||
{
|
{
|
||||||
std::shared_ptr<CGameState> gamestate;
|
std::shared_ptr<CGameState> gamestate;
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "CCreatureHandler.h"
|
#include "CCreatureHandler.h"
|
||||||
#include "GameLibrary.h"
|
#include "GameLibrary.h"
|
||||||
#include "IGameSettings.h"
|
#include "IGameSettings.h"
|
||||||
#include "callback/CPrivilegedInfoCallback.h"
|
#include "callback/CGameInfoCallback.h"
|
||||||
#include "entities/hero/CHeroHandler.h"
|
#include "entities/hero/CHeroHandler.h"
|
||||||
#include "mapObjects/CGHeroInstance.h"
|
#include "mapObjects/CGHeroInstance.h"
|
||||||
#include "modding/ModScope.h"
|
#include "modding/ModScope.h"
|
||||||
@@ -707,7 +707,7 @@ void CCreatureSet::serializeJson(JsonSerializeFormat & handler, const std::strin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CStackInstance::CStackInstance(CPrivilegedInfoCallback *cb, bool isHypothetic)
|
CStackInstance::CStackInstance(CGameInfoCallback *cb, bool isHypothetic)
|
||||||
: CBonusSystemNode(isHypothetic)
|
: CBonusSystemNode(isHypothetic)
|
||||||
, CStackBasicDescriptor(nullptr, 0)
|
, CStackBasicDescriptor(nullptr, 0)
|
||||||
, CArtifactSet(cb)
|
, CArtifactSet(cb)
|
||||||
@@ -719,7 +719,7 @@ CStackInstance::CStackInstance(CPrivilegedInfoCallback *cb, bool isHypothetic)
|
|||||||
setNodeType(STACK_INSTANCE);
|
setNodeType(STACK_INSTANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
CStackInstance::CStackInstance(CPrivilegedInfoCallback *cb, const CreatureID & id, TQuantity Count, bool isHypothetic)
|
CStackInstance::CStackInstance(CGameInfoCallback *cb, const CreatureID & id, TQuantity Count, bool isHypothetic)
|
||||||
: CStackInstance(cb, false)
|
: CStackInstance(cb, false)
|
||||||
{
|
{
|
||||||
setType(id);
|
setType(id);
|
||||||
@@ -1034,11 +1034,11 @@ const IBonusBearer* CStackInstance::getBonusBearer() const
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
CCommanderInstance::CCommanderInstance(CPrivilegedInfoCallback *cb)
|
CCommanderInstance::CCommanderInstance(CGameInfoCallback *cb)
|
||||||
:CStackInstance(cb)
|
:CStackInstance(cb)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
CCommanderInstance::CCommanderInstance(CPrivilegedInfoCallback *cb, const CreatureID & id)
|
CCommanderInstance::CCommanderInstance(CGameInfoCallback *cb, const CreatureID & id)
|
||||||
: CStackInstance(cb)
|
: CStackInstance(cb)
|
||||||
, name("Commando")
|
, name("Commando")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class DLL_LINKAGE CStackInstance : public CBonusSystemNode, public CStackBasicDe
|
|||||||
|
|
||||||
CArmedInstance * armyInstance = nullptr; //stack must be part of some army, army must be part of some object
|
CArmedInstance * armyInstance = nullptr; //stack must be part of some army, army must be part of some object
|
||||||
|
|
||||||
CPrivilegedInfoCallback * getCallback() const final { return cb; }
|
CGameInfoCallback * getCallback() const final { return cb; }
|
||||||
|
|
||||||
TExpType totalExperience;//commander needs same amount of exp as hero
|
TExpType totalExperience;//commander needs same amount of exp as hero
|
||||||
public:
|
public:
|
||||||
@@ -146,8 +146,8 @@ public:
|
|||||||
virtual int getLevel() const; //different for regular stack and commander
|
virtual int getLevel() const; //different for regular stack and commander
|
||||||
CreatureID getCreatureID() const; //-1 if not available
|
CreatureID getCreatureID() const; //-1 if not available
|
||||||
std::string getName() const; //plural or singular
|
std::string getName() const; //plural or singular
|
||||||
CStackInstance(CPrivilegedInfoCallback *cb, bool isHypothetic = false);
|
CStackInstance(CGameInfoCallback *cb, bool isHypothetic = false);
|
||||||
CStackInstance(CPrivilegedInfoCallback *cb, const CreatureID & id, TQuantity count, bool isHypothetic = false);
|
CStackInstance(CGameInfoCallback *cb, const CreatureID & id, TQuantity count, bool isHypothetic = false);
|
||||||
virtual ~CStackInstance() = default;
|
virtual ~CStackInstance() = default;
|
||||||
|
|
||||||
void setType(const CreatureID & creID);
|
void setType(const CreatureID & creID);
|
||||||
@@ -182,8 +182,8 @@ public:
|
|||||||
std::vector <ui8> secondarySkills; //ID -> level
|
std::vector <ui8> secondarySkills; //ID -> level
|
||||||
std::set <ui8> specialSkills;
|
std::set <ui8> specialSkills;
|
||||||
//std::vector <CArtifactInstance *> arts;
|
//std::vector <CArtifactInstance *> arts;
|
||||||
CCommanderInstance(CPrivilegedInfoCallback *cb);
|
CCommanderInstance(CGameInfoCallback *cb);
|
||||||
CCommanderInstance(CPrivilegedInfoCallback *cb, const CreatureID & id);
|
CCommanderInstance(CGameInfoCallback *cb, const CreatureID & id);
|
||||||
void setAlive (bool alive);
|
void setAlive (bool alive);
|
||||||
void levelUp ();
|
void levelUp ();
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ set(lib_MAIN_SRCS
|
|||||||
callback/CGameInfoCallback.cpp
|
callback/CGameInfoCallback.cpp
|
||||||
callback/CNonConstInfoCallback.cpp
|
callback/CNonConstInfoCallback.cpp
|
||||||
callback/CPlayerSpecificInfoCallback.cpp
|
callback/CPlayerSpecificInfoCallback.cpp
|
||||||
callback/CPrivilegedInfoCallback.cpp
|
|
||||||
|
|
||||||
campaign/CampaignHandler.cpp
|
campaign/CampaignHandler.cpp
|
||||||
campaign/CampaignState.cpp
|
campaign/CampaignState.cpp
|
||||||
@@ -469,13 +468,12 @@ set(lib_MAIN_HEADERS
|
|||||||
callback/CGlobalAI.h
|
callback/CGlobalAI.h
|
||||||
callback/CNonConstInfoCallback.h
|
callback/CNonConstInfoCallback.h
|
||||||
callback/CPlayerSpecificInfoCallback.h
|
callback/CPlayerSpecificInfoCallback.h
|
||||||
callback/CPrivilegedInfoCallback.h
|
|
||||||
callback/GameCallbackHolder.h
|
callback/GameCallbackHolder.h
|
||||||
callback/IBattleCallback.h
|
callback/IBattleCallback.h
|
||||||
callback/IBattleEventsReceiver.h
|
callback/IBattleEventsReceiver.h
|
||||||
callback/IClient.h
|
callback/IClient.h
|
||||||
callback/IGameActionCallback.h
|
callback/IGameActionCallback.h
|
||||||
callback/CPrivilegedInfoCallback.h
|
callback/CGameInfoCallback.h
|
||||||
callback/IGameEventCallback.h
|
callback/IGameEventCallback.h
|
||||||
callback/IGameEventsReceiver.h
|
callback/IGameEventsReceiver.h
|
||||||
callback/IGameInfoCallback.h
|
callback/IGameInfoCallback.h
|
||||||
@@ -831,7 +829,7 @@ endif()
|
|||||||
if(MINGW AND CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if(MINGW AND CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
set_source_files_properties(
|
set_source_files_properties(
|
||||||
serializer/SerializerReflection.cpp
|
serializer/SerializerReflection.cpp
|
||||||
CPrivilegedInfoCallback.cpp
|
CGameInfoCallback.cpp
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
COMPILE_OPTIONS "-Wa,-mbig-obj")
|
COMPILE_OPTIONS "-Wa,-mbig-obj")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include "CPlayerState.h"
|
#include "CPlayerState.h"
|
||||||
#include "GameLibrary.h"
|
#include "GameLibrary.h"
|
||||||
#include "callback/CPrivilegedInfoCallback.h"
|
#include "callback/CGameInfoCallback.h"
|
||||||
#include "mapObjects/CGHeroInstance.h"
|
#include "mapObjects/CGHeroInstance.h"
|
||||||
#include "mapObjects/CGTownInstance.h"
|
#include "mapObjects/CGTownInstance.h"
|
||||||
#include "gameState/CGameState.h"
|
#include "gameState/CGameState.h"
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
PlayerState::PlayerState(CPrivilegedInfoCallback *cb)
|
PlayerState::PlayerState(CGameInfoCallback *cb)
|
||||||
: CBonusSystemNode(PLAYER)
|
: CBonusSystemNode(PLAYER)
|
||||||
, GameCallbackHolder(cb)
|
, GameCallbackHolder(cb)
|
||||||
, color(-1)
|
, color(-1)
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public:
|
|||||||
std::optional<ui8> daysWithoutCastle;
|
std::optional<ui8> daysWithoutCastle;
|
||||||
TurnTimerInfo turnTimer;
|
TurnTimerInfo turnTimer;
|
||||||
|
|
||||||
PlayerState(CPrivilegedInfoCallback *cb);
|
PlayerState(CGameInfoCallback *cb);
|
||||||
~PlayerState();
|
~PlayerState();
|
||||||
|
|
||||||
std::string nodeName() const override;
|
std::string nodeName() const override;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "bonuses/Limiters.h"
|
#include "bonuses/Limiters.h"
|
||||||
#include "bonuses/Updaters.h"
|
#include "bonuses/Updaters.h"
|
||||||
#include "../CStack.h"
|
#include "../CStack.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../entities/artifact/CArtifact.h"
|
#include "../entities/artifact/CArtifact.h"
|
||||||
#include "../entities/building/TownFortifications.h"
|
#include "../entities/building/TownFortifications.h"
|
||||||
#include "../filesystem/Filesystem.h"
|
#include "../filesystem/Filesystem.h"
|
||||||
@@ -156,7 +156,7 @@ struct RangeGenerator
|
|||||||
std::function<int()> myRand;
|
std::function<int()> myRand;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<BattleInfo> BattleInfo::setupBattle(CPrivilegedInfoCallback *cb, const int3 & tile, TerrainId terrain, const BattleField & battlefieldType, BattleSideArray<const CArmedInstance *> armies, BattleSideArray<const CGHeroInstance *> heroes, const BattleLayout & layout, const CGTownInstance * town)
|
std::unique_ptr<BattleInfo> BattleInfo::setupBattle(CGameInfoCallback *cb, const int3 & tile, TerrainId terrain, const BattleField & battlefieldType, BattleSideArray<const CArmedInstance *> armies, BattleSideArray<const CGHeroInstance *> heroes, const BattleLayout & layout, const CGTownInstance * town)
|
||||||
{
|
{
|
||||||
CMP_stack cmpst;
|
CMP_stack cmpst;
|
||||||
auto currentBattle = std::make_unique<BattleInfo>(cb, layout);
|
auto currentBattle = std::make_unique<BattleInfo>(cb, layout);
|
||||||
@@ -458,13 +458,13 @@ CStack * BattleInfo::getStack(int stackID, bool onlyAlive)
|
|||||||
return const_cast<CStack *>(battleGetStackByID(stackID, onlyAlive));
|
return const_cast<CStack *>(battleGetStackByID(stackID, onlyAlive));
|
||||||
}
|
}
|
||||||
|
|
||||||
BattleInfo::BattleInfo(CPrivilegedInfoCallback *cb, const BattleLayout & layout):
|
BattleInfo::BattleInfo(CGameInfoCallback *cb, const BattleLayout & layout):
|
||||||
BattleInfo(cb)
|
BattleInfo(cb)
|
||||||
{
|
{
|
||||||
*this->layout = layout;
|
*this->layout = layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
BattleInfo::BattleInfo(CPrivilegedInfoCallback *cb)
|
BattleInfo::BattleInfo(CGameInfoCallback *cb)
|
||||||
:GameCallbackHolder(cb),
|
:GameCallbackHolder(cb),
|
||||||
sides({SideInBattle(cb), SideInBattle(cb)}),
|
sides({SideInBattle(cb), SideInBattle(cb)}),
|
||||||
layout(std::make_unique<BattleLayout>()),
|
layout(std::make_unique<BattleLayout>()),
|
||||||
|
|||||||
@@ -74,8 +74,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
BattleInfo(CPrivilegedInfoCallback *cb, const BattleLayout & layout);
|
BattleInfo(CGameInfoCallback *cb, const BattleLayout & layout);
|
||||||
BattleInfo(CPrivilegedInfoCallback *cb);
|
BattleInfo(CGameInfoCallback *cb);
|
||||||
virtual ~BattleInfo();
|
virtual ~BattleInfo();
|
||||||
|
|
||||||
const IBattleInfo * getBattle() const override;
|
const IBattleInfo * getBattle() const override;
|
||||||
@@ -164,7 +164,7 @@ public:
|
|||||||
const CGHeroInstance * getHero(const PlayerColor & player) const; //returns fighting hero that belongs to given player
|
const CGHeroInstance * getHero(const PlayerColor & player) const; //returns fighting hero that belongs to given player
|
||||||
|
|
||||||
void localInit();
|
void localInit();
|
||||||
static std::unique_ptr<BattleInfo> setupBattle(CPrivilegedInfoCallback *cb, const int3 & tile, TerrainId, const BattleField & battlefieldType, BattleSideArray<const CArmedInstance *> armies, BattleSideArray<const CGHeroInstance *> heroes, const BattleLayout & layout, const CGTownInstance * town);
|
static std::unique_ptr<BattleInfo> setupBattle(CGameInfoCallback *cb, const int3 & tile, TerrainId, const BattleField & battlefieldType, BattleSideArray<const CArmedInstance *> armies, BattleSideArray<const CGHeroInstance *> heroes, const BattleLayout & layout, const CGTownInstance * town);
|
||||||
|
|
||||||
BattleSide whatSide(const PlayerColor & player) const;
|
BattleSide whatSide(const PlayerColor & player) const;
|
||||||
|
|
||||||
|
|||||||
@@ -12,18 +12,18 @@
|
|||||||
|
|
||||||
#include "../GameSettings.h"
|
#include "../GameSettings.h"
|
||||||
#include "../GameLibrary.h"
|
#include "../GameLibrary.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../json/JsonNode.h"
|
#include "../json/JsonNode.h"
|
||||||
#include "../mapObjects/CArmedInstance.h"
|
#include "../mapObjects/CArmedInstance.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
BattleLayout BattleLayout::createDefaultLayout(CPrivilegedInfoCallback * cb, const CArmedInstance * attacker, const CArmedInstance * defender)
|
BattleLayout BattleLayout::createDefaultLayout(CGameInfoCallback * cb, const CArmedInstance * attacker, const CArmedInstance * defender)
|
||||||
{
|
{
|
||||||
return createLayout(cb, "default", attacker, defender);
|
return createLayout(cb, "default", attacker, defender);
|
||||||
}
|
}
|
||||||
|
|
||||||
BattleLayout BattleLayout::createLayout(CPrivilegedInfoCallback * cb, const std::string & layoutName, const CArmedInstance * attacker, const CArmedInstance * defender)
|
BattleLayout BattleLayout::createLayout(CGameInfoCallback * cb, const std::string & layoutName, const CArmedInstance * attacker, const CArmedInstance * defender)
|
||||||
{
|
{
|
||||||
const auto & loadHex = [](const JsonNode & node)
|
const auto & loadHex = [](const JsonNode & node)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
class CArmedInstance;
|
class CArmedInstance;
|
||||||
class CPrivilegedInfoCallback;
|
class CGameInfoCallback;
|
||||||
|
|
||||||
struct DLL_EXPORT BattleLayout
|
struct DLL_EXPORT BattleLayout
|
||||||
{
|
{
|
||||||
@@ -32,8 +32,8 @@ struct DLL_EXPORT BattleLayout
|
|||||||
bool tacticsAllowed = false;
|
bool tacticsAllowed = false;
|
||||||
bool obstaclesAllowed = false;
|
bool obstaclesAllowed = false;
|
||||||
|
|
||||||
static BattleLayout createDefaultLayout(CPrivilegedInfoCallback * cb, const CArmedInstance * attacker, const CArmedInstance * defender);
|
static BattleLayout createDefaultLayout(CGameInfoCallback * cb, const CArmedInstance * attacker, const CArmedInstance * defender);
|
||||||
static BattleLayout createLayout(CPrivilegedInfoCallback * cb, const std::string & layoutName, const CArmedInstance * attacker, const CArmedInstance * defender);
|
static BattleLayout createLayout(CGameInfoCallback * cb, const std::string & layoutName, const CArmedInstance * attacker, const CArmedInstance * defender);
|
||||||
};
|
};
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "StdInc.h"
|
#include "StdInc.h"
|
||||||
#include "SideInBattle.h"
|
#include "SideInBattle.h"
|
||||||
|
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../mapObjects/CGHeroInstance.h"
|
#include "../mapObjects/CGHeroInstance.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|||||||
@@ -832,4 +832,130 @@ bool CGameInfoCallback::isTeleportEntrancePassable(const CGTeleport * obj, Playe
|
|||||||
return obj && obj->isEntrance() && !isTeleportChannelImpassable(obj->channel, player);
|
return obj && obj->isEntrance() && !isTeleportChannelImpassable(obj->channel, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGameInfoCallback::getFreeTiles(std::vector<int3> & tiles) const
|
||||||
|
{
|
||||||
|
std::vector<int> floors;
|
||||||
|
floors.reserve(gameState().getMap().levels());
|
||||||
|
for(int b = 0; b < gameState().getMap().levels(); ++b)
|
||||||
|
{
|
||||||
|
floors.push_back(b);
|
||||||
|
}
|
||||||
|
const TerrainTile * tinfo = nullptr;
|
||||||
|
for (auto zd : floors)
|
||||||
|
{
|
||||||
|
for (int xd = 0; xd < gameState().getMap().width; xd++)
|
||||||
|
{
|
||||||
|
for (int yd = 0; yd < gameState().getMap().height; yd++)
|
||||||
|
{
|
||||||
|
tinfo = getTile(int3 (xd,yd,zd));
|
||||||
|
if (tinfo->isLand() && tinfo->getTerrain()->isPassable() && !tinfo->blocked()) //land and free
|
||||||
|
tiles.emplace_back(xd, yd, zd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameInfoCallback::getTilesInRange(std::unordered_set<int3> & tiles,
|
||||||
|
const int3 & pos,
|
||||||
|
int radious,
|
||||||
|
ETileVisibility mode,
|
||||||
|
std::optional<PlayerColor> player,
|
||||||
|
int3::EDistanceFormula distanceFormula) const
|
||||||
|
{
|
||||||
|
if(player.has_value() && !player->isValidPlayer())
|
||||||
|
{
|
||||||
|
logGlobal->error("Illegal call to getTilesInRange!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(radious == CBuilding::HEIGHT_SKYSHIP) //reveal entire map
|
||||||
|
getAllTiles (tiles, player, -1, [](auto * tile){return true;});
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const TeamState * team = !player ? nullptr : gameState().getPlayerTeam(*player);
|
||||||
|
for (int xd = std::max<int>(pos.x - radious , 0); xd <= std::min<int>(pos.x + radious, gameState().getMap().width - 1); xd++)
|
||||||
|
{
|
||||||
|
for (int yd = std::max<int>(pos.y - radious, 0); yd <= std::min<int>(pos.y + radious, gameState().getMap().height - 1); yd++)
|
||||||
|
{
|
||||||
|
int3 tilePos(xd,yd,pos.z);
|
||||||
|
int distance = pos.dist(tilePos, distanceFormula);
|
||||||
|
|
||||||
|
if(distance <= radious)
|
||||||
|
{
|
||||||
|
if(!player
|
||||||
|
|| (mode == ETileVisibility::HIDDEN && team->fogOfWarMap[pos.z][xd][yd] == 0)
|
||||||
|
|| (mode == ETileVisibility::REVEALED && team->fogOfWarMap[pos.z][xd][yd] == 1)
|
||||||
|
)
|
||||||
|
tiles.insert(int3(xd,yd,pos.z));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameInfoCallback::getAllTiles(std::unordered_set<int3> & tiles, std::optional<PlayerColor> Player, int level, std::function<bool(const TerrainTile *)> filter) const
|
||||||
|
{
|
||||||
|
if(Player.has_value() && !Player->isValidPlayer())
|
||||||
|
{
|
||||||
|
logGlobal->error("Illegal call to getAllTiles !");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<int> floors;
|
||||||
|
if(level == -1)
|
||||||
|
{
|
||||||
|
for(int b = 0; b < gameState().getMap().levels(); ++b)
|
||||||
|
{
|
||||||
|
floors.push_back(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
floors.push_back(level);
|
||||||
|
|
||||||
|
for(auto zd: floors)
|
||||||
|
{
|
||||||
|
for(int xd = 0; xd < gameState().getMap().width; xd++)
|
||||||
|
{
|
||||||
|
for(int yd = 0; yd < gameState().getMap().height; yd++)
|
||||||
|
{
|
||||||
|
int3 coordinates(xd, yd, zd);
|
||||||
|
if (filter(getTile(coordinates)))
|
||||||
|
tiles.insert(coordinates);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameInfoCallback::pickAllowedArtsSet(std::vector<ArtifactID> & out, vstd::RNG & rand)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 3 ; j++)
|
||||||
|
out.push_back(gameState().pickRandomArtifact(rand, EArtifactClass::ART_TREASURE));
|
||||||
|
for (int j = 0; j < 3 ; j++)
|
||||||
|
out.push_back(gameState().pickRandomArtifact(rand, EArtifactClass::ART_MINOR));
|
||||||
|
|
||||||
|
out.push_back(gameState().pickRandomArtifact(rand, EArtifactClass::ART_MAJOR));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameInfoCallback::getAllowedSpells(std::vector<SpellID> & out, std::optional<ui16> level)
|
||||||
|
{
|
||||||
|
for (auto const & spellID : gameState().getMap().allowedSpells)
|
||||||
|
{
|
||||||
|
const auto * spell = spellID.toEntity(LIBRARY);
|
||||||
|
|
||||||
|
if (!isAllowed(spellID))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (level.has_value() && spell->getLevel() != level)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
out.push_back(spellID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if SCRIPTING_ENABLED
|
||||||
|
scripting::Pool * CGameInfoCallback::getGlobalContextPool() const
|
||||||
|
{
|
||||||
|
return nullptr; // TODO
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
|||||||
@@ -36,18 +36,30 @@ class CGTeleport;
|
|||||||
class CGTownInstance;
|
class CGTownInstance;
|
||||||
class IMarket;
|
class IMarket;
|
||||||
|
|
||||||
|
#if SCRIPTING_ENABLED
|
||||||
|
namespace scripting
|
||||||
|
{
|
||||||
|
class Pool;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace vstd
|
||||||
|
{
|
||||||
|
class RNG;
|
||||||
|
}
|
||||||
|
|
||||||
class DLL_LINKAGE CGameInfoCallback : public IGameInfoCallback
|
class DLL_LINKAGE CGameInfoCallback : public IGameInfoCallback
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
virtual CGameState & gameState() = 0;
|
|
||||||
virtual const CGameState & gameState() const = 0;
|
|
||||||
|
|
||||||
bool hasAccess(std::optional<PlayerColor> playerId) const;
|
bool hasAccess(std::optional<PlayerColor> playerId) const;
|
||||||
|
|
||||||
bool canGetFullInfo(const CGObjectInstance *obj) const; //true we player owns obj or ally owns obj or privileged mode
|
bool canGetFullInfo(const CGObjectInstance *obj) const; //true we player owns obj or ally owns obj or privileged mode
|
||||||
bool isOwnedOrVisited(const CGObjectInstance *obj) const;
|
bool isOwnedOrVisited(const CGObjectInstance *obj) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
virtual CGameState & gameState() = 0;
|
||||||
|
virtual const CGameState & gameState() const = 0;
|
||||||
|
|
||||||
//various
|
//various
|
||||||
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
|
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
|
||||||
const StartInfo * getStartInfo() const override;
|
const StartInfo * getStartInfo() const override;
|
||||||
@@ -135,6 +147,28 @@ public:
|
|||||||
virtual bool isTeleportChannelBidirectional(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 isTeleportChannelUnidirectional(TeleportChannelID id, PlayerColor player = PlayerColor::UNFLAGGABLE) const;
|
||||||
virtual bool isTeleportEntrancePassable(const CGTeleport * obj, PlayerColor player) const;
|
virtual bool isTeleportEntrancePassable(const CGTeleport * obj, PlayerColor player) const;
|
||||||
|
|
||||||
|
//used for random spawns
|
||||||
|
void getFreeTiles(std::vector<int3> &tiles) const;
|
||||||
|
|
||||||
|
//mode 1 - only unrevealed tiles; mode 0 - all, mode -1 - only revealed
|
||||||
|
void getTilesInRange(std::unordered_set<int3> & tiles,
|
||||||
|
const int3 & pos,
|
||||||
|
int radius,
|
||||||
|
ETileVisibility mode,
|
||||||
|
std::optional<PlayerColor> player = std::optional<PlayerColor>(),
|
||||||
|
int3::EDistanceFormula formula = int3::DIST_2D) const;
|
||||||
|
|
||||||
|
//returns all tiles on given level (-1 - both levels, otherwise number of level)
|
||||||
|
void getAllTiles(std::unordered_set<int3> &tiles, std::optional<PlayerColor> player, int level, std::function<bool(const TerrainTile *)> filter) const;
|
||||||
|
|
||||||
|
//gives 3 treasures, 3 minors, 1 major -> used by Black Market and Artifact Merchant
|
||||||
|
void pickAllowedArtsSet(std::vector<ArtifactID> & out, vstd::RNG & rand);
|
||||||
|
void getAllowedSpells(std::vector<SpellID> &out, std::optional<ui16> level = std::nullopt);
|
||||||
|
|
||||||
|
#if SCRIPTING_ENABLED
|
||||||
|
virtual scripting::Pool * getGlobalContextPool() const;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CPrivilegedInfoCallback.h"
|
#include "CGameInfoCallback.h"
|
||||||
|
|
||||||
#include <vcmi/Metatype.h>
|
#include <vcmi/Metatype.h>
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ VCMI_LIB_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
class JsonNode;
|
class JsonNode;
|
||||||
|
|
||||||
class DLL_LINKAGE CNonConstInfoCallback : public CPrivilegedInfoCallback
|
class DLL_LINKAGE CNonConstInfoCallback : public CGameInfoCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//keep const version of callback accessible
|
//keep const version of callback accessible
|
||||||
|
|||||||
@@ -1,141 +0,0 @@
|
|||||||
/*
|
|
||||||
* CPrivilegedInfoCallback.cpp, part of VCMI engine
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#include "StdInc.h"
|
|
||||||
#include "CPrivilegedInfoCallback.h"
|
|
||||||
|
|
||||||
#include "../CPlayerState.h"
|
|
||||||
#include "../entities/artifact/EArtifactClass.h"
|
|
||||||
#include "../entities/building/CBuilding.h"
|
|
||||||
#include "../gameState/CGameState.h"
|
|
||||||
#include "../mapping/CMap.h"
|
|
||||||
#include "../spells/CSpellHandler.h"
|
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
|
||||||
|
|
||||||
void CPrivilegedInfoCallback::getFreeTiles(std::vector<int3> & tiles) const
|
|
||||||
{
|
|
||||||
std::vector<int> floors;
|
|
||||||
floors.reserve(gameState().getMap().levels());
|
|
||||||
for(int b = 0; b < gameState().getMap().levels(); ++b)
|
|
||||||
{
|
|
||||||
floors.push_back(b);
|
|
||||||
}
|
|
||||||
const TerrainTile * tinfo = nullptr;
|
|
||||||
for (auto zd : floors)
|
|
||||||
{
|
|
||||||
for (int xd = 0; xd < gameState().getMap().width; xd++)
|
|
||||||
{
|
|
||||||
for (int yd = 0; yd < gameState().getMap().height; yd++)
|
|
||||||
{
|
|
||||||
tinfo = getTile(int3 (xd,yd,zd));
|
|
||||||
if (tinfo->isLand() && tinfo->getTerrain()->isPassable() && !tinfo->blocked()) //land and free
|
|
||||||
tiles.emplace_back(xd, yd, zd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPrivilegedInfoCallback::getTilesInRange(std::unordered_set<int3> & tiles,
|
|
||||||
const int3 & pos,
|
|
||||||
int radious,
|
|
||||||
ETileVisibility mode,
|
|
||||||
std::optional<PlayerColor> player,
|
|
||||||
int3::EDistanceFormula distanceFormula) const
|
|
||||||
{
|
|
||||||
if(!!player && !player->isValidPlayer())
|
|
||||||
{
|
|
||||||
logGlobal->error("Illegal call to getTilesInRange!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(radious == CBuilding::HEIGHT_SKYSHIP) //reveal entire map
|
|
||||||
getAllTiles (tiles, player, -1, [](auto * tile){return true;});
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const TeamState * team = !player ? nullptr : gameState().getPlayerTeam(*player);
|
|
||||||
for (int xd = std::max<int>(pos.x - radious , 0); xd <= std::min<int>(pos.x + radious, gameState().getMap().width - 1); xd++)
|
|
||||||
{
|
|
||||||
for (int yd = std::max<int>(pos.y - radious, 0); yd <= std::min<int>(pos.y + radious, gameState().getMap().height - 1); yd++)
|
|
||||||
{
|
|
||||||
int3 tilePos(xd,yd,pos.z);
|
|
||||||
int distance = pos.dist(tilePos, distanceFormula);
|
|
||||||
|
|
||||||
if(distance <= radious)
|
|
||||||
{
|
|
||||||
if(!player
|
|
||||||
|| (mode == ETileVisibility::HIDDEN && team->fogOfWarMap[pos.z][xd][yd] == 0)
|
|
||||||
|| (mode == ETileVisibility::REVEALED && team->fogOfWarMap[pos.z][xd][yd] == 1)
|
|
||||||
)
|
|
||||||
tiles.insert(int3(xd,yd,pos.z));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPrivilegedInfoCallback::getAllTiles(std::unordered_set<int3> & tiles, std::optional<PlayerColor> Player, int level, std::function<bool(const TerrainTile *)> filter) const
|
|
||||||
{
|
|
||||||
if(!!Player && !Player->isValidPlayer())
|
|
||||||
{
|
|
||||||
logGlobal->error("Illegal call to getAllTiles !");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<int> floors;
|
|
||||||
if(level == -1)
|
|
||||||
{
|
|
||||||
for(int b = 0; b < gameState().getMap().levels(); ++b)
|
|
||||||
{
|
|
||||||
floors.push_back(b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
floors.push_back(level);
|
|
||||||
|
|
||||||
for(auto zd: floors)
|
|
||||||
{
|
|
||||||
for(int xd = 0; xd < gameState().getMap().width; xd++)
|
|
||||||
{
|
|
||||||
for(int yd = 0; yd < gameState().getMap().height; yd++)
|
|
||||||
{
|
|
||||||
int3 coordinates(xd, yd, zd);
|
|
||||||
if (filter(getTile(coordinates)))
|
|
||||||
tiles.insert(coordinates);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPrivilegedInfoCallback::pickAllowedArtsSet(std::vector<ArtifactID> & out, vstd::RNG & rand)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < 3 ; j++)
|
|
||||||
out.push_back(gameState().pickRandomArtifact(rand, EArtifactClass::ART_TREASURE));
|
|
||||||
for (int j = 0; j < 3 ; j++)
|
|
||||||
out.push_back(gameState().pickRandomArtifact(rand, EArtifactClass::ART_MINOR));
|
|
||||||
|
|
||||||
out.push_back(gameState().pickRandomArtifact(rand, EArtifactClass::ART_MAJOR));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPrivilegedInfoCallback::getAllowedSpells(std::vector<SpellID> & out, std::optional<ui16> level)
|
|
||||||
{
|
|
||||||
for (auto const & spellID : gameState().getMap().allowedSpells)
|
|
||||||
{
|
|
||||||
const auto * spell = spellID.toEntity(LIBRARY);
|
|
||||||
|
|
||||||
if (!isAllowed(spellID))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (level.has_value() && spell->getLevel() != level)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
out.push_back(spellID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_END
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
/*
|
|
||||||
* CPrivilegedInfoCallback.h, part of VCMI engine
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CGameInfoCallback.h"
|
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
|
||||||
|
|
||||||
namespace vstd
|
|
||||||
{
|
|
||||||
class RNG;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if SCRIPTING_ENABLED
|
|
||||||
namespace scripting
|
|
||||||
{
|
|
||||||
class Pool;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class DLL_LINKAGE CPrivilegedInfoCallback : public CGameInfoCallback
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
#if SCRIPTING_ENABLED
|
|
||||||
virtual scripting::Pool * getGlobalContextPool() const = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using CGameInfoCallback::gameState; // make public
|
|
||||||
|
|
||||||
//used for random spawns
|
|
||||||
void getFreeTiles(std::vector<int3> &tiles) const;
|
|
||||||
|
|
||||||
//mode 1 - only unrevealed tiles; mode 0 - all, mode -1 - only revealed
|
|
||||||
void getTilesInRange(std::unordered_set<int3> & tiles,
|
|
||||||
const int3 & pos,
|
|
||||||
int radius,
|
|
||||||
ETileVisibility mode,
|
|
||||||
std::optional<PlayerColor> player = std::optional<PlayerColor>(),
|
|
||||||
int3::EDistanceFormula formula = int3::DIST_2D) const;
|
|
||||||
|
|
||||||
//returns all tiles on given level (-1 - both levels, otherwise number of level)
|
|
||||||
void getAllTiles(std::unordered_set<int3> &tiles, std::optional<PlayerColor> player, int level, std::function<bool(const TerrainTile *)> filter) const;
|
|
||||||
|
|
||||||
//gives 3 treasures, 3 minors, 1 major -> used by Black Market and Artifact Merchant
|
|
||||||
void pickAllowedArtsSet(std::vector<ArtifactID> & out, vstd::RNG & rand);
|
|
||||||
void getAllowedSpells(std::vector<SpellID> &out, std::optional<ui16> level = std::nullopt);
|
|
||||||
};
|
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_END
|
|
||||||
@@ -11,14 +11,14 @@
|
|||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
class CPrivilegedInfoCallback;
|
class CGameInfoCallback;
|
||||||
|
|
||||||
class DLL_LINKAGE GameCallbackHolder
|
class DLL_LINKAGE GameCallbackHolder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CPrivilegedInfoCallback * cb;
|
CGameInfoCallback * cb;
|
||||||
|
|
||||||
explicit GameCallbackHolder(CPrivilegedInfoCallback *cb):
|
explicit GameCallbackHolder(CGameInfoCallback *cb):
|
||||||
cb(cb)
|
cb(cb)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -420,7 +420,7 @@ std::optional<ui8> CampaignState::getBonusID(CampaignScenarioID which) const
|
|||||||
return chosenCampaignBonuses.at(which);
|
return chosenCampaignBonuses.at(which);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CMap> CampaignState::getMap(CampaignScenarioID scenarioId, CPrivilegedInfoCallback * cb)
|
std::unique_ptr<CMap> CampaignState::getMap(CampaignScenarioID scenarioId, CGameInfoCallback * cb)
|
||||||
{
|
{
|
||||||
// FIXME: there is certainly better way to handle maps inside campaigns
|
// FIXME: there is certainly better way to handle maps inside campaigns
|
||||||
if(scenarioId == CampaignScenarioID::NONE)
|
if(scenarioId == CampaignScenarioID::NONE)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class CMap;
|
|||||||
class CMapHeader;
|
class CMapHeader;
|
||||||
class CMapInfo;
|
class CMapInfo;
|
||||||
class JsonNode;
|
class JsonNode;
|
||||||
class CPrivilegedInfoCallback;
|
class CGameInfoCallback;
|
||||||
|
|
||||||
class DLL_LINKAGE CampaignRegions
|
class DLL_LINKAGE CampaignRegions
|
||||||
{
|
{
|
||||||
@@ -338,7 +338,7 @@ public:
|
|||||||
/// Returns true if all available scenarios have been completed and campaign is finished
|
/// Returns true if all available scenarios have been completed and campaign is finished
|
||||||
bool isCampaignFinished() const;
|
bool isCampaignFinished() const;
|
||||||
|
|
||||||
std::unique_ptr<CMap> getMap(CampaignScenarioID scenarioId, CPrivilegedInfoCallback * cb);
|
std::unique_ptr<CMap> getMap(CampaignScenarioID scenarioId, CGameInfoCallback * cb);
|
||||||
std::unique_ptr<CMapHeader> getMapHeader(CampaignScenarioID scenarioId) const;
|
std::unique_ptr<CMapHeader> getMapHeader(CampaignScenarioID scenarioId) const;
|
||||||
std::shared_ptr<CMapInfo> getMapInfo(CampaignScenarioID scenarioId) const;
|
std::shared_ptr<CMapInfo> getMapInfo(CampaignScenarioID scenarioId) const;
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,11 @@
|
|||||||
#include "StdInc.h"
|
#include "StdInc.h"
|
||||||
#include "ArtSlotInfo.h"
|
#include "ArtSlotInfo.h"
|
||||||
|
|
||||||
#include "../../callback/CPrivilegedInfoCallback.h"
|
#include "../../callback/CGameInfoCallback.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
ArtSlotInfo::ArtSlotInfo(CPrivilegedInfoCallback * cb)
|
ArtSlotInfo::ArtSlotInfo(CGameInfoCallback * cb)
|
||||||
: GameCallbackHolder(cb)
|
: GameCallbackHolder(cb)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ struct DLL_LINKAGE ArtSlotInfo : public GameCallbackHolder
|
|||||||
ArtifactInstanceID artifactID;
|
ArtifactInstanceID artifactID;
|
||||||
bool locked = false; //if locked, then artifact points to the combined artifact
|
bool locked = false; //if locked, then artifact points to the combined artifact
|
||||||
|
|
||||||
explicit ArtSlotInfo(CPrivilegedInfoCallback * cb);
|
explicit ArtSlotInfo(CGameInfoCallback * cb);
|
||||||
ArtSlotInfo(const CArtifactInstance * artifact, bool locked);
|
ArtSlotInfo(const CArtifactInstance * artifact, bool locked);
|
||||||
|
|
||||||
const CArtifactInstance * getArt() const;
|
const CArtifactInstance * getArt() const;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
CArtifactFittingSet::CArtifactFittingSet(CPrivilegedInfoCallback *cb, ArtBearer bearer)
|
CArtifactFittingSet::CArtifactFittingSet(CGameInfoCallback *cb, ArtBearer bearer)
|
||||||
: CArtifactSet(cb)
|
: CArtifactSet(cb)
|
||||||
, GameCallbackHolder(cb)
|
, GameCallbackHolder(cb)
|
||||||
, bearer(bearer)
|
, bearer(bearer)
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ VCMI_LIB_NAMESPACE_BEGIN
|
|||||||
// Used to try on artifacts before the claimed changes have been applied
|
// Used to try on artifacts before the claimed changes have been applied
|
||||||
class DLL_LINKAGE CArtifactFittingSet : public CArtifactSet, public GameCallbackHolder
|
class DLL_LINKAGE CArtifactFittingSet : public CArtifactSet, public GameCallbackHolder
|
||||||
{
|
{
|
||||||
CPrivilegedInfoCallback * getCallback() const final
|
CGameInfoCallback * getCallback() const final
|
||||||
{
|
{
|
||||||
return cb;
|
return cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CArtifactFittingSet(CPrivilegedInfoCallback * cb, ArtBearer Bearer);
|
CArtifactFittingSet(CGameInfoCallback * cb, ArtBearer Bearer);
|
||||||
explicit CArtifactFittingSet(const CArtifactSet & artSet);
|
explicit CArtifactFittingSet(const CArtifactSet & artSet);
|
||||||
ArtBearer bearerType() const override;
|
ArtBearer bearerType() const override;
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "CArtifact.h"
|
#include "CArtifact.h"
|
||||||
#include "CArtifactSet.h"
|
#include "CArtifactSet.h"
|
||||||
|
|
||||||
#include "../../callback/CPrivilegedInfoCallback.h"
|
#include "../../callback/CGameInfoCallback.h"
|
||||||
#include "../../gameState/CGameState.h"
|
#include "../../gameState/CGameState.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
@@ -125,13 +125,13 @@ void CGrowingArtifactInstance::growingUp()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CArtifactInstance::CArtifactInstance(CPrivilegedInfoCallback *cb, const CArtifact * art)
|
CArtifactInstance::CArtifactInstance(CGameInfoCallback *cb, const CArtifact * art)
|
||||||
:CArtifactInstance(cb)
|
:CArtifactInstance(cb)
|
||||||
{
|
{
|
||||||
setType(art);
|
setType(art);
|
||||||
}
|
}
|
||||||
|
|
||||||
CArtifactInstance::CArtifactInstance(CPrivilegedInfoCallback *cb)
|
CArtifactInstance::CArtifactInstance(CGameInfoCallback *cb)
|
||||||
: CBonusSystemNode(ARTIFACT_INSTANCE)
|
: CBonusSystemNode(ARTIFACT_INSTANCE)
|
||||||
, CCombinedArtifactInstance(cb)
|
, CCombinedArtifactInstance(cb)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ class DLL_LINKAGE CArtifactInstance final
|
|||||||
ArtifactID artTypeID;
|
ArtifactID artTypeID;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CArtifactInstance(CPrivilegedInfoCallback *cb, const CArtifact * art);
|
CArtifactInstance(CGameInfoCallback *cb, const CArtifact * art);
|
||||||
CArtifactInstance(CPrivilegedInfoCallback *cb);
|
CArtifactInstance(CGameInfoCallback *cb);
|
||||||
void setType(const CArtifact * art);
|
void setType(const CArtifact * art);
|
||||||
std::string nodeName() const override;
|
std::string nodeName() const override;
|
||||||
ArtifactID getTypeId() const;
|
ArtifactID getTypeId() const;
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ CArtifactSet::ArtPlacementMap CArtifactSet::putArtifact(const ArtifactPosition &
|
|||||||
return resArtPlacement;
|
return resArtPlacement;
|
||||||
}
|
}
|
||||||
|
|
||||||
CArtifactSet::CArtifactSet(CPrivilegedInfoCallback * cb)
|
CArtifactSet::CArtifactSet(CGameInfoCallback * cb)
|
||||||
:artifactsTransitionPos(cb)
|
:artifactsTransitionPos(cb)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@@ -40,11 +40,11 @@ public:
|
|||||||
bool hasScroll(const SpellID & aid, bool onlyWorn = false) const;
|
bool hasScroll(const SpellID & aid, bool onlyWorn = false) const;
|
||||||
bool isPositionFree(const ArtifactPosition & pos, bool onlyLockCheck = false) const;
|
bool isPositionFree(const ArtifactPosition & pos, bool onlyLockCheck = false) const;
|
||||||
|
|
||||||
virtual CPrivilegedInfoCallback * getCallback() const = 0;
|
virtual CGameInfoCallback * getCallback() const = 0;
|
||||||
virtual ArtBearer bearerType() const = 0;
|
virtual ArtBearer bearerType() const = 0;
|
||||||
virtual ArtPlacementMap putArtifact(const ArtifactPosition & slot, const CArtifactInstance * art);
|
virtual ArtPlacementMap putArtifact(const ArtifactPosition & slot, const CArtifactInstance * art);
|
||||||
virtual void removeArtifact(const ArtifactPosition & slot);
|
virtual void removeArtifact(const ArtifactPosition & slot);
|
||||||
CArtifactSet(CPrivilegedInfoCallback * cb);
|
CArtifactSet(CGameInfoCallback * cb);
|
||||||
virtual ~CArtifactSet() = default;
|
virtual ~CArtifactSet() = default;
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h)
|
template <typename Handler> void serialize(Handler &h)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#include "../bonuses/Propagators.h"
|
#include "../bonuses/Propagators.h"
|
||||||
#include "../bonuses/Updaters.h"
|
#include "../bonuses/Updaters.h"
|
||||||
#include "../battle/BattleInfo.h"
|
#include "../battle/BattleInfo.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../campaign/CampaignState.h"
|
#include "../campaign/CampaignState.h"
|
||||||
#include "../constants/StringConstants.h"
|
#include "../constants/StringConstants.h"
|
||||||
#include "../entities/artifact/ArtifactUtils.h"
|
#include "../entities/artifact/ArtifactUtils.h"
|
||||||
@@ -150,7 +150,7 @@ int CGameState::getDate(Date mode) const
|
|||||||
return getDate(day, mode);
|
return getDate(day, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGameState::CGameState(CPrivilegedInfoCallback * callback)
|
CGameState::CGameState(CGameInfoCallback * callback)
|
||||||
: GameCallbackHolder(callback)
|
: GameCallbackHolder(callback)
|
||||||
{
|
{
|
||||||
heroesPool = std::make_unique<TavernHeroesPool>(this);
|
heroesPool = std::make_unique<TavernHeroesPool>(this);
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public:
|
|||||||
/// list of players currently making turn. Usually - just one, except for simturns
|
/// list of players currently making turn. Usually - just one, except for simturns
|
||||||
std::set<PlayerColor> actingPlayers;
|
std::set<PlayerColor> actingPlayers;
|
||||||
|
|
||||||
CGameState(CPrivilegedInfoCallback * callback);
|
CGameState(CGameInfoCallback * callback);
|
||||||
virtual ~CGameState();
|
virtual ~CGameState();
|
||||||
|
|
||||||
CGameState & gameState() final { return *this; }
|
CGameState & gameState() final { return *this; }
|
||||||
@@ -240,7 +240,7 @@ private:
|
|||||||
/// Pointer to campaign state manager. Nullptr for single scenarios
|
/// Pointer to campaign state manager. Nullptr for single scenarios
|
||||||
std::unique_ptr<CGameStateCampaign> campaign;
|
std::unique_ptr<CGameStateCampaign> campaign;
|
||||||
|
|
||||||
friend class CPrivilegedInfoCallback;
|
friend class CGameInfoCallback;
|
||||||
friend class CMapHandler;
|
friend class CMapHandler;
|
||||||
friend class CGameHandler;
|
friend class CGameHandler;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "JsonBonus.h"
|
#include "JsonBonus.h"
|
||||||
|
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../constants/StringConstants.h"
|
#include "../constants/StringConstants.h"
|
||||||
#include "../GameLibrary.h"
|
#include "../GameLibrary.h"
|
||||||
#include "../CCreatureHandler.h"
|
#include "../CCreatureHandler.h"
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class RNG;
|
|||||||
class ObjectTemplate;
|
class ObjectTemplate;
|
||||||
class CGObjectInstance;
|
class CGObjectInstance;
|
||||||
class IObjectInfo;
|
class IObjectInfo;
|
||||||
class CPrivilegedInfoCallback;
|
class CGameInfoCallback;
|
||||||
|
|
||||||
/// Class responsible for creation of objects of specific type & subtype
|
/// Class responsible for creation of objects of specific type & subtype
|
||||||
class DLL_LINKAGE AObjectTypeHandler : public boost::noncopyable
|
class DLL_LINKAGE AObjectTypeHandler : public boost::noncopyable
|
||||||
@@ -118,7 +118,7 @@ public:
|
|||||||
|
|
||||||
/// Creates object and set up core properties (like ID/subID). Object is NOT initialized
|
/// Creates object and set up core properties (like ID/subID). Object is NOT initialized
|
||||||
/// to allow creating objects before game start (e.g. map loading)
|
/// to allow creating objects before game start (e.g. map loading)
|
||||||
virtual std::shared_ptr<CGObjectInstance> create(CPrivilegedInfoCallback * cb, std::shared_ptr<const ObjectTemplate> tmpl) const = 0;
|
virtual std::shared_ptr<CGObjectInstance> create(CGameInfoCallback * cb, std::shared_ptr<const ObjectTemplate> tmpl) const = 0;
|
||||||
|
|
||||||
/// Configures object properties. Should be re-entrable, resetting state of the object if necessarily
|
/// Configures object properties. Should be re-entrable, resetting state of the object if necessarily
|
||||||
/// This should set remaining properties, including randomized or depending on map
|
/// This should set remaining properties, including randomized or depending on map
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class CDefaultObjectTypeHandler : public AObjectTypeHandler
|
|||||||
randomizeObject(castedObject, rng);
|
randomizeObject(castedObject, rng);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<CGObjectInstance> create(CPrivilegedInfoCallback * cb, std::shared_ptr<const ObjectTemplate> tmpl) const final
|
std::shared_ptr<CGObjectInstance> create(CGameInfoCallback * cb, std::shared_ptr<const ObjectTemplate> tmpl) const final
|
||||||
{
|
{
|
||||||
auto result = createObject(cb);
|
auto result = createObject(cb);
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ class CDefaultObjectTypeHandler : public AObjectTypeHandler
|
|||||||
protected:
|
protected:
|
||||||
virtual void initializeObject(ObjectType * object) const {}
|
virtual void initializeObject(ObjectType * object) const {}
|
||||||
virtual void randomizeObject(ObjectType * object, vstd::RNG & rng) const {}
|
virtual void randomizeObject(ObjectType * object, vstd::RNG & rng) const {}
|
||||||
virtual std::shared_ptr<ObjectType> createObject(CPrivilegedInfoCallback * cb) const
|
virtual std::shared_ptr<ObjectType> createObject(CGameInfoCallback * cb) const
|
||||||
{
|
{
|
||||||
return std::make_shared<ObjectType>(cb);
|
return std::make_shared<ObjectType>(cb);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ bool CRewardableConstructor::hasNameTextID() const
|
|||||||
return !objectInfo.getParameters()["name"].isNull();
|
return !objectInfo.getParameters()["name"].isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<CGObjectInstance> CRewardableConstructor::create(CPrivilegedInfoCallback * cb, std::shared_ptr<const ObjectTemplate> tmpl) const
|
std::shared_ptr<CGObjectInstance> CRewardableConstructor::create(CGameInfoCallback * cb, std::shared_ptr<const ObjectTemplate> tmpl) const
|
||||||
{
|
{
|
||||||
auto ret = std::make_shared<CRewardableObject>(cb);
|
auto ret = std::make_shared<CRewardableObject>(cb);
|
||||||
preInitObject(ret.get());
|
preInitObject(ret.get());
|
||||||
@@ -55,7 +55,7 @@ void CRewardableConstructor::assignBonuses(std::vector<Bonus> & bonuses, MapObje
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rewardable::Configuration CRewardableConstructor::generateConfiguration(CPrivilegedInfoCallback * cb, vstd::RNG & rand, MapObjectID objectID, const std::map<std::string, JsonNode> & presetVariables) const
|
Rewardable::Configuration CRewardableConstructor::generateConfiguration(CGameInfoCallback * cb, vstd::RNG & rand, MapObjectID objectID, const std::map<std::string, JsonNode> & presetVariables) const
|
||||||
{
|
{
|
||||||
Rewardable::Configuration result;
|
Rewardable::Configuration result;
|
||||||
result.variables.preset = presetVariables;
|
result.variables.preset = presetVariables;
|
||||||
|
|||||||
@@ -28,13 +28,13 @@ class DLL_LINKAGE CRewardableConstructor : public AObjectTypeHandler
|
|||||||
public:
|
public:
|
||||||
bool hasNameTextID() const override;
|
bool hasNameTextID() const override;
|
||||||
|
|
||||||
std::shared_ptr<CGObjectInstance> create(CPrivilegedInfoCallback * cb, std::shared_ptr<const ObjectTemplate> tmpl = nullptr) const override;
|
std::shared_ptr<CGObjectInstance> create(CGameInfoCallback * cb, std::shared_ptr<const ObjectTemplate> tmpl = nullptr) const override;
|
||||||
|
|
||||||
void configureObject(CGObjectInstance * object, vstd::RNG & rng) const override;
|
void configureObject(CGObjectInstance * object, vstd::RNG & rng) const override;
|
||||||
|
|
||||||
std::unique_ptr<IObjectInfo> getObjectInfo(std::shared_ptr<const ObjectTemplate> tmpl) const override;
|
std::unique_ptr<IObjectInfo> getObjectInfo(std::shared_ptr<const ObjectTemplate> tmpl) const override;
|
||||||
|
|
||||||
Rewardable::Configuration generateConfiguration(CPrivilegedInfoCallback * cb, vstd::RNG & rand, MapObjectID objectID, const std::map<std::string, JsonNode> & presetVariables) const;
|
Rewardable::Configuration generateConfiguration(CGameInfoCallback * cb, vstd::RNG & rand, MapObjectID objectID, const std::map<std::string, JsonNode> & presetVariables) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#include "../GameLibrary.h"
|
#include "../GameLibrary.h"
|
||||||
|
|
||||||
#include "../CConfigHandler.h"
|
#include "../CConfigHandler.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../entities/faction/CTownHandler.h"
|
#include "../entities/faction/CTownHandler.h"
|
||||||
#include "../entities/hero/CHeroClass.h"
|
#include "../entities/hero/CHeroClass.h"
|
||||||
#include "../json/JsonUtils.h"
|
#include "../json/JsonUtils.h"
|
||||||
@@ -318,7 +318,7 @@ bool MarketInstanceConstructor::hasDescription() const
|
|||||||
return !descriptionTextID.empty();
|
return !descriptionTextID.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<CGMarket> MarketInstanceConstructor::createObject(CPrivilegedInfoCallback * cb) const
|
std::shared_ptr<CGMarket> MarketInstanceConstructor::createObject(CGameInfoCallback * cb) const
|
||||||
{
|
{
|
||||||
if(marketModes.size() == 1)
|
if(marketModes.size() == 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ class MarketInstanceConstructor : public CDefaultObjectTypeHandler<CGMarket>
|
|||||||
|
|
||||||
void initTypeData(const JsonNode & config) override;
|
void initTypeData(const JsonNode & config) override;
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<CGMarket> createObject(CPrivilegedInfoCallback * cb) const override;
|
std::shared_ptr<CGMarket> createObject(CGameInfoCallback * cb) const override;
|
||||||
void randomizeObject(CGMarket * object, vstd::RNG & rng) const override;
|
void randomizeObject(CGMarket * object, vstd::RNG & rng) const override;
|
||||||
|
|
||||||
const std::set<EMarketMode> & availableModes() const;
|
const std::set<EMarketMode> & availableModes() const;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include "../CCreatureHandler.h"
|
#include "../CCreatureHandler.h"
|
||||||
#include "../CPlayerState.h"
|
#include "../CPlayerState.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../entities/faction/CFaction.h"
|
#include "../entities/faction/CFaction.h"
|
||||||
#include "../entities/faction/CTown.h"
|
#include "../entities/faction/CTown.h"
|
||||||
#include "../entities/faction/CTownHandler.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(cb, false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CArmedInstance::CArmedInstance(CPrivilegedInfoCallback *cb, bool isHypothetic):
|
CArmedInstance::CArmedInstance(CGameInfoCallback *cb, bool isHypothetic):
|
||||||
CGObjectInstance(cb),
|
CGObjectInstance(cb),
|
||||||
CBonusSystemNode(isHypothetic),
|
CBonusSystemNode(isHypothetic),
|
||||||
nonEvilAlignmentMix(this, Selector::type()(BonusType::NONEVIL_ALIGNMENT_MIX)), // Take Angelic Alliance troop-mixing freedom of non-evil units into account.
|
nonEvilAlignmentMix(this, Selector::type()(BonusType::NONEVIL_ALIGNMENT_MIX)), // Take Angelic Alliance troop-mixing freedom of non-evil units into account.
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ public:
|
|||||||
void restoreBonusSystem(CGameState & gs) override;
|
void restoreBonusSystem(CGameState & gs) override;
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
CArmedInstance(CPrivilegedInfoCallback *cb);
|
CArmedInstance(CGameInfoCallback *cb);
|
||||||
CArmedInstance(CPrivilegedInfoCallback *cb, bool isHypothetic);
|
CArmedInstance(CGameInfoCallback *cb, bool isHypothetic);
|
||||||
|
|
||||||
PlayerColor getOwner() const override
|
PlayerColor getOwner() const override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "../texts/CGeneralTextHandler.h"
|
#include "../texts/CGeneralTextHandler.h"
|
||||||
#include "../CConfigHandler.h"
|
#include "../CConfigHandler.h"
|
||||||
#include "../IGameSettings.h"
|
#include "../IGameSettings.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../callback/IGameEventCallback.h"
|
#include "../callback/IGameEventCallback.h"
|
||||||
#include "../gameState/CGameState.h"
|
#include "../gameState/CGameState.h"
|
||||||
#include "../mapObjectConstructors/CObjectClassesHandler.h"
|
#include "../mapObjectConstructors/CObjectClassesHandler.h"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "StdInc.h"
|
#include "StdInc.h"
|
||||||
#include "CGDwelling.h"
|
#include "CGDwelling.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../callback/IGameEventCallback.h"
|
#include "../callback/IGameEventCallback.h"
|
||||||
#include "../serializer/JsonSerializeFormat.h"
|
#include "../serializer/JsonSerializeFormat.h"
|
||||||
#include "../entities/faction/CTownHandler.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)
|
CArmedInstance(cb)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
std::optional<CGDwellingRandomizationInfo> randomizationInfo; //random dwelling options; not serialized
|
std::optional<CGDwellingRandomizationInfo> randomizationInfo; //random dwelling options; not serialized
|
||||||
TCreaturesSet creatures; //creatures[level] -> <vector of alternative ids (base creature and upgrades, creatures amount>
|
TCreaturesSet creatures; //creatures[level] -> <vector of alternative ids (base creature and upgrades, creatures amount>
|
||||||
|
|
||||||
CGDwelling(CPrivilegedInfoCallback *cb);
|
CGDwelling(CGameInfoCallback *cb);
|
||||||
~CGDwelling() override;
|
~CGDwelling() override;
|
||||||
|
|
||||||
const IOwnableObject * asOwnable() const final;
|
const IOwnableObject * asOwnable() const final;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include <vcmi/spells/Spell.h>
|
#include <vcmi/spells/Spell.h>
|
||||||
#include <vstd/RNG.h>
|
#include <vstd/RNG.h>
|
||||||
|
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../callback/IGameEventCallback.h"
|
#include "../callback/IGameEventCallback.h"
|
||||||
#include "../texts/CGeneralTextHandler.h"
|
#include "../texts/CGeneralTextHandler.h"
|
||||||
#include "../TerrainHandler.h"
|
#include "../TerrainHandler.h"
|
||||||
@@ -254,7 +254,7 @@ int CGHeroInstance::movementPointsLimitCached(bool onLand, const TurnInfo * ti)
|
|||||||
return ti->getMovePointsLimitWater();
|
return ti->getMovePointsLimitWater();
|
||||||
}
|
}
|
||||||
|
|
||||||
CGHeroInstance::CGHeroInstance(CPrivilegedInfoCallback * cb)
|
CGHeroInstance::CGHeroInstance(CGameInfoCallback * cb)
|
||||||
: CArmedInstance(cb),
|
: CArmedInstance(cb),
|
||||||
CArtifactSet(cb),
|
CArtifactSet(cb),
|
||||||
tacticFormationEnabled(false),
|
tacticFormationEnabled(false),
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class DLL_LINKAGE CGHeroInstance : public CArmedInstance, public IBoatGenerator,
|
|||||||
ui32 movement; //remaining movement points
|
ui32 movement; //remaining movement points
|
||||||
bool inTownGarrison; // if hero is in town garrison
|
bool inTownGarrison; // if hero is in town garrison
|
||||||
|
|
||||||
CPrivilegedInfoCallback * getCallback() const final { return cb; }
|
CGameInfoCallback * getCallback() const final { return cb; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
@@ -281,7 +281,7 @@ public:
|
|||||||
/// If this hero perishes, the scenario is failed
|
/// If this hero perishes, the scenario is failed
|
||||||
bool isMissionCritical() const;
|
bool isMissionCritical() const;
|
||||||
|
|
||||||
CGHeroInstance(CPrivilegedInfoCallback *cb);
|
CGHeroInstance(CGameInfoCallback *cb);
|
||||||
virtual ~CGHeroInstance();
|
virtual ~CGHeroInstance();
|
||||||
|
|
||||||
PlayerColor getOwner() const override;
|
PlayerColor getOwner() const override;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "StdInc.h"
|
#include "StdInc.h"
|
||||||
#include "CGMarket.h"
|
#include "CGMarket.h"
|
||||||
|
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../callback/IGameEventCallback.h"
|
#include "../callback/IGameEventCallback.h"
|
||||||
#include "../texts/CGeneralTextHandler.h"
|
#include "../texts/CGeneralTextHandler.h"
|
||||||
#include "../CCreatureHandler.h"
|
#include "../CCreatureHandler.h"
|
||||||
@@ -78,7 +78,7 @@ std::set<EMarketMode> CGMarket::availableModes() const
|
|||||||
return getMarketHandler()->availableModes();
|
return getMarketHandler()->availableModes();
|
||||||
}
|
}
|
||||||
|
|
||||||
CGMarket::CGMarket(CPrivilegedInfoCallback *cb)
|
CGMarket::CGMarket(CGameInfoCallback *cb)
|
||||||
: CGObjectInstance(cb)
|
: CGObjectInstance(cb)
|
||||||
, IMarket(cb)
|
, IMarket(cb)
|
||||||
{}
|
{}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ protected:
|
|||||||
std::shared_ptr<MarketInstanceConstructor> getMarketHandler() const;
|
std::shared_ptr<MarketInstanceConstructor> getMarketHandler() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CGMarket(CPrivilegedInfoCallback *cb);
|
CGMarket(CGameInfoCallback *cb);
|
||||||
///IObjectInterface
|
///IObjectInterface
|
||||||
void onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance * h) const override; //open trading window
|
void onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance * h) const override; //open trading window
|
||||||
void initObj(vstd::RNG & rand) override;//set skills for trade
|
void initObj(vstd::RNG & rand) override;//set skills for trade
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "CGHeroInstance.h"
|
#include "CGHeroInstance.h"
|
||||||
#include "ObjectTemplate.h"
|
#include "ObjectTemplate.h"
|
||||||
|
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../callback/IGameEventCallback.h"
|
#include "../callback/IGameEventCallback.h"
|
||||||
#include "../gameState/CGameState.h"
|
#include "../gameState/CGameState.h"
|
||||||
#include "../texts/CGeneralTextHandler.h"
|
#include "../texts/CGeneralTextHandler.h"
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
//TODO: remove constructor
|
//TODO: remove constructor
|
||||||
CGObjectInstance::CGObjectInstance(CPrivilegedInfoCallback *cb):
|
CGObjectInstance::CGObjectInstance(CGameInfoCallback *cb):
|
||||||
IObjectInterface(cb),
|
IObjectInterface(cb),
|
||||||
pos(-1,-1,-1),
|
pos(-1,-1,-1),
|
||||||
ID(Obj::NO_OBJ),
|
ID(Obj::NO_OBJ),
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public:
|
|||||||
|
|
||||||
std::string instanceName;
|
std::string instanceName;
|
||||||
|
|
||||||
CGObjectInstance(CPrivilegedInfoCallback *cb);
|
CGObjectInstance(CGameInfoCallback *cb);
|
||||||
~CGObjectInstance() override;
|
~CGObjectInstance() override;
|
||||||
|
|
||||||
MapObjectID getObjGroupIndex() const override;
|
MapObjectID getObjGroupIndex() const override;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "../CSkillHandler.h"
|
#include "../CSkillHandler.h"
|
||||||
#include "../StartInfo.h"
|
#include "../StartInfo.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../callback/IGameEventCallback.h"
|
#include "../callback/IGameEventCallback.h"
|
||||||
#include "../constants/StringConstants.h"
|
#include "../constants/StringConstants.h"
|
||||||
#include "../networkPacks/PacksForClient.h"
|
#include "../networkPacks/PacksForClient.h"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "StdInc.h"
|
#include "StdInc.h"
|
||||||
#include "CGResource.h"
|
#include "CGResource.h"
|
||||||
|
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../callback/IGameEventCallback.h"
|
#include "../callback/IGameEventCallback.h"
|
||||||
#include "../mapObjectConstructors/CommonConstructors.h"
|
#include "../mapObjectConstructors/CommonConstructors.h"
|
||||||
#include "../texts/CGeneralTextHandler.h"
|
#include "../texts/CGeneralTextHandler.h"
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include "../CPlayerState.h"
|
#include "../CPlayerState.h"
|
||||||
#include "../StartInfo.h"
|
#include "../StartInfo.h"
|
||||||
#include "../TerrainHandler.h"
|
#include "../TerrainHandler.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../callback/IGameEventCallback.h"
|
#include "../callback/IGameEventCallback.h"
|
||||||
#include "../entities/building/CBuilding.h"
|
#include "../entities/building/CBuilding.h"
|
||||||
#include "../entities/faction/CTownHandler.h"
|
#include "../entities/faction/CTownHandler.h"
|
||||||
@@ -264,7 +264,7 @@ TownFortifications CGTownInstance::fortificationsLevel() const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGTownInstance::CGTownInstance(CPrivilegedInfoCallback *cb):
|
CGTownInstance::CGTownInstance(CGameInfoCallback *cb):
|
||||||
CGDwelling(cb),
|
CGDwelling(cb),
|
||||||
IMarket(cb),
|
IMarket(cb),
|
||||||
built(0),
|
built(0),
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ public:
|
|||||||
/// Returns true if provided war machine is available in any of built buildings of this town
|
/// Returns true if provided war machine is available in any of built buildings of this town
|
||||||
bool isWarMachineAvailable(ArtifactID) const;
|
bool isWarMachineAvailable(ArtifactID) const;
|
||||||
|
|
||||||
CGTownInstance(CPrivilegedInfoCallback *cb);
|
CGTownInstance(CGameInfoCallback *cb);
|
||||||
virtual ~CGTownInstance();
|
virtual ~CGTownInstance();
|
||||||
|
|
||||||
///IObjectInterface overrides
|
///IObjectInterface overrides
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#include "../texts/CGeneralTextHandler.h"
|
#include "../texts/CGeneralTextHandler.h"
|
||||||
#include "CGCreature.h"
|
#include "CGCreature.h"
|
||||||
#include "../IGameSettings.h"
|
#include "../IGameSettings.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../callback/IGameEventCallback.h"
|
#include "../callback/IGameEventCallback.h"
|
||||||
#include "../entities/artifact/CArtifact.h"
|
#include "../entities/artifact/CArtifact.h"
|
||||||
#include "../entities/hero/CHeroHandler.h"
|
#include "../entities/hero/CHeroHandler.h"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "../CPlayerState.h"
|
#include "../CPlayerState.h"
|
||||||
#include "../IGameSettings.h"
|
#include "../IGameSettings.h"
|
||||||
#include "../battle/BattleLayout.h"
|
#include "../battle/BattleLayout.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../callback/IGameEventCallback.h"
|
#include "../callback/IGameEventCallback.h"
|
||||||
#include "../gameState/CGameState.h"
|
#include "../gameState/CGameState.h"
|
||||||
#include "../mapObjectConstructors/AObjectTypeHandler.h"
|
#include "../mapObjectConstructors/AObjectTypeHandler.h"
|
||||||
@@ -355,7 +355,7 @@ void CRewardableObject::initObj(vstd::RNG & rand)
|
|||||||
getObjectHandler()->configureObject(this, rand);
|
getObjectHandler()->configureObject(this, rand);
|
||||||
}
|
}
|
||||||
|
|
||||||
CRewardableObject::CRewardableObject(CPrivilegedInfoCallback *cb)
|
CRewardableObject::CRewardableObject(CGameInfoCallback *cb)
|
||||||
:CArmedInstance(cb)
|
:CArmedInstance(cb)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public:
|
|||||||
|
|
||||||
void setPropertyDer(ObjProperty what, ObjPropertyID identifier) override;
|
void setPropertyDer(ObjProperty what, ObjPropertyID identifier) override;
|
||||||
|
|
||||||
CRewardableObject(CPrivilegedInfoCallback *cb);
|
CRewardableObject(CGameInfoCallback *cb);
|
||||||
|
|
||||||
std::string getHoverText(PlayerColor player) const override;
|
std::string getHoverText(PlayerColor player) const override;
|
||||||
std::string getHoverText(const CGHeroInstance * hero) const override;
|
std::string getHoverText(const CGHeroInstance * hero) const override;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "CGHeroInstance.h"
|
#include "CGHeroInstance.h"
|
||||||
|
|
||||||
#include "../CPlayerState.h"
|
#include "../CPlayerState.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../callback/IGameEventCallback.h"
|
#include "../callback/IGameEventCallback.h"
|
||||||
#include "../gameState/CGameState.h"
|
#include "../gameState/CGameState.h"
|
||||||
#include "../mapObjectConstructors/FlaggableInstanceConstructor.h"
|
#include "../mapObjectConstructors/FlaggableInstanceConstructor.h"
|
||||||
|
|||||||
@@ -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))
|
:altarArtifactsStorage(std::make_unique<CArtifactSetAltar>(cb))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,19 +18,19 @@ VCMI_LIB_NAMESPACE_BEGIN
|
|||||||
class DLL_LINKAGE IMarket : public virtual Serializeable, boost::noncopyable
|
class DLL_LINKAGE IMarket : public virtual Serializeable, boost::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit IMarket(CPrivilegedInfoCallback *cb);
|
explicit IMarket(CGameInfoCallback *cb);
|
||||||
~IMarket();
|
~IMarket();
|
||||||
|
|
||||||
class CArtifactSetAltar : public CArtifactSet
|
class CArtifactSetAltar : public CArtifactSet
|
||||||
{
|
{
|
||||||
CPrivilegedInfoCallback *cb;
|
CGameInfoCallback *cb;
|
||||||
public:
|
public:
|
||||||
CArtifactSetAltar(CPrivilegedInfoCallback *cb)
|
CArtifactSetAltar(CGameInfoCallback *cb)
|
||||||
: CArtifactSet(cb)
|
: CArtifactSet(cb)
|
||||||
, cb(cb)
|
, cb(cb)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
CPrivilegedInfoCallback * getCallback() const override {return cb;};
|
CGameInfoCallback * getCallback() const override {return cb;};
|
||||||
ArtBearer bearerType() const override {return ArtBearer::ALTAR;};
|
ArtBearer bearerType() const override {return ArtBearer::ALTAR;};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "MiscObjects.h"
|
#include "MiscObjects.h"
|
||||||
|
|
||||||
#include "../TerrainHandler.h"
|
#include "../TerrainHandler.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../callback/IGameEventCallback.h"
|
#include "../callback/IGameEventCallback.h"
|
||||||
#include "../mapObjects/CGHeroInstance.h"
|
#include "../mapObjects/CGHeroInstance.h"
|
||||||
#include "../networkPacks/PacksForClient.h"
|
#include "../networkPacks/PacksForClient.h"
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class BoatId;
|
|||||||
class CGObjectInstance;
|
class CGObjectInstance;
|
||||||
class CStackInstance;
|
class CStackInstance;
|
||||||
class CGHeroInstance;
|
class CGHeroInstance;
|
||||||
class CPrivilegedInfoCallback;
|
class CGameInfoCallback;
|
||||||
class IGameEventCallback;
|
class IGameEventCallback;
|
||||||
class ResourceSet;
|
class ResourceSet;
|
||||||
class int3;
|
class int3;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include "MiscObjects.h"
|
#include "MiscObjects.h"
|
||||||
|
|
||||||
#include "../bonuses/Propagators.h"
|
#include "../bonuses/Propagators.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../callback/IGameEventCallback.h"
|
#include "../callback/IGameEventCallback.h"
|
||||||
#include "../constants/StringConstants.h"
|
#include "../constants/StringConstants.h"
|
||||||
#include "../entities/artifact/ArtifactUtils.h"
|
#include "../entities/artifact/ArtifactUtils.h"
|
||||||
@@ -483,7 +483,7 @@ void CGSubterraneanGate::initObj(vstd::RNG & rand)
|
|||||||
type = BOTH;
|
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
|
//split on underground and surface gates
|
||||||
std::vector<CGSubterraneanGate *> gatesSplit[2]; //surface and underground 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)
|
: CGObjectInstance(cb)
|
||||||
{
|
{
|
||||||
direction = 4;
|
direction = 4;
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ class DLL_LINKAGE CGSubterraneanGate : public CGMonolith
|
|||||||
public:
|
public:
|
||||||
using CGMonolith::CGMonolith;
|
using CGMonolith::CGMonolith;
|
||||||
|
|
||||||
static void postInit(CPrivilegedInfoCallback * cb);
|
static void postInit(CGameInfoCallback * cb);
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h)
|
template <typename Handler> void serialize(Handler &h)
|
||||||
{
|
{
|
||||||
@@ -312,7 +312,7 @@ public:
|
|||||||
AnimationPath overlayAnimation; //waves animations
|
AnimationPath overlayAnimation; //waves animations
|
||||||
std::array<AnimationPath, PlayerColor::PLAYER_LIMIT_I> flagAnimations;
|
std::array<AnimationPath, PlayerColor::PLAYER_LIMIT_I> flagAnimations;
|
||||||
|
|
||||||
CGBoat(CPrivilegedInfoCallback * cb);
|
CGBoat(CGameInfoCallback * cb);
|
||||||
bool isCoastVisitable() const override;
|
bool isCoastVisitable() const override;
|
||||||
|
|
||||||
void setBoardedHero(const CGHeroInstance * hero);
|
void setBoardedHero(const CGHeroInstance * hero);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include "TownBuildingInstance.h"
|
#include "TownBuildingInstance.h"
|
||||||
|
|
||||||
#include "CGTownInstance.h"
|
#include "CGTownInstance.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../callback/IGameEventCallback.h"
|
#include "../callback/IGameEventCallback.h"
|
||||||
#include "../mapObjects/CGHeroInstance.h"
|
#include "../mapObjects/CGHeroInstance.h"
|
||||||
#include "../entities/building/CBuilding.h"
|
#include "../entities/building/CBuilding.h"
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
TownBuildingInstance::TownBuildingInstance(CPrivilegedInfoCallback * cb)
|
TownBuildingInstance::TownBuildingInstance(CGameInfoCallback * cb)
|
||||||
: IObjectInterface(cb)
|
: IObjectInterface(cb)
|
||||||
, town(nullptr)
|
, town(nullptr)
|
||||||
{}
|
{}
|
||||||
@@ -62,7 +62,7 @@ int3 TownBuildingInstance::anchorPos() const
|
|||||||
return town->anchorPos();
|
return town->anchorPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
TownRewardableBuildingInstance::TownRewardableBuildingInstance(CPrivilegedInfoCallback *cb)
|
TownRewardableBuildingInstance::TownRewardableBuildingInstance(CGameInfoCallback *cb)
|
||||||
: TownBuildingInstance(cb)
|
: TownBuildingInstance(cb)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class DLL_LINKAGE TownBuildingInstance : public IObjectInterface
|
|||||||
///basic class for town structures handled as map objects
|
///basic class for town structures handled as map objects
|
||||||
public:
|
public:
|
||||||
TownBuildingInstance(CGTownInstance * town, const BuildingID & index);
|
TownBuildingInstance(CGTownInstance * town, const BuildingID & index);
|
||||||
TownBuildingInstance(CPrivilegedInfoCallback *cb);
|
TownBuildingInstance(CGameInfoCallback *cb);
|
||||||
|
|
||||||
CGTownInstance * town;
|
CGTownInstance * town;
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ public:
|
|||||||
void blockingDialogAnswered(IGameEventCallback & gameEvents, const CGHeroInstance *hero, int32_t answer) const override;
|
void blockingDialogAnswered(IGameEventCallback & gameEvents, const CGHeroInstance *hero, int32_t answer) const override;
|
||||||
|
|
||||||
TownRewardableBuildingInstance(CGTownInstance * town, const BuildingID & index, vstd::RNG & rand);
|
TownRewardableBuildingInstance(CGTownInstance * town, const BuildingID & index, vstd::RNG & rand);
|
||||||
TownRewardableBuildingInstance(CPrivilegedInfoCallback *cb);
|
TownRewardableBuildingInstance(CGameInfoCallback *cb);
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h)
|
template <typename Handler> void serialize(Handler &h)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include "../RoadHandler.h"
|
#include "../RoadHandler.h"
|
||||||
#include "../TerrainHandler.h"
|
#include "../TerrainHandler.h"
|
||||||
|
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../entities/artifact/CArtHandler.h"
|
#include "../entities/artifact/CArtHandler.h"
|
||||||
#include "../entities/hero/CHeroHandler.h"
|
#include "../entities/hero/CHeroHandler.h"
|
||||||
#include "../gameState/CGameState.h"
|
#include "../gameState/CGameState.h"
|
||||||
@@ -170,7 +170,7 @@ EDiggingStatus TerrainTile::getDiggingStatus(const bool excludeTop) const
|
|||||||
return EDiggingStatus::CAN_DIG;
|
return EDiggingStatus::CAN_DIG;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMap::CMap(CPrivilegedInfoCallback * cb)
|
CMap::CMap(CGameInfoCallback * cb)
|
||||||
: GameCallbackHolder(cb)
|
: GameCallbackHolder(cb)
|
||||||
, grailPos(-1, -1, -1)
|
, grailPos(-1, -1, -1)
|
||||||
, grailRadius(0)
|
, grailRadius(0)
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public:
|
|||||||
/// TODO: make private
|
/// TODO: make private
|
||||||
std::vector<std::shared_ptr<CGObjectInstance>> objects;
|
std::vector<std::shared_ptr<CGObjectInstance>> objects;
|
||||||
|
|
||||||
explicit CMap(CPrivilegedInfoCallback *cb);
|
explicit CMap(CGameInfoCallback *cb);
|
||||||
~CMap();
|
~CMap();
|
||||||
void initTerrain();
|
void initTerrain();
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
|
||||||
std::unique_ptr<CMap> CMapService::loadMap(const ResourcePath & name, CPrivilegedInfoCallback * cb) const
|
std::unique_ptr<CMap> CMapService::loadMap(const ResourcePath & name, CGameInfoCallback * cb) const
|
||||||
{
|
{
|
||||||
std::string modName = LIBRARY->modh->findResourceOrigin(name);
|
std::string modName = LIBRARY->modh->findResourceOrigin(name);
|
||||||
std::string encoding = LIBRARY->modh->findResourceEncoding(name);
|
std::string encoding = LIBRARY->modh->findResourceEncoding(name);
|
||||||
@@ -48,7 +48,7 @@ std::unique_ptr<CMapHeader> CMapService::loadMapHeader(const ResourcePath & name
|
|||||||
return getMapLoader(stream, name.getName(), modName, encoding)->loadMapHeader();
|
return getMapLoader(stream, name.getName(), modName, encoding)->loadMapHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CMap> CMapService::loadMap(const uint8_t * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding, CPrivilegedInfoCallback * cb) const
|
std::unique_ptr<CMap> CMapService::loadMap(const uint8_t * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding, CGameInfoCallback * cb) const
|
||||||
{
|
{
|
||||||
auto stream = getStreamFromMem(buffer, size);
|
auto stream = getStreamFromMem(buffer, size);
|
||||||
std::unique_ptr<CMap> map(getMapLoader(stream, name, modName, encoding)->loadMap(cb));
|
std::unique_ptr<CMap> map(getMapLoader(stream, name, modName, encoding)->loadMap(cb));
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class CInputStream;
|
|||||||
|
|
||||||
class IMapLoader;
|
class IMapLoader;
|
||||||
class IMapPatcher;
|
class IMapPatcher;
|
||||||
class CPrivilegedInfoCallback;
|
class CGameInfoCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The map service provides loading of VCMI/H3 map files. It can
|
* The map service provides loading of VCMI/H3 map files. It can
|
||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
* @param name the name of the map
|
* @param name the name of the map
|
||||||
* @return a unique ptr to the loaded map class
|
* @return a unique ptr to the loaded map class
|
||||||
*/
|
*/
|
||||||
virtual std::unique_ptr<CMap> loadMap(const ResourcePath & name, CPrivilegedInfoCallback * cb) const = 0;
|
virtual std::unique_ptr<CMap> loadMap(const ResourcePath & name, CGameInfoCallback * cb) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the VCMI/H3 map header specified by the name.
|
* Loads the VCMI/H3 map header specified by the name.
|
||||||
@@ -56,7 +56,7 @@ public:
|
|||||||
* @param name indicates name of file that will be used during map header patching
|
* @param name indicates name of file that will be used during map header patching
|
||||||
* @return a unique ptr to the loaded map class
|
* @return a unique ptr to the loaded map class
|
||||||
*/
|
*/
|
||||||
virtual std::unique_ptr<CMap> loadMap(const uint8_t * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding, CPrivilegedInfoCallback * cb) const = 0;
|
virtual std::unique_ptr<CMap> loadMap(const uint8_t * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding, CGameInfoCallback * cb) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the VCMI/H3 map header from a buffer. This method is temporarily
|
* Loads the VCMI/H3 map header from a buffer. This method is temporarily
|
||||||
@@ -81,9 +81,9 @@ public:
|
|||||||
CMapService() = default;
|
CMapService() = default;
|
||||||
virtual ~CMapService() = default;
|
virtual ~CMapService() = default;
|
||||||
|
|
||||||
std::unique_ptr<CMap> loadMap(const ResourcePath & name, CPrivilegedInfoCallback * cb) const override;
|
std::unique_ptr<CMap> loadMap(const ResourcePath & name, CGameInfoCallback * cb) const override;
|
||||||
std::unique_ptr<CMapHeader> loadMapHeader(const ResourcePath & name) const override;
|
std::unique_ptr<CMapHeader> loadMapHeader(const ResourcePath & name) const override;
|
||||||
std::unique_ptr<CMap> loadMap(const uint8_t * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding, CPrivilegedInfoCallback * cb) const override;
|
std::unique_ptr<CMap> loadMap(const uint8_t * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding, CGameInfoCallback * cb) const override;
|
||||||
std::unique_ptr<CMapHeader> loadMapHeader(const uint8_t * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding) const override;
|
std::unique_ptr<CMapHeader> loadMapHeader(const uint8_t * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding) const override;
|
||||||
void saveMap(const std::unique_ptr<CMap> & map, boost::filesystem::path fullPath) const override;
|
void saveMap(const std::unique_ptr<CMap> & map, boost::filesystem::path fullPath) const override;
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @return a unique ptr of the loaded map class
|
* @return a unique ptr of the loaded map class
|
||||||
*/
|
*/
|
||||||
virtual std::unique_ptr<CMap> loadMap(CPrivilegedInfoCallback * cb) = 0;
|
virtual std::unique_ptr<CMap> loadMap(CGameInfoCallback * cb) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the VCMI/H3 map header.
|
* Loads the VCMI/H3 map header.
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ CMapLoaderH3M::CMapLoaderH3M(const std::string & mapName, const std::string & mo
|
|||||||
//must be instantiated in .cpp file for access to complete types of all member fields
|
//must be instantiated in .cpp file for access to complete types of all member fields
|
||||||
CMapLoaderH3M::~CMapLoaderH3M() = default;
|
CMapLoaderH3M::~CMapLoaderH3M() = default;
|
||||||
|
|
||||||
std::unique_ptr<CMap> CMapLoaderH3M::loadMap(CPrivilegedInfoCallback * cb)
|
std::unique_ptr<CMap> CMapLoaderH3M::loadMap(CGameInfoCallback * cb)
|
||||||
{
|
{
|
||||||
// Init map object by parsing the input buffer
|
// Init map object by parsing the input buffer
|
||||||
map = new CMap(cb);
|
map = new CMap(cb);
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @return a unique ptr of the loaded map class
|
* @return a unique ptr of the loaded map class
|
||||||
*/
|
*/
|
||||||
std::unique_ptr<CMap> loadMap(CPrivilegedInfoCallback * cb) override;
|
std::unique_ptr<CMap> loadMap(CGameInfoCallback * cb) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the VCMI/H3 map header.
|
* Loads the VCMI/H3 map header.
|
||||||
|
|||||||
@@ -767,7 +767,7 @@ CMapLoaderJson::CMapLoaderJson(CInputStream * stream)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CMap> CMapLoaderJson::loadMap(CPrivilegedInfoCallback * cb)
|
std::unique_ptr<CMap> CMapLoaderJson::loadMap(CGameInfoCallback * cb)
|
||||||
{
|
{
|
||||||
LOG_TRACE(logGlobal);
|
LOG_TRACE(logGlobal);
|
||||||
auto result = std::make_unique<CMap>(cb);
|
auto result = std::make_unique<CMap>(cb);
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @return a unique ptr of the loaded map class
|
* @return a unique ptr of the loaded map class
|
||||||
*/
|
*/
|
||||||
std::unique_ptr<CMap> loadMap(CPrivilegedInfoCallback * cb) override;
|
std::unique_ptr<CMap> loadMap(CGameInfoCallback * cb) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the VCMI/Json map header.
|
* Loads the VCMI/Json map header.
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ bool ObstacleProxy::isProhibited(const rmg::Area& objArea) const
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
int ObstacleProxy::getWeightedObjects(const int3 & tile, vstd::RNG & rand, CPrivilegedInfoCallback * cb, std::list<rmg::Object> & allObjects, std::vector<std::pair<rmg::Object*, int3>> & weightedObjects)
|
int ObstacleProxy::getWeightedObjects(const int3 & tile, vstd::RNG & rand, CGameInfoCallback * cb, std::list<rmg::Object> & allObjects, std::vector<std::pair<rmg::Object*, int3>> & weightedObjects)
|
||||||
{
|
{
|
||||||
int maxWeight = std::numeric_limits<int>::min();
|
int maxWeight = std::numeric_limits<int>::min();
|
||||||
for(auto & possibleObstacle : possibleObstacles)
|
for(auto & possibleObstacle : possibleObstacles)
|
||||||
@@ -311,7 +311,7 @@ int ObstacleProxy::getWeightedObjects(const int3 & tile, vstd::RNG & rand, CPriv
|
|||||||
return maxWeight;
|
return maxWeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<std::shared_ptr<CGObjectInstance>> ObstacleProxy::createObstacles(vstd::RNG & rand, CPrivilegedInfoCallback * cb)
|
std::set<std::shared_ptr<CGObjectInstance>> ObstacleProxy::createObstacles(vstd::RNG & rand, CGameInfoCallback * cb)
|
||||||
{
|
{
|
||||||
//reverse order, since obstacles begin in bottom-right corner, while the map coordinates begin in top-left
|
//reverse order, since obstacles begin in bottom-right corner, while the map coordinates begin in top-left
|
||||||
auto blockedTiles = blockedArea.getTilesVector();
|
auto blockedTiles = blockedArea.getTilesVector();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ VCMI_LIB_NAMESPACE_BEGIN
|
|||||||
class CMapEditManager;
|
class CMapEditManager;
|
||||||
class CGObjectInstance;
|
class CGObjectInstance;
|
||||||
class ObjectTemplate;
|
class ObjectTemplate;
|
||||||
class CPrivilegedInfoCallback;
|
class CGameInfoCallback;
|
||||||
class ObstacleSetFilter;
|
class ObstacleSetFilter;
|
||||||
|
|
||||||
class DLL_LINKAGE ObstacleProxy
|
class DLL_LINKAGE ObstacleProxy
|
||||||
@@ -43,7 +43,7 @@ public:
|
|||||||
|
|
||||||
virtual void placeObject(rmg::Object & object, std::set<std::shared_ptr<CGObjectInstance>> & instances);
|
virtual void placeObject(rmg::Object & object, std::set<std::shared_ptr<CGObjectInstance>> & instances);
|
||||||
|
|
||||||
virtual std::set<std::shared_ptr<CGObjectInstance>> createObstacles(vstd::RNG & rand, CPrivilegedInfoCallback * cb);
|
virtual std::set<std::shared_ptr<CGObjectInstance>> createObstacles(vstd::RNG & rand, CGameInfoCallback * cb);
|
||||||
|
|
||||||
virtual bool isInTheMap(const int3& tile) = 0;
|
virtual bool isInTheMap(const int3& tile) = 0;
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ public:
|
|||||||
virtual void postProcess(const rmg::Object& object) {};
|
virtual void postProcess(const rmg::Object& object) {};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int getWeightedObjects(const int3& tile, vstd::RNG& rand, CPrivilegedInfoCallback * cb, std::list<rmg::Object>& allObjects, std::vector<std::pair<rmg::Object*, int3>>& weightedObjects);
|
int getWeightedObjects(const int3& tile, vstd::RNG& rand, CGameInfoCallback * cb, std::list<rmg::Object>& allObjects, std::vector<std::pair<rmg::Object*, int3>>& weightedObjects);
|
||||||
void sortObstacles();
|
void sortObstacles();
|
||||||
|
|
||||||
rmg::Area blockedArea;
|
rmg::Area blockedArea;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#include "../CPlayerState.h"
|
#include "../CPlayerState.h"
|
||||||
#include "../TerrainHandler.h"
|
#include "../TerrainHandler.h"
|
||||||
#include "../RoadHandler.h"
|
#include "../RoadHandler.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../mapObjects/CGHeroInstance.h"
|
#include "../mapObjects/CGHeroInstance.h"
|
||||||
#include "../mapObjects/CGTownInstance.h"
|
#include "../mapObjects/CGTownInstance.h"
|
||||||
#include "../mapObjects/MiscObjects.h"
|
#include "../mapObjects/MiscObjects.h"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "../TerrainHandler.h"
|
#include "../TerrainHandler.h"
|
||||||
#include "../GameLibrary.h"
|
#include "../GameLibrary.h"
|
||||||
#include "../bonuses/BonusList.h"
|
#include "../bonuses/BonusList.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../json/JsonNode.h"
|
#include "../json/JsonNode.h"
|
||||||
#include "../mapObjects/CGHeroInstance.h"
|
#include "../mapObjects/CGHeroInstance.h"
|
||||||
#include "../mapObjects/MiscObjects.h"
|
#include "../mapObjects/MiscObjects.h"
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ void Rewardable::Info::init(const JsonNode & objectConfig, const std::string & o
|
|||||||
loadString(parameters["onGuardedMessage"], TextIdentifier(objectName, "onGuarded"));
|
loadString(parameters["onGuardedMessage"], TextIdentifier(objectName, "onGuarded"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Rewardable::LimitersList Rewardable::Info::configureSublimiters(Rewardable::Configuration & object, vstd::RNG & rng, CPrivilegedInfoCallback * cb, const JsonNode & source) const
|
Rewardable::LimitersList Rewardable::Info::configureSublimiters(Rewardable::Configuration & object, vstd::RNG & rng, CGameInfoCallback * cb, const JsonNode & source) const
|
||||||
{
|
{
|
||||||
Rewardable::LimitersList result;
|
Rewardable::LimitersList result;
|
||||||
for (const auto & input : source.Vector())
|
for (const auto & input : source.Vector())
|
||||||
@@ -123,7 +123,7 @@ Rewardable::LimitersList Rewardable::Info::configureSublimiters(Rewardable::Conf
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rewardable::Info::configureLimiter(Rewardable::Configuration & object, vstd::RNG & rng, CPrivilegedInfoCallback * cb, Rewardable::Limiter & limiter, const JsonNode & source) const
|
void Rewardable::Info::configureLimiter(Rewardable::Configuration & object, vstd::RNG & rng, CGameInfoCallback * cb, Rewardable::Limiter & limiter, const JsonNode & source) const
|
||||||
{
|
{
|
||||||
auto const & variables = object.variables.values;
|
auto const & variables = object.variables.values;
|
||||||
JsonRandom randomizer(cb);
|
JsonRandom randomizer(cb);
|
||||||
@@ -160,7 +160,7 @@ void Rewardable::Info::configureLimiter(Rewardable::Configuration & object, vstd
|
|||||||
limiter.noneOf = configureSublimiters(object, rng, cb, source["noneOf"] );
|
limiter.noneOf = configureSublimiters(object, rng, cb, source["noneOf"] );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rewardable::Info::configureReward(Rewardable::Configuration & object, vstd::RNG & rng, CPrivilegedInfoCallback * cb, Rewardable::Reward & reward, const JsonNode & source) const
|
void Rewardable::Info::configureReward(Rewardable::Configuration & object, vstd::RNG & rng, CGameInfoCallback * cb, Rewardable::Reward & reward, const JsonNode & source) const
|
||||||
{
|
{
|
||||||
auto const & variables = object.variables.values;
|
auto const & variables = object.variables.values;
|
||||||
JsonRandom randomizer(cb);
|
JsonRandom randomizer(cb);
|
||||||
@@ -233,7 +233,7 @@ void Rewardable::Info::configureResetInfo(Rewardable::Configuration & object, vs
|
|||||||
resetParameters.rewards = source["rewards"].Bool();
|
resetParameters.rewards = source["rewards"].Bool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rewardable::Info::configureVariables(Rewardable::Configuration & object, vstd::RNG & rng, CPrivilegedInfoCallback * cb, const JsonNode & source) const
|
void Rewardable::Info::configureVariables(Rewardable::Configuration & object, vstd::RNG & rng, CGameInfoCallback * cb, const JsonNode & source) const
|
||||||
{
|
{
|
||||||
JsonRandom randomizer(cb);
|
JsonRandom randomizer(cb);
|
||||||
|
|
||||||
@@ -351,7 +351,7 @@ void Rewardable::Info::replaceTextPlaceholders(MetaString & target, const Variab
|
|||||||
void Rewardable::Info::configureRewards(
|
void Rewardable::Info::configureRewards(
|
||||||
Rewardable::Configuration & object,
|
Rewardable::Configuration & object,
|
||||||
vstd::RNG & rng,
|
vstd::RNG & rng,
|
||||||
CPrivilegedInfoCallback * cb,
|
CGameInfoCallback * cb,
|
||||||
const JsonNode & source,
|
const JsonNode & source,
|
||||||
Rewardable::EEventType event,
|
Rewardable::EEventType event,
|
||||||
const std::string & modeName) const
|
const std::string & modeName) const
|
||||||
@@ -408,7 +408,7 @@ void Rewardable::Info::configureRewards(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rewardable::Info::configureObject(Rewardable::Configuration & object, vstd::RNG & rng, CPrivilegedInfoCallback * cb) const
|
void Rewardable::Info::configureObject(Rewardable::Configuration & object, vstd::RNG & rng, CGameInfoCallback * cb) const
|
||||||
{
|
{
|
||||||
object.info.clear();
|
object.info.clear();
|
||||||
object.variables.values.clear();
|
object.variables.values.clear();
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class RNG;
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MetaString;
|
class MetaString;
|
||||||
class CPrivilegedInfoCallback;
|
class CGameInfoCallback;
|
||||||
|
|
||||||
namespace Rewardable
|
namespace Rewardable
|
||||||
{
|
{
|
||||||
@@ -42,13 +42,13 @@ class DLL_LINKAGE Info : public IObjectInfo
|
|||||||
void replaceTextPlaceholders(MetaString & target, const Variables & variables) const;
|
void replaceTextPlaceholders(MetaString & target, const Variables & variables) const;
|
||||||
void replaceTextPlaceholders(MetaString & target, const Variables & variables, const VisitInfo & info) const;
|
void replaceTextPlaceholders(MetaString & target, const Variables & variables, const VisitInfo & info) const;
|
||||||
|
|
||||||
void configureVariables(Rewardable::Configuration & object, vstd::RNG & rng, CPrivilegedInfoCallback * cb, const JsonNode & source) const;
|
void configureVariables(Rewardable::Configuration & object, vstd::RNG & rng, CGameInfoCallback * cb, const JsonNode & source) const;
|
||||||
void configureRewards(Rewardable::Configuration & object, vstd::RNG & rng, CPrivilegedInfoCallback * cb, const JsonNode & source, Rewardable::EEventType mode, const std::string & textPrefix) const;
|
void configureRewards(Rewardable::Configuration & object, vstd::RNG & rng, CGameInfoCallback * cb, const JsonNode & source, Rewardable::EEventType mode, const std::string & textPrefix) const;
|
||||||
|
|
||||||
void configureLimiter(Rewardable::Configuration & object, vstd::RNG & rng, CPrivilegedInfoCallback * cb, Rewardable::Limiter & limiter, const JsonNode & source) const;
|
void configureLimiter(Rewardable::Configuration & object, vstd::RNG & rng, CGameInfoCallback * cb, Rewardable::Limiter & limiter, const JsonNode & source) const;
|
||||||
Rewardable::LimitersList configureSublimiters(Rewardable::Configuration & object, vstd::RNG & rng, CPrivilegedInfoCallback * cb, const JsonNode & source) const;
|
Rewardable::LimitersList configureSublimiters(Rewardable::Configuration & object, vstd::RNG & rng, CGameInfoCallback * cb, const JsonNode & source) const;
|
||||||
|
|
||||||
void configureReward(Rewardable::Configuration & object, vstd::RNG & rng, CPrivilegedInfoCallback * cb, Rewardable::Reward & info, const JsonNode & source) const;
|
void configureReward(Rewardable::Configuration & object, vstd::RNG & rng, CGameInfoCallback * cb, Rewardable::Reward & info, const JsonNode & source) const;
|
||||||
void configureResetInfo(Rewardable::Configuration & object, vstd::RNG & rng, Rewardable::ResetInfo & info, const JsonNode & source) const;
|
void configureResetInfo(Rewardable::Configuration & object, vstd::RNG & rng, Rewardable::ResetInfo & info, const JsonNode & source) const;
|
||||||
public:
|
public:
|
||||||
const JsonNode & getParameters() const;
|
const JsonNode & getParameters() const;
|
||||||
@@ -70,7 +70,7 @@ public:
|
|||||||
|
|
||||||
bool hasGuards() const override;
|
bool hasGuards() const override;
|
||||||
|
|
||||||
void configureObject(Rewardable::Configuration & object, vstd::RNG & rng, CPrivilegedInfoCallback * cb) const;
|
void configureObject(Rewardable::Configuration & object, vstd::RNG & rng, CGameInfoCallback * cb) const;
|
||||||
|
|
||||||
void init(const JsonNode & objectConfig, const std::string & objectTextID);
|
void init(const JsonNode & objectConfig, const std::string & objectTextID);
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "../TerrainHandler.h"
|
#include "../TerrainHandler.h"
|
||||||
#include "../CPlayerState.h"
|
#include "../CPlayerState.h"
|
||||||
#include "../CSoundBase.h"
|
#include "../CSoundBase.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../callback/IGameEventCallback.h"
|
#include "../callback/IGameEventCallback.h"
|
||||||
#include "../entities/hero/CHeroHandler.h"
|
#include "../entities/hero/CHeroHandler.h"
|
||||||
#include "../gameState/CGameState.h"
|
#include "../gameState/CGameState.h"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include "../CPlayerState.h"
|
#include "../CPlayerState.h"
|
||||||
#include "../CSkillHandler.h"
|
#include "../CSkillHandler.h"
|
||||||
#include "../callback/CPrivilegedInfoCallback.h"
|
#include "../callback/CGameInfoCallback.h"
|
||||||
#include "../constants/StringConstants.h"
|
#include "../constants/StringConstants.h"
|
||||||
#include "../entities/artifact/ArtifactUtils.h"
|
#include "../entities/artifact/ArtifactUtils.h"
|
||||||
#include "../mapObjects/CGHeroInstance.h"
|
#include "../mapObjects/CGHeroInstance.h"
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
CMapGenerator::CMapGenerator(CMapGenOptions& mapGenOptions, CPrivilegedInfoCallback * cb, int RandomSeed) :
|
CMapGenerator::CMapGenerator(CMapGenOptions& mapGenOptions, CGameInfoCallback * cb, int RandomSeed) :
|
||||||
mapGenOptions(mapGenOptions), randomSeed(RandomSeed),
|
mapGenOptions(mapGenOptions), randomSeed(RandomSeed),
|
||||||
monolithIndex(0),
|
monolithIndex(0),
|
||||||
rand(std::make_unique<CRandomGenerator>(RandomSeed))
|
rand(std::make_unique<CRandomGenerator>(RandomSeed))
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class RmgMap;
|
|||||||
class CMap;
|
class CMap;
|
||||||
class Zone;
|
class Zone;
|
||||||
class CZonePlacer;
|
class CZonePlacer;
|
||||||
class CPrivilegedInfoCallback;
|
class CGameInfoCallback;
|
||||||
|
|
||||||
using JsonVector = std::vector<JsonNode>;
|
using JsonVector = std::vector<JsonNode>;
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
bool singleThread;
|
bool singleThread;
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit CMapGenerator(CMapGenOptions& mapGenOptions, CPrivilegedInfoCallback * cb, int RandomSeed);
|
explicit CMapGenerator(CMapGenOptions& mapGenOptions, CGameInfoCallback * cb, int RandomSeed);
|
||||||
~CMapGenerator(); // required due to std::unique_ptr
|
~CMapGenerator(); // required due to std::unique_ptr
|
||||||
|
|
||||||
const Config & getConfig() const;
|
const Config & getConfig() const;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
RmgMap::RmgMap(const CMapGenOptions& mapGenOptions, CPrivilegedInfoCallback * cb) :
|
RmgMap::RmgMap(const CMapGenOptions& mapGenOptions, CGameInfoCallback * cb) :
|
||||||
mapGenOptions(mapGenOptions), zonesTotal(0)
|
mapGenOptions(mapGenOptions), zonesTotal(0)
|
||||||
{
|
{
|
||||||
mapInstance = std::make_unique<CMap>(cb);
|
mapInstance = std::make_unique<CMap>(cb);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
std::shared_ptr<MapProxy> getMapProxy() const;
|
std::shared_ptr<MapProxy> getMapProxy() const;
|
||||||
CMap & getMap(const CMapGenerator *) const; //limited access
|
CMap & getMap(const CMapGenerator *) const; //limited access
|
||||||
|
|
||||||
RmgMap(const CMapGenOptions& mapGenOptions, CPrivilegedInfoCallback * cb);
|
RmgMap(const CMapGenOptions& mapGenOptions, CGameInfoCallback * cb);
|
||||||
~RmgMap() = default;
|
~RmgMap() = default;
|
||||||
|
|
||||||
CMapEditManager* getEditManager() const;
|
CMapEditManager* getEditManager() const;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public:
|
|||||||
using Version = ESerializationVersion;
|
using Version = ESerializationVersion;
|
||||||
static constexpr bool saving = false;
|
static constexpr bool saving = false;
|
||||||
|
|
||||||
CPrivilegedInfoCallback * cb = nullptr;
|
CGameInfoCallback * cb = nullptr;
|
||||||
Version version = Version::NONE;
|
Version version = Version::NONE;
|
||||||
bool loadingGamestate = false;
|
bool loadingGamestate = false;
|
||||||
bool reverseEndianness = false; //if source has different endianness than us, we reverse bytes
|
bool reverseEndianness = false; //if source has different endianness than us, we reverse bytes
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ struct static_caster
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
CLoadFile::CLoadFile(const boost::filesystem::path & fname, CPrivilegedInfoCallback * cb)
|
CLoadFile::CLoadFile(const boost::filesystem::path & fname, CGameInfoCallback * cb)
|
||||||
: serializer(this)
|
: serializer(this)
|
||||||
, sfile(fname.c_str(), std::ios::in | std::ios::binary)
|
, sfile(fname.c_str(), std::ios::in | std::ios::binary)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class DLL_LINKAGE CLoadFile : public IBinaryReader
|
|||||||
int read(std::byte * data, unsigned size) override; //throws!
|
int read(std::byte * data, unsigned size) override; //throws!
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLoadFile(const boost::filesystem::path & fname, CPrivilegedInfoCallback * cb); //throws!
|
CLoadFile(const boost::filesystem::path & fname, CGameInfoCallback * cb); //throws!
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void load(T & data)
|
void load(T & data)
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ void CConnection::enterLobbyConnectionMode()
|
|||||||
serializer->clear();
|
serializer->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConnection::setCallback(CPrivilegedInfoCallback * cb)
|
void CConnection::setCallback(CGameInfoCallback * cb)
|
||||||
{
|
{
|
||||||
deserializer->cb = cb;
|
deserializer->cb = cb;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class INetworkConnection;
|
|||||||
class ConnectionPackReader;
|
class ConnectionPackReader;
|
||||||
class ConnectionPackWriter;
|
class ConnectionPackWriter;
|
||||||
class CGameState;
|
class CGameState;
|
||||||
class CPrivilegedInfoCallback;
|
class CGameInfoCallback;
|
||||||
|
|
||||||
/// Wrapper class for game connection
|
/// Wrapper class for game connection
|
||||||
/// Handles serialization and deserialization of data received from network
|
/// Handles serialization and deserialization of data received from network
|
||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
std::unique_ptr<CPack> retrievePack(const std::vector<std::byte> & data);
|
std::unique_ptr<CPack> retrievePack(const std::vector<std::byte> & data);
|
||||||
|
|
||||||
void enterLobbyConnectionMode();
|
void enterLobbyConnectionMode();
|
||||||
void setCallback(CPrivilegedInfoCallback * cb);
|
void setCallback(CGameInfoCallback * cb);
|
||||||
void enterGameplayConnectionMode(CGameState & gs);
|
void enterGameplayConnectionMode(CGameState & gs);
|
||||||
void setSerializationVersion(ESerializationVersion version);
|
void setSerializationVersion(ESerializationVersion version);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -30,12 +30,12 @@ template<typename Type>
|
|||||||
class SerializerReflection final : public ISerializerReflection
|
class SerializerReflection final : public ISerializerReflection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Serializeable * createPtr(BinaryDeserializer &ar, CPrivilegedInfoCallback * cb) const override
|
Serializeable * createPtr(BinaryDeserializer &ar, CGameInfoCallback * cb) const override
|
||||||
{
|
{
|
||||||
return ClassObjectCreator<Type>::invoke(cb);
|
return ClassObjectCreator<Type>::invoke(cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadPtr(BinaryDeserializer &ar, CPrivilegedInfoCallback * cb, Serializeable * data) const override
|
void loadPtr(BinaryDeserializer &ar, CGameInfoCallback * cb, Serializeable * data) const override
|
||||||
{
|
{
|
||||||
auto * realPtr = dynamic_cast<Type *>(data);
|
auto * realPtr = dynamic_cast<Type *>(data);
|
||||||
realPtr->serialize(ar);
|
realPtr->serialize(ar);
|
||||||
@@ -52,7 +52,7 @@ template<typename Type, ESerializationVersion maxVersion>
|
|||||||
class SerializerCompatibility : public ISerializerReflection
|
class SerializerCompatibility : public ISerializerReflection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Serializeable * createPtr(BinaryDeserializer &ar, CPrivilegedInfoCallback * cb) const override
|
Serializeable * createPtr(BinaryDeserializer &ar, CGameInfoCallback * cb) const override
|
||||||
{
|
{
|
||||||
return ClassObjectCreator<Type>::invoke(cb);
|
return ClassObjectCreator<Type>::invoke(cb);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
class CPrivilegedInfoCallback;
|
class CGameInfoCallback;
|
||||||
class Serializeable;
|
class Serializeable;
|
||||||
class GameCallbackHolder;
|
class GameCallbackHolder;
|
||||||
class BinaryDeserializer;
|
class BinaryDeserializer;
|
||||||
@@ -21,7 +21,7 @@ class GameCallbackHolder;
|
|||||||
template <typename T, typename Enable = void>
|
template <typename T, typename Enable = void>
|
||||||
struct ClassObjectCreator
|
struct ClassObjectCreator
|
||||||
{
|
{
|
||||||
static T *invoke(CPrivilegedInfoCallback *cb)
|
static T *invoke(CGameInfoCallback *cb)
|
||||||
{
|
{
|
||||||
static_assert(!std::is_base_of_v<GameCallbackHolder, T>, "Cannot call new upon map objects!");
|
static_assert(!std::is_base_of_v<GameCallbackHolder, T>, "Cannot call new upon map objects!");
|
||||||
static_assert(!std::is_abstract_v<T>, "Cannot call new upon abstract classes!");
|
static_assert(!std::is_abstract_v<T>, "Cannot call new upon abstract classes!");
|
||||||
@@ -32,7 +32,7 @@ struct ClassObjectCreator
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
struct ClassObjectCreator<T, typename std::enable_if_t<std::is_base_of_v<GameCallbackHolder, T>>>
|
struct ClassObjectCreator<T, typename std::enable_if_t<std::is_base_of_v<GameCallbackHolder, T>>>
|
||||||
{
|
{
|
||||||
static T *invoke(CPrivilegedInfoCallback *cb)
|
static T *invoke(CGameInfoCallback *cb)
|
||||||
{
|
{
|
||||||
static_assert(!std::is_abstract_v<T>, "Cannot call new upon abstract classes!");
|
static_assert(!std::is_abstract_v<T>, "Cannot call new upon abstract classes!");
|
||||||
return new T(cb);
|
return new T(cb);
|
||||||
@@ -42,8 +42,8 @@ struct ClassObjectCreator<T, typename std::enable_if_t<std::is_base_of_v<GameCal
|
|||||||
class ISerializerReflection
|
class ISerializerReflection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual Serializeable * createPtr(BinaryDeserializer &ar, CPrivilegedInfoCallback * cb) const =0;
|
virtual Serializeable * createPtr(BinaryDeserializer &ar, CGameInfoCallback * cb) const =0;
|
||||||
virtual void loadPtr(BinaryDeserializer &ar, CPrivilegedInfoCallback * cb, Serializeable * data) const =0;
|
virtual void loadPtr(BinaryDeserializer &ar, CGameInfoCallback * cb, Serializeable * data) const =0;
|
||||||
virtual void savePtr(BinarySerializer &ar, const Serializeable *data) const =0;
|
virtual void savePtr(BinarySerializer &ar, const Serializeable *data) const =0;
|
||||||
virtual ~ISerializerReflection() = default;
|
virtual ~ISerializerReflection() = default;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include <vcmi/Environment.h>
|
#include <vcmi/Environment.h>
|
||||||
|
|
||||||
#include "../lib/callback/CPrivilegedInfoCallback.h"
|
#include "../lib/callback/CGameInfoCallback.h"
|
||||||
#include "../lib/callback/IGameEventCallback.h"
|
#include "../lib/callback/IGameEventCallback.h"
|
||||||
#include "../lib/LoadProgress.h"
|
#include "../lib/LoadProgress.h"
|
||||||
#include "../lib/ScriptHandler.h"
|
#include "../lib/ScriptHandler.h"
|
||||||
@@ -54,7 +54,7 @@ class QueriesProcessor;
|
|||||||
class CObjectVisitQuery;
|
class CObjectVisitQuery;
|
||||||
class NewTurnProcessor;
|
class NewTurnProcessor;
|
||||||
|
|
||||||
class CGameHandler : public CPrivilegedInfoCallback, public Environment, public IGameEventCallback
|
class CGameHandler : public CGameInfoCallback, public Environment, public IGameEventCallback
|
||||||
{
|
{
|
||||||
CVCMIServer * lobby;
|
CVCMIServer * lobby;
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ public:
|
|||||||
~CGameHandler();
|
~CGameHandler();
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
//from CPrivilegedInfoCallback
|
//from CGameInfoCallback
|
||||||
//do sth
|
//do sth
|
||||||
void changeSpells(const CGHeroInstance * hero, bool give, const std::set<SpellID> &spells) override;
|
void changeSpells(const CGHeroInstance * hero, bool give, const std::set<SpellID> &spells) override;
|
||||||
void setResearchedSpells(const CGTownInstance * town, int level, const std::vector<SpellID> & spells, bool accepted) override;
|
void setResearchedSpells(const CGTownInstance * town, int level, const std::vector<SpellID> & spells, bool accepted) override;
|
||||||
|
|||||||
@@ -12,12 +12,12 @@
|
|||||||
|
|
||||||
#include <vcmi/ServerCallback.h>
|
#include <vcmi/ServerCallback.h>
|
||||||
|
|
||||||
#include "../../lib/callback/CPrivilegedInfoCallback.h"
|
#include "../../lib/callback/CGameInfoCallback.h"
|
||||||
#include "../../lib/callback/IGameEventCallback.h"
|
#include "../../lib/callback/IGameEventCallback.h"
|
||||||
#include "../../lib/int3.h"
|
#include "../../lib/int3.h"
|
||||||
#include "../../lib/ResourceSet.h"
|
#include "../../lib/ResourceSet.h"
|
||||||
|
|
||||||
class GameCallbackMock : public CPrivilegedInfoCallback, public IGameEventCallback
|
class GameCallbackMock : public CGameInfoCallback, public IGameEventCallback
|
||||||
{
|
{
|
||||||
std::shared_ptr<CGameState> gamestate;
|
std::shared_ptr<CGameState> gamestate;
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ std::unique_ptr<CMap> MapServiceMock::loadMap() const
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CMap> MapServiceMock::loadMap(const ResourcePath & name, CPrivilegedInfoCallback * cb) const
|
std::unique_ptr<CMap> MapServiceMock::loadMap(const ResourcePath & name, CGameInfoCallback * cb) const
|
||||||
{
|
{
|
||||||
return loadMap();
|
return loadMap();
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ std::unique_ptr<CMapHeader> MapServiceMock::loadMapHeader(const ResourcePath & n
|
|||||||
return initialLoader.loadMapHeader();
|
return initialLoader.loadMapHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CMap> MapServiceMock::loadMap(const ui8 * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding, CPrivilegedInfoCallback * cb) const
|
std::unique_ptr<CMap> MapServiceMock::loadMap(const ui8 * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding, CGameInfoCallback * cb) const
|
||||||
{
|
{
|
||||||
return loadMap();
|
return loadMap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ class MapServiceMock : public IMapService
|
|||||||
public:
|
public:
|
||||||
MapServiceMock(const std::string & path, MapListener * mapListener_);
|
MapServiceMock(const std::string & path, MapListener * mapListener_);
|
||||||
|
|
||||||
std::unique_ptr<CMap> loadMap(const ResourcePath & name, CPrivilegedInfoCallback * cb) const override;
|
std::unique_ptr<CMap> loadMap(const ResourcePath & name, CGameInfoCallback * cb) const override;
|
||||||
std::unique_ptr<CMapHeader> loadMapHeader(const ResourcePath & name) const override;
|
std::unique_ptr<CMapHeader> loadMapHeader(const ResourcePath & name) const override;
|
||||||
std::unique_ptr<CMap> loadMap(const ui8 * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding, CPrivilegedInfoCallback * cb) const override;
|
std::unique_ptr<CMap> loadMap(const ui8 * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding, CGameInfoCallback * cb) const override;
|
||||||
std::unique_ptr<CMapHeader> loadMapHeader(const ui8 * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding) const override;
|
std::unique_ptr<CMapHeader> loadMapHeader(const ui8 * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding) const override;
|
||||||
|
|
||||||
void saveMap(const std::unique_ptr<CMap> & map, boost::filesystem::path fullPath) const override;
|
void saveMap(const std::unique_ptr<CMap> & map, boost::filesystem::path fullPath) const override;
|
||||||
|
|||||||
Reference in New Issue
Block a user