1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-20 20:23:03 +02:00

move SetStackEffect to a separate file

This commit is contained in:
Ivan Savenko 2023-10-24 01:27:52 +03:00
parent 5523f05284
commit 5cbf5031ea
15 changed files with 55 additions and 22 deletions

View File

@ -15,6 +15,7 @@
#include "../../lib/CStack.h"
#include "../../lib/ScriptHandler.h"
#include "../../lib/networkPacks/PacksForClientBattle.h"
#include "../../lib/networkPacks/SetStackEffect.h"
#if SCRIPTING_ENABLED
using scripting::Pool;

View File

@ -488,6 +488,7 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
${MAIN_LIB_DIR}/networkPacks/PacksForClientBattle.h
${MAIN_LIB_DIR}/networkPacks/PacksForLobby.h
${MAIN_LIB_DIR}/networkPacks/PacksForServer.h
${MAIN_LIB_DIR}/networkPacks/SetStackEffect.h
${MAIN_LIB_DIR}/networkPacks/StackLocation.h
${MAIN_LIB_DIR}/pathfinder/INodeStorage.h

View File

@ -13,6 +13,7 @@
#include "PacksForClientBattle.h"
#include "PacksForServer.h"
#include "PacksForLobby.h"
#include "SetStackEffect.h"
VCMI_LIB_NAMESPACE_BEGIN

View File

@ -14,6 +14,7 @@
#include "PacksForServer.h"
#include "StackLocation.h"
#include "PacksForLobby.h"
#include "SetStackEffect.h"
#include "NetPackVisitor.h"
#include "CGeneralTextHandler.h"
#include "CArtHandler.h"

View File

@ -398,28 +398,6 @@ struct DLL_LINKAGE BattleSpellCast : public CPackForClient
}
};
struct DLL_LINKAGE SetStackEffect : public CPackForClient
{
void applyGs(CGameState * gs);
void applyBattle(IBattleState * battleState);
BattleID battleID = BattleID::NONE;
std::vector<std::pair<ui32, std::vector<Bonus>>> toAdd;
std::vector<std::pair<ui32, std::vector<Bonus>>> toUpdate;
std::vector<std::pair<ui32, std::vector<Bonus>>> toRemove;
void visitTyped(ICPackVisitor & visitor) override;
template <typename Handler> void serialize(Handler & h, const int version)
{
h & battleID;
h & toAdd;
h & toUpdate;
h & toRemove;
assert(battleID != BattleID::NONE);
}
};
struct DLL_LINKAGE StacksInjured : public CPackForClient
{
void applyGs(CGameState * gs);

View File

@ -0,0 +1,42 @@
/*
* SetStackEffect.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 "NetPacksBase.h"
#include "../bonuses/Bonus.h"
VCMI_LIB_NAMESPACE_BEGIN
class IBattleState;
struct DLL_LINKAGE SetStackEffect : public CPackForClient
{
void applyGs(CGameState * gs);
void applyBattle(IBattleState * battleState);
BattleID battleID = BattleID::NONE;
std::vector<std::pair<ui32, std::vector<Bonus>>> toAdd;
std::vector<std::pair<ui32, std::vector<Bonus>>> toUpdate;
std::vector<std::pair<ui32, std::vector<Bonus>>> toRemove;
void visitTyped(ICPackVisitor & visitor) override;
template <typename Handler> void serialize(Handler & h, const int version)
{
h & battleID;
h & toAdd;
h & toUpdate;
h & toRemove;
assert(battleID != BattleID::NONE);
}
};
VCMI_LIB_NAMESPACE_END

View File

@ -13,6 +13,7 @@
#include "../networkPacks/PacksForClientBattle.h"
#include "../networkPacks/PacksForServer.h"
#include "../networkPacks/PacksForLobby.h"
#include "../networkPacks/SetStackEffect.h"
#include "../VCMI_Lib.h"
#include "../CArtHandler.h"
#include "../CCreatureSet.h"

View File

@ -17,6 +17,7 @@
#include "../battle/IBattleState.h"
#include "../battle/CBattleInfoCallback.h"
#include "../networkPacks/PacksForClientBattle.h"
#include "../networkPacks/SetStackEffect.h"
#include "../CStack.h"
VCMI_LIB_NAMESPACE_BEGIN

View File

@ -16,6 +16,7 @@
#include "../../battle/IBattleState.h"
#include "../../battle/CUnitState.h"
#include "../../networkPacks/PacksForClientBattle.h"
#include "../../networkPacks/SetStackEffect.h"
#include "../../serializer/JsonSerializeFormat.h"
VCMI_LIB_NAMESPACE_BEGIN

View File

@ -22,6 +22,7 @@
#include "../../battle/Unit.h"
#include "../../bonuses/BonusList.h"
#include "../../networkPacks/PacksForClientBattle.h"
#include "../../networkPacks/SetStackEffect.h"
#include "../../serializer/JsonSerializeFormat.h"
VCMI_LIB_NAMESPACE_BEGIN

View File

@ -19,6 +19,7 @@
#include "../../battle/Unit.h"
#include "../../mapObjects/CGHeroInstance.h"
#include "../../networkPacks/PacksForClientBattle.h"
#include "../../networkPacks/SetStackEffect.h"
#include "../../serializer/JsonSerializeFormat.h"
VCMI_LIB_NAMESPACE_BEGIN

View File

@ -16,6 +16,7 @@
#include "../lib/gameState/CGameState.h"
#include "../lib/networkPacks/PacksForClientBattle.h"
#include "../lib/networkPacks/SetStackEffect.h"
///ServerSpellCastEnvironment
ServerSpellCastEnvironment::ServerSpellCastEnvironment(CGameHandler * gh)

View File

@ -23,6 +23,7 @@
#include "../../lib/battle/BattleAction.h"
#include "../../lib/gameState/CGameState.h"
#include "../../lib/networkPacks/PacksForClientBattle.h"
#include "../../lib/networkPacks/SetStackEffect.h"
#include "../../lib/spells/AbilityCaster.h"
#include "../../lib/spells/CSpellHandler.h"
#include "../../lib/spells/ISpellMechanics.h"

View File

@ -18,6 +18,7 @@
#include "../../lib/gameState/CGameState.h"
#include "../../lib/networkPacks/PacksForClient.h"
#include "../../lib/networkPacks/PacksForClientBattle.h"
#include "../../lib/networkPacks/SetStackEffect.h"
#include "../../lib/StartInfo.h"
#include "../../lib/TerrainHandler.h"

View File

@ -14,6 +14,7 @@
#include <vstd/RNG.h>
#include "../../../lib/networkPacks/PacksForClientBattle.h"
#include "../../../lib/networkPacks/SetStackEffect.h"
#include "../../../lib/serializer/JsonDeserializer.h"