mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
Remove CPack::applyGs method in favor of GameStatePackVisitor class
This commit is contained in:
@@ -29,8 +29,6 @@ class BattleInfo;
|
||||
|
||||
struct DLL_LINKAGE BattleStart : public CPackForClient
|
||||
{
|
||||
void applyGs(CGameState * gs) override;
|
||||
|
||||
BattleID battleID = BattleID::NONE;
|
||||
std::unique_ptr<BattleInfo> info;
|
||||
|
||||
@@ -46,8 +44,6 @@ struct DLL_LINKAGE BattleStart : public CPackForClient
|
||||
|
||||
struct DLL_LINKAGE BattleNextRound : public CPackForClient
|
||||
{
|
||||
void applyGs(CGameState * gs) override;
|
||||
|
||||
BattleID battleID = BattleID::NONE;
|
||||
|
||||
void visitTyped(ICPackVisitor & visitor) override;
|
||||
@@ -61,8 +57,6 @@ struct DLL_LINKAGE BattleNextRound : public CPackForClient
|
||||
|
||||
struct DLL_LINKAGE BattleSetActiveStack : public CPackForClient
|
||||
{
|
||||
void applyGs(CGameState * gs) override;
|
||||
|
||||
BattleID battleID = BattleID::NONE;
|
||||
uint32_t stack = 0;
|
||||
BattleUnitTurnReason reason;
|
||||
@@ -80,8 +74,6 @@ struct DLL_LINKAGE BattleSetActiveStack : public CPackForClient
|
||||
|
||||
struct DLL_LINKAGE BattleCancelled: public CPackForClient
|
||||
{
|
||||
void applyGs(CGameState * gs) override;
|
||||
|
||||
BattleID battleID = BattleID::NONE;
|
||||
|
||||
template <typename Handler> void serialize(Handler & h)
|
||||
@@ -93,8 +85,6 @@ struct DLL_LINKAGE BattleCancelled: public CPackForClient
|
||||
|
||||
struct DLL_LINKAGE BattleResultAccepted : public CPackForClient
|
||||
{
|
||||
void applyGs(CGameState * gs) override;
|
||||
|
||||
struct HeroBattleResults
|
||||
{
|
||||
ObjectInstanceID heroID;
|
||||
@@ -126,8 +116,6 @@ struct DLL_LINKAGE BattleResultAccepted : public CPackForClient
|
||||
|
||||
struct DLL_LINKAGE BattleResult : public Query
|
||||
{
|
||||
void applyFirstCl(CClient * cl);
|
||||
|
||||
BattleID battleID = BattleID::NONE;
|
||||
EBattleResult result = EBattleResult::NORMAL;
|
||||
BattleSide winner = BattleSide::NONE; //0 - attacker, 1 - defender, [2 - draw (should be possible?)]
|
||||
@@ -135,7 +123,6 @@ struct DLL_LINKAGE BattleResult : public Query
|
||||
BattleSideArray<TExpType> exp{0,0}; //exp for attacker and defender
|
||||
|
||||
void visitTyped(ICPackVisitor & visitor) override;
|
||||
void applyGs(CGameState *gs) override {}
|
||||
|
||||
template <typename Handler> void serialize(Handler & h)
|
||||
{
|
||||
@@ -154,9 +141,6 @@ struct DLL_LINKAGE BattleLogMessage : public CPackForClient
|
||||
BattleID battleID = BattleID::NONE;
|
||||
std::vector<MetaString> lines;
|
||||
|
||||
void applyGs(CGameState * gs) override;
|
||||
void applyBattle(IBattleState * battleState);
|
||||
|
||||
void visitTyped(ICPackVisitor & visitor) override;
|
||||
|
||||
template <typename Handler> void serialize(Handler & h)
|
||||
@@ -175,9 +159,6 @@ struct DLL_LINKAGE BattleStackMoved : public CPackForClient
|
||||
int distance = 0;
|
||||
bool teleporting = false;
|
||||
|
||||
void applyGs(CGameState * gs) override;
|
||||
void applyBattle(IBattleState * battleState);
|
||||
|
||||
void visitTyped(ICPackVisitor & visitor) override;
|
||||
|
||||
template <typename Handler> void serialize(Handler & h)
|
||||
@@ -193,9 +174,6 @@ struct DLL_LINKAGE BattleStackMoved : public CPackForClient
|
||||
|
||||
struct DLL_LINKAGE BattleUnitsChanged : public CPackForClient
|
||||
{
|
||||
void applyGs(CGameState * gs) override;
|
||||
void applyBattle(IBattleState * battleState);
|
||||
|
||||
BattleID battleID = BattleID::NONE;
|
||||
std::vector<UnitChanges> changedStacks;
|
||||
|
||||
@@ -211,10 +189,6 @@ struct DLL_LINKAGE BattleUnitsChanged : public CPackForClient
|
||||
|
||||
struct BattleStackAttacked
|
||||
{
|
||||
DLL_LINKAGE void applyGs(CGameState * gs);
|
||||
DLL_LINKAGE void applyBattle(IBattleState * battleState);
|
||||
|
||||
BattleID battleID = BattleID::NONE;
|
||||
ui32 stackAttacked = 0, attackerID = 0;
|
||||
ui32 killedAmount = 0;
|
||||
int64_t damageAmount = 0;
|
||||
@@ -251,7 +225,6 @@ struct BattleStackAttacked
|
||||
|
||||
template <typename Handler> void serialize(Handler & h)
|
||||
{
|
||||
h & battleID;
|
||||
h & stackAttacked;
|
||||
h & attackerID;
|
||||
h & newState;
|
||||
@@ -259,7 +232,6 @@ struct BattleStackAttacked
|
||||
h & killedAmount;
|
||||
h & damageAmount;
|
||||
h & spellID;
|
||||
assert(battleID != BattleID::NONE);
|
||||
}
|
||||
bool operator<(const BattleStackAttacked & b) const
|
||||
{
|
||||
@@ -269,7 +241,6 @@ struct BattleStackAttacked
|
||||
|
||||
struct DLL_LINKAGE BattleAttack : public CPackForClient
|
||||
{
|
||||
void applyGs(CGameState * gs) override;
|
||||
BattleUnitsChanged attackerChanges;
|
||||
|
||||
BattleID battleID = BattleID::NONE;
|
||||
@@ -336,8 +307,6 @@ struct DLL_LINKAGE StartAction : public CPackForClient
|
||||
: ba(std::move(act))
|
||||
{
|
||||
}
|
||||
void applyFirstCl(CClient * cl);
|
||||
void applyGs(CGameState * gs) override;
|
||||
|
||||
BattleID battleID = BattleID::NONE;
|
||||
BattleAction ba;
|
||||
@@ -355,7 +324,6 @@ struct DLL_LINKAGE StartAction : public CPackForClient
|
||||
struct DLL_LINKAGE EndAction : public CPackForClient
|
||||
{
|
||||
void visitTyped(ICPackVisitor & visitor) override;
|
||||
void applyGs(CGameState *gs) override {}
|
||||
|
||||
BattleID battleID = BattleID::NONE;
|
||||
|
||||
@@ -367,8 +335,6 @@ struct DLL_LINKAGE EndAction : public CPackForClient
|
||||
|
||||
struct DLL_LINKAGE BattleSpellCast : public CPackForClient
|
||||
{
|
||||
void applyGs(CGameState * gs) override;
|
||||
|
||||
BattleID battleID = BattleID::NONE;
|
||||
bool activeCast = true;
|
||||
BattleSide side = BattleSide::NONE; //which hero did cast spell
|
||||
@@ -402,9 +368,6 @@ struct DLL_LINKAGE BattleSpellCast : public CPackForClient
|
||||
|
||||
struct DLL_LINKAGE StacksInjured : public CPackForClient
|
||||
{
|
||||
void applyGs(CGameState * gs) override;
|
||||
void applyBattle(IBattleState * battleState);
|
||||
|
||||
BattleID battleID = BattleID::NONE;
|
||||
std::vector<BattleStackAttacked> stacks;
|
||||
|
||||
@@ -427,7 +390,6 @@ struct DLL_LINKAGE BattleResultsApplied : public CPackForClient
|
||||
std::vector<BulkMoveArtifacts> artifacts;
|
||||
CStackBasicDescriptor raisedStack;
|
||||
void visitTyped(ICPackVisitor & visitor) override;
|
||||
void applyGs(CGameState *gs) override;
|
||||
|
||||
template <typename Handler> void serialize(Handler & h)
|
||||
{
|
||||
@@ -443,9 +405,6 @@ struct DLL_LINKAGE BattleResultsApplied : public CPackForClient
|
||||
|
||||
struct DLL_LINKAGE BattleObstaclesChanged : public CPackForClient
|
||||
{
|
||||
void applyGs(CGameState * gs) override;
|
||||
void applyBattle(IBattleState * battleState);
|
||||
|
||||
BattleID battleID = BattleID::NONE;
|
||||
std::vector<ObstacleChanges> changes;
|
||||
|
||||
@@ -475,12 +434,6 @@ struct DLL_LINKAGE CatapultAttack : public CPackForClient
|
||||
}
|
||||
};
|
||||
|
||||
CatapultAttack();
|
||||
~CatapultAttack() override;
|
||||
|
||||
void applyGs(CGameState * gs) override;
|
||||
void applyBattle(IBattleState * battleState);
|
||||
|
||||
BattleID battleID = BattleID::NONE;
|
||||
std::vector< AttackInfo > attackedParts;
|
||||
int attacker = -1; //if -1, then a spell caused this
|
||||
@@ -500,8 +453,6 @@ struct DLL_LINKAGE BattleSetStackProperty : public CPackForClient
|
||||
{
|
||||
enum BattleStackProperty { CASTS, ENCHANTER_COUNTER, UNBIND, CLONED, HAS_CLONE };
|
||||
|
||||
void applyGs(CGameState * gs) override;
|
||||
|
||||
BattleID battleID = BattleID::NONE;
|
||||
int stackID = 0;
|
||||
BattleStackProperty which = CASTS;
|
||||
@@ -525,8 +476,6 @@ protected:
|
||||
///activated at the beginning of turn
|
||||
struct DLL_LINKAGE BattleTriggerEffect : public CPackForClient
|
||||
{
|
||||
void applyGs(CGameState * gs) override; //effect
|
||||
|
||||
BattleID battleID = BattleID::NONE;
|
||||
int stackID = 0;
|
||||
int effect = 0; //use corresponding Bonus type
|
||||
@@ -549,8 +498,6 @@ protected:
|
||||
|
||||
struct DLL_LINKAGE BattleUpdateGateState : public CPackForClient
|
||||
{
|
||||
void applyGs(CGameState * gs) override;
|
||||
|
||||
BattleID battleID = BattleID::NONE;
|
||||
EGateState state = EGateState::NONE;
|
||||
template <typename Handler> void serialize(Handler & h)
|
||||
|
||||
Reference in New Issue
Block a user