mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Split off some netpack structures into separate files
This commit is contained in:
		| @@ -12,9 +12,9 @@ | ||||
|  | ||||
| #include <vcmi/events/EventBus.h> | ||||
|  | ||||
| #include "../../lib/NetPacks.h" | ||||
| #include "../../lib/CStack.h" | ||||
| #include "../../lib/ScriptHandler.h" | ||||
| #include "../../lib/networkPacks/PacksForClientBattle.h" | ||||
|  | ||||
| #if SCRIPTING_ENABLED | ||||
| using scripting::Pool; | ||||
|   | ||||
| @@ -12,14 +12,18 @@ | ||||
| #include "../../lib/UnlockGuard.h" | ||||
| #include "../../lib/mapObjects/MapObjects.h" | ||||
| #include "../../lib/mapObjects/ObjectTemplate.h" | ||||
| #include "../../lib/mapObjects/CGHeroInstance.h" | ||||
| #include "../../lib/CConfigHandler.h" | ||||
| #include "../../lib/CHeroHandler.h" | ||||
| #include "../../lib/GameSettings.h" | ||||
| #include "../../lib/gameState/CGameState.h" | ||||
| #include "../../lib/NetPacks.h" | ||||
| #include "../../lib/serializer/CTypeList.h" | ||||
| #include "../../lib/serializer/BinarySerializer.h" | ||||
| #include "../../lib/serializer/BinaryDeserializer.h" | ||||
| #include "../../lib/networkPacks/PacksForClient.h" | ||||
| #include "../../lib/networkPacks/PacksForClientBattle.h" | ||||
| #include "../../lib/networkPacks/PacksForServer.h" | ||||
| #include "../../lib/networkPacks/StackLocation.h" | ||||
| #include "../../lib/battle/BattleStateInfoForRetreat.h" | ||||
| #include "../../lib/battle/BattleInfo.h" | ||||
|  | ||||
|   | ||||
| @@ -21,12 +21,13 @@ | ||||
| #include "../../lib/CHeroHandler.h" | ||||
| #include "../../lib/GameSettings.h" | ||||
| #include "../../lib/gameState/CGameState.h" | ||||
| #include "../../lib/NetPacksBase.h" | ||||
| #include "../../lib/NetPacks.h" | ||||
| #include "../../lib/bonuses/CBonusSystemNode.h" | ||||
| #include "../../lib/bonuses/Limiters.h" | ||||
| #include "../../lib/bonuses/Updaters.h" | ||||
| #include "../../lib/bonuses/Propagators.h" | ||||
| #include "../../lib/networkPacks/PacksForClient.h" | ||||
| #include "../../lib/networkPacks/PacksForClientBattle.h" | ||||
| #include "../../lib/networkPacks/PacksForServer.h" | ||||
| #include "../../lib/serializer/CTypeList.h" | ||||
| #include "../../lib/serializer/BinarySerializer.h" | ||||
| #include "../../lib/serializer/BinaryDeserializer.h" | ||||
|   | ||||
| @@ -15,15 +15,16 @@ | ||||
| #include "client/CPlayerInterface.h" | ||||
| #include "client/Client.h" | ||||
| #include "lib/mapping/CMap.h" | ||||
| #include "lib/mapObjects/CGHeroInstance.h" | ||||
| #include "lib/CBuildingHandler.h" | ||||
| #include "lib/CGeneralTextHandler.h" | ||||
| #include "lib/CHeroHandler.h" | ||||
| #include "lib/NetPacks.h" | ||||
| #include "lib/CArtHandler.h" | ||||
| #include "lib/GameConstants.h" | ||||
| #include "lib/CPlayerState.h" | ||||
| #include "lib/UnlockGuard.h" | ||||
| #include "lib/battle/BattleInfo.h" | ||||
| #include "lib/networkPacks/PacksForServer.h" | ||||
|  | ||||
| bool CCallback::teleportHero(const CGHeroInstance *who, const CGTownInstance *where) | ||||
| { | ||||
|   | ||||
| @@ -73,8 +73,6 @@ | ||||
| #include "../lib/CondSh.h" | ||||
| #include "../lib/GameConstants.h" | ||||
| #include "../lib/JsonNode.h" | ||||
| #include "../lib/NetPacks.h" //todo: remove | ||||
| #include "../lib/NetPacksBase.h" | ||||
| #include "../lib/RoadHandler.h" | ||||
| #include "../lib/StartInfo.h" | ||||
| #include "../lib/TerrainHandler.h" | ||||
| @@ -95,6 +93,10 @@ | ||||
|  | ||||
| #include "../lib/mapping/CMapHeader.h" | ||||
|  | ||||
| #include "../lib/networkPacks/PacksForClient.h" | ||||
| #include "../lib/networkPacks/PacksForClientBattle.h" | ||||
| #include "../lib/networkPacks/PacksForServer.h" | ||||
|  | ||||
| #include "../lib/pathfinder/CGPathNode.h" | ||||
|  | ||||
| #include "../lib/serializer/BinaryDeserializer.h" | ||||
|   | ||||
| @@ -38,7 +38,6 @@ | ||||
| #include "../lib/CConfigHandler.h" | ||||
| #include "../lib/CGeneralTextHandler.h" | ||||
| #include "../lib/CThreadHelper.h" | ||||
| #include "../lib/NetPackVisitor.h" | ||||
| #include "../lib/StartInfo.h" | ||||
| #include "../lib/TurnTimerInfo.h" | ||||
| #include "../lib/VCMIDirs.h" | ||||
|   | ||||
| @@ -18,7 +18,6 @@ | ||||
| #include "gui/CGuiHandler.h" | ||||
| #include "gui/WindowHandler.h" | ||||
| #include "render/IRenderHandler.h" | ||||
| #include "../lib/NetPacks.h" | ||||
| #include "ClientNetPackVisitors.h" | ||||
| #include "../lib/CConfigHandler.h" | ||||
| #include "../lib/gameState/CGameState.h" | ||||
| @@ -28,6 +27,7 @@ | ||||
| #include "../lib/mapping/CMapService.h" | ||||
| #include "../lib/mapping/CMap.h" | ||||
| #include "windows/CCastleInterface.h" | ||||
| #include "../lib/mapObjects/CGHeroInstance.h" | ||||
| #include "render/CAnimation.h" | ||||
| #include "../CCallback.h" | ||||
| #include "../lib/CGeneralTextHandler.h" | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|  */ | ||||
| #pragma once | ||||
|  | ||||
| #include "../lib/NetPackVisitor.h" | ||||
| #include "../lib/networkPacks/NetPackVisitor.h" | ||||
|  | ||||
| class CClient; | ||||
|  | ||||
|   | ||||
| @@ -24,9 +24,9 @@ | ||||
|  | ||||
| #include "../lib/pathfinder/CGPathNode.h" | ||||
| #include "../lib/mapObjects/CGHeroInstance.h" | ||||
| #include "../lib/networkPacks/PacksForClient.h" | ||||
| #include "../lib/RoadHandler.h" | ||||
| #include "../lib/TerrainHandler.h" | ||||
| #include "../lib/NetPacks.h" | ||||
|  | ||||
| bool HeroMovementController::isHeroMovingThroughGarrison(const CGHeroInstance * hero, const CArmedInstance * garrison) const | ||||
| { | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|  */ | ||||
| #pragma once | ||||
|  | ||||
| #include "../lib/NetPackVisitor.h" | ||||
| #include "../lib/networkPacks/NetPackVisitor.h" | ||||
|  | ||||
| class CClient; | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|   | ||||
| @@ -27,7 +27,6 @@ | ||||
|  | ||||
| #include "../lib/CConfigHandler.h" | ||||
| #include "../lib/CGeneralTextHandler.h" | ||||
| #include "../lib/NetPacksLobby.h" | ||||
| #include "../lib/serializer/Connection.h" | ||||
|  | ||||
| void ApplyOnLobbyHandlerNetPackVisitor::visitLobbyClientConnected(LobbyClientConnected & pack) | ||||
|   | ||||
| @@ -12,6 +12,7 @@ | ||||
| #include "../gui/CIntObject.h" | ||||
| #include "CConfigHandler.h" | ||||
| #include "../../lib/filesystem/ResourcePath.h" | ||||
| #include "../../lib/networkPacks/Component.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
|   | ||||
| @@ -28,7 +28,7 @@ | ||||
| #include "../../CCallback.h" | ||||
| #include "../../lib/battle/BattleAction.h" | ||||
| #include "../../lib/filesystem/ResourcePath.h" | ||||
| #include "../../lib/NetPacks.h" | ||||
| #include "../../lib/networkPacks/PacksForClientBattle.h" | ||||
| #include "../../lib/CStack.h" | ||||
| #include "../../lib/IGameEventsReceiver.h" | ||||
| #include "../../lib/CGeneralTextHandler.h" | ||||
|   | ||||
| @@ -40,7 +40,7 @@ | ||||
| #include "../../lib/CondSh.h" | ||||
| #include "../../lib/gameState/InfoAboutArmy.h" | ||||
| #include "../../lib/mapObjects/CGTownInstance.h" | ||||
| #include "../../lib/NetPacks.h" | ||||
| #include "../../lib/networkPacks/PacksForClientBattle.h" | ||||
| #include "../../lib/UnlockGuard.h" | ||||
| #include "../../lib/TerrainHandler.h" | ||||
| #include "../../lib/CThreadHelper.h" | ||||
|   | ||||
| @@ -48,10 +48,10 @@ | ||||
| #include "../../lib/CGeneralTextHandler.h" | ||||
| #include "../../lib/CTownHandler.h" | ||||
| #include "../../lib/CHeroHandler.h" | ||||
| #include "../../lib/NetPacks.h" | ||||
| #include "../../lib/StartInfo.h" | ||||
| #include "../../lib/CondSh.h" | ||||
| #include "../../lib/mapObjects/CGTownInstance.h" | ||||
| #include "../../lib/networkPacks/PacksForClientBattle.h" | ||||
| #include "../../lib/TextOperations.h" | ||||
|  | ||||
| void BattleConsole::showAll(Canvas & to) | ||||
|   | ||||
| @@ -26,9 +26,9 @@ | ||||
| #include "../render/IRenderHandler.h" | ||||
|  | ||||
| #include "../../CCallback.h" | ||||
| #include "../../lib/NetPacks.h" | ||||
| #include "../../lib/CStack.h" | ||||
| #include "../../lib/mapObjects/CGTownInstance.h" | ||||
| #include "../../lib/networkPacks/PacksForClientBattle.h" | ||||
|  | ||||
| ImagePath BattleSiegeController::getWallPieceImageName(EWallVisual::EWallVisual what, EWallState state) const | ||||
| { | ||||
|   | ||||
| @@ -25,7 +25,7 @@ | ||||
| #include "../../CCallback.h" | ||||
|  | ||||
| #include "../CGameInfo.h" | ||||
| #include "../../lib/NetPacksLobby.h" | ||||
| #include "../../lib/networkPacks/NetPacksLobby.h" | ||||
| #include "../../lib/CGeneralTextHandler.h" | ||||
| #include "../../lib/campaign/CampaignHandler.h" | ||||
| #include "../../lib/mapping/CMapInfo.h" | ||||
|   | ||||
| @@ -41,7 +41,6 @@ | ||||
| #include "../render/IFont.h" | ||||
| #include "../render/IRenderHandler.h" | ||||
|  | ||||
| #include "../../lib/NetPacksLobby.h" | ||||
| #include "../../lib/CGeneralTextHandler.h" | ||||
| #include "../../lib/CHeroHandler.h" | ||||
| #include "../../lib/CThreadHelper.h" | ||||
|   | ||||
| @@ -34,7 +34,7 @@ | ||||
| #include "../eventsSDL/InputHandler.h" | ||||
|  | ||||
| #include "../../lib/filesystem/Filesystem.h" | ||||
| #include "../../lib/NetPacksLobby.h" | ||||
| #include "../../lib/networkPacks/NetPacksLobby.h" | ||||
| #include "../../lib/CGeneralTextHandler.h" | ||||
| #include "../../lib/CArtHandler.h" | ||||
| #include "../../lib/CTownHandler.h" | ||||
|   | ||||
| @@ -34,7 +34,6 @@ | ||||
|  | ||||
| #include "../../CCallback.h" | ||||
|  | ||||
| #include "../../lib/NetPacksLobby.h" | ||||
| #include "../../lib/CGeneralTextHandler.h" | ||||
| #include "../../lib/CConfigHandler.h" | ||||
| #include "../../lib/GameSettings.h" | ||||
|   | ||||
| @@ -51,7 +51,6 @@ | ||||
| #include "../../lib/mapping/CMapInfo.h" | ||||
| #include "../../lib/VCMIDirs.h" | ||||
| #include "../../lib/CStopWatch.h" | ||||
| #include "../../lib/NetPacksLobby.h" | ||||
| #include "../../lib/CThreadHelper.h" | ||||
| #include "../../lib/CConfigHandler.h" | ||||
| #include "../../lib/GameConstants.h" | ||||
|   | ||||
| @@ -26,6 +26,7 @@ | ||||
| #include "../../lib/CGeneralTextHandler.h" | ||||
| #include "../../lib/ArtifactUtils.h" | ||||
| #include "../../lib/mapObjects/CGHeroInstance.h" | ||||
| #include "../../lib/networkPacks/NetPacksBase.h" | ||||
| #include "../../lib/CConfigHandler.h" | ||||
|  | ||||
| void CArtPlace::setInternals(const CArtifactInstance * artInst) | ||||
|   | ||||
| @@ -16,6 +16,7 @@ | ||||
|  | ||||
| #include "../../lib/ArtifactUtils.h" | ||||
| #include "../../lib/mapObjects/CGHeroInstance.h" | ||||
| #include "../../lib/networkPacks/NetPacksBase.h" | ||||
|  | ||||
| CArtifactsOfHeroAltar::CArtifactsOfHeroAltar(const Point & position) | ||||
| 	: visibleArtSet(ArtBearer::ArtBearer::HERO) | ||||
| @@ -109,4 +110,4 @@ void CArtifactsOfHeroAltar::deleteFromVisible(const CArtifactInstance * artInst) | ||||
| 				getArtPlace(part.slot)->setArtifact(nullptr); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -18,6 +18,7 @@ | ||||
|  | ||||
| #include "../CPlayerInterface.h" | ||||
| #include "../../lib/mapObjects/CGHeroInstance.h" | ||||
| #include "../../lib/networkPacks/NetPacksBase.h" | ||||
|  | ||||
| #include "../../CCallback.h" | ||||
|  | ||||
|   | ||||
| @@ -22,6 +22,7 @@ | ||||
|  | ||||
| #include "../../lib/ArtifactUtils.h" | ||||
| #include "../../lib/mapObjects/CGHeroInstance.h" | ||||
| #include "../../lib/networkPacks/NetPacksBase.h" | ||||
|  | ||||
| CArtifactsOfHeroBase::CArtifactsOfHeroBase() | ||||
| 	: backpackPos(0), | ||||
|   | ||||
| @@ -15,6 +15,7 @@ | ||||
| #include "../CPlayerInterface.h" | ||||
|  | ||||
| #include "../../CCallback.h" | ||||
| #include "../../lib/networkPacks/NetPacksBase.h" | ||||
|  | ||||
| CArtifactsOfHeroKingdom::CArtifactsOfHeroKingdom(ArtPlaceMap ArtWorn, std::vector<ArtPlacePtr> Backpack, | ||||
| 	std::shared_ptr<CButton> leftScroll, std::shared_ptr<CButton> rightScroll) | ||||
|   | ||||
| @@ -13,6 +13,7 @@ | ||||
| #include "../CPlayerInterface.h" | ||||
|  | ||||
| #include "../../CCallback.h" | ||||
| #include "../../lib/networkPacks/NetPacksBase.h" | ||||
|  | ||||
| CArtifactsOfHeroMain::CArtifactsOfHeroMain(const Point & position) | ||||
| { | ||||
| @@ -37,4 +38,4 @@ void CArtifactsOfHeroMain::pickUpArtifact(CHeroArtPlace & artPlace) | ||||
| { | ||||
| 	LOCPLINT->cb->swapArtifacts(ArtifactLocation(curHero, artPlace.slot), | ||||
| 		ArtifactLocation(curHero, ArtifactPosition::TRANSITION_POS)); | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -31,11 +31,11 @@ | ||||
| #include "../../lib/ArtifactUtils.h" | ||||
| #include "../../lib/CTownHandler.h" | ||||
| #include "../../lib/CHeroHandler.h" | ||||
| #include "../../lib/networkPacks/Component.h" | ||||
| #include "../../lib/spells/CSpellHandler.h" | ||||
| #include "../../lib/CCreatureHandler.h" | ||||
| #include "../../lib/CSkillHandler.h" | ||||
| #include "../../lib/CGeneralTextHandler.h" | ||||
| #include "../../lib/NetPacksBase.h" | ||||
| #include "../../lib/CArtHandler.h" | ||||
| #include "../../lib/CArtifactInstance.h" | ||||
|  | ||||
|   | ||||
| @@ -30,6 +30,7 @@ | ||||
| #include "../../lib/CCreatureHandler.h" | ||||
| #include "../../lib/CConfigHandler.h" | ||||
| #include "../../lib/mapObjects/CGHeroInstance.h" | ||||
| #include "../../lib/networkPacks/NetPacksBase.h" | ||||
| #include "../../lib/TextOperations.h" | ||||
| #include "../../lib/gameState/CGameState.h" | ||||
|  | ||||
|   | ||||
| @@ -29,6 +29,7 @@ | ||||
| #include "../../lib/ArtifactUtils.h" | ||||
| #include "../../lib/CGeneralTextHandler.h" | ||||
| #include "../../lib/mapObjects/CGHeroInstance.h" | ||||
| #include "../../lib/networkPacks/NetPacksBase.h" | ||||
| #include "../../lib/CConfigHandler.h" | ||||
|  | ||||
| void CWindowWithArtifacts::addSet(CArtifactsOfHeroPtr artSet) | ||||
|   | ||||
| @@ -33,6 +33,7 @@ | ||||
| #include "../../lib/GameSettings.h" | ||||
| #include "../../lib/CHeroHandler.h" | ||||
| #include "../../lib/gameState/CGameState.h" | ||||
| #include "../../lib/networkPacks/NetPacksBase.h" | ||||
| #include "../../lib/TextOperations.h" | ||||
|  | ||||
| class CCreatureArtifactInstance; | ||||
|   | ||||
| @@ -39,7 +39,7 @@ | ||||
| #include "../lib/CHeroHandler.h" | ||||
| #include "../lib/CSkillHandler.h" | ||||
| #include "../lib/mapObjects/CGHeroInstance.h" | ||||
| #include "../lib/NetPacksBase.h" | ||||
| #include "../../lib/networkPacks/NetPacksBase.h" | ||||
|  | ||||
| void CHeroSwitcher::clickPressed(const Point & cursorPosition) | ||||
| { | ||||
|   | ||||
| @@ -35,6 +35,7 @@ | ||||
| #include "../../lib/mapObjects/CGHeroInstance.h" | ||||
| #include "../../lib/mapObjects/CGTownInstance.h" | ||||
| #include "../../lib/mapObjects/CGMarket.h" | ||||
| #include "../../lib/networkPacks/NetPacksBase.h" | ||||
|  | ||||
| CTradeWindow::CTradeableItem::CTradeableItem(Point pos, EType Type, int ID, bool Left, int Serial) | ||||
| 	: CIntObject(LCLICK | HOVER | SHOW_POPUP, pos), | ||||
|   | ||||
| @@ -123,6 +123,8 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE) | ||||
| 		${MAIN_LIB_DIR}/modding/IdentifierStorage.cpp | ||||
| 		${MAIN_LIB_DIR}/modding/ModUtility.cpp | ||||
|  | ||||
| 		${MAIN_LIB_DIR}/networkPacks/NetPacksLib.cpp | ||||
|  | ||||
| 		${MAIN_LIB_DIR}/pathfinder/CGPathNode.cpp | ||||
| 		${MAIN_LIB_DIR}/pathfinder/CPathfinder.cpp | ||||
| 		${MAIN_LIB_DIR}/pathfinder/NodeStorage.cpp | ||||
| @@ -255,7 +257,6 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE) | ||||
| 		${MAIN_LIB_DIR}/JsonRandom.cpp | ||||
| 		${MAIN_LIB_DIR}/LoadProgress.cpp | ||||
| 		${MAIN_LIB_DIR}/LogicalExpression.cpp | ||||
| 		${MAIN_LIB_DIR}/NetPacksLib.cpp | ||||
| 		${MAIN_LIB_DIR}/MetaString.cpp | ||||
| 		${MAIN_LIB_DIR}/ObstacleHandler.cpp | ||||
| 		${MAIN_LIB_DIR}/StartInfo.cpp | ||||
| @@ -475,6 +476,19 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE) | ||||
| 		${MAIN_LIB_DIR}/modding/ModScope.h | ||||
| 		${MAIN_LIB_DIR}/modding/ModUtility.h | ||||
|  | ||||
| 		${MAIN_LIB_DIR}/networkPacks/BattleChanges.h | ||||
| 		${MAIN_LIB_DIR}/networkPacks/Component.h | ||||
| 		${MAIN_LIB_DIR}/networkPacks/EInfoWindowMode.h | ||||
| 		${MAIN_LIB_DIR}/networkPacks/EntityChanges.h | ||||
| 		${MAIN_LIB_DIR}/networkPacks/EOpenWindowMode.h | ||||
| 		${MAIN_LIB_DIR}/networkPacks/NetPacksBase.h | ||||
| 		${MAIN_LIB_DIR}/networkPacks/NetPacksLobby.h | ||||
| 		${MAIN_LIB_DIR}/networkPacks/NetPackVisitor.h | ||||
| 		${MAIN_LIB_DIR}/networkPacks/PacksForClient.h | ||||
| 		${MAIN_LIB_DIR}/networkPacks/PacksForClientBattle.h | ||||
| 		${MAIN_LIB_DIR}/networkPacks/PacksForServer.h | ||||
| 		${MAIN_LIB_DIR}/networkPacks/StackLocation.h | ||||
|  | ||||
| 		${MAIN_LIB_DIR}/pathfinder/INodeStorage.h | ||||
| 		${MAIN_LIB_DIR}/pathfinder/CGPathNode.h | ||||
| 		${MAIN_LIB_DIR}/pathfinder/CPathfinder.h | ||||
| @@ -615,10 +629,6 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE) | ||||
| 		${MAIN_LIB_DIR}/LoadProgress.h | ||||
| 		${MAIN_LIB_DIR}/LogicalExpression.h | ||||
| 		${MAIN_LIB_DIR}/MetaString.h | ||||
| 		${MAIN_LIB_DIR}/NetPacksBase.h | ||||
| 		${MAIN_LIB_DIR}/NetPacks.h | ||||
| 		${MAIN_LIB_DIR}/NetPacksLobby.h | ||||
| 		${MAIN_LIB_DIR}/NetPackVisitor.h | ||||
| 		${MAIN_LIB_DIR}/ObstacleHandler.h | ||||
| 		${MAIN_LIB_DIR}/Point.h | ||||
| 		${MAIN_LIB_DIR}/Rect.h | ||||
|   | ||||
| @@ -13,7 +13,7 @@ | ||||
|  | ||||
| #include "ArtifactUtils.h" | ||||
| #include "CArtHandler.h" | ||||
| #include "NetPacksBase.h" | ||||
| #include "networkPacks/NetPacksBase.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
|   | ||||
| @@ -23,7 +23,6 @@ | ||||
| #include "CHeroHandler.h" | ||||
| #include "IBonusTypeHandler.h" | ||||
| #include "serializer/JsonSerializeFormat.h" | ||||
| #include "NetPacksBase.h" | ||||
|  | ||||
| #include <vcmi/FactionService.h> | ||||
| #include <vcmi/Faction.h> | ||||
|   | ||||
| @@ -14,10 +14,11 @@ | ||||
| #include "gameState/InfoAboutArmy.h" | ||||
| #include "gameState/SThievesGuildInfo.h" | ||||
| #include "gameState/TavernHeroesPool.h" | ||||
| #include "gameState/QuestInfo.h" | ||||
| #include "mapObjects/CGHeroInstance.h" | ||||
| #include "CGeneralTextHandler.h" | ||||
| #include "StartInfo.h" // for StartInfo | ||||
| #include "battle/BattleInfo.h" // for BattleInfo | ||||
| #include "NetPacks.h" // for InfoWindow | ||||
| #include "GameSettings.h" | ||||
| #include "TerrainHandler.h" | ||||
| #include "spells/CSpellHandler.h" | ||||
|   | ||||
| @@ -18,7 +18,7 @@ | ||||
| #include "CGeneralTextHandler.h" | ||||
| #include "battle/BattleInfo.h" | ||||
| #include "spells/CSpellHandler.h" | ||||
| #include "NetPacks.h" | ||||
| #include "networkPacks/PacksForClientBattle.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
|   | ||||
| @@ -13,7 +13,6 @@ | ||||
| #include "CHeroHandler.h" // for CHeroHandler | ||||
| #include "spells/CSpellHandler.h"// for CSpell | ||||
| #include "CSkillHandler.h"// for CSkill | ||||
| #include "NetPacks.h" | ||||
| #include "CBonusTypeHandler.h" | ||||
| #include "BattleFieldHandler.h" | ||||
| #include "ObstacleHandler.h" | ||||
| @@ -36,6 +35,7 @@ | ||||
| #include "gameState/CGameState.h" | ||||
| #include "gameState/CGameStateCampaign.h" | ||||
| #include "gameState/TavernHeroesPool.h" | ||||
| #include "gameState/QuestInfo.h" | ||||
| #include "mapping/CMap.h" | ||||
| #include "modding/CModHandler.h" | ||||
| #include "modding/CModInfo.h" | ||||
|   | ||||
| @@ -9,8 +9,7 @@ | ||||
|  */ | ||||
| #pragma once | ||||
|  | ||||
|  | ||||
| #include "NetPacksBase.h" | ||||
| #include "networkPacks/EInfoWindowMode.h" | ||||
| #include "battle/BattleHex.h" | ||||
| #include "GameConstants.h" | ||||
| #include "int3.h" | ||||
|   | ||||
| @@ -9,11 +9,11 @@ | ||||
|  */ | ||||
| #include "StdInc.h" | ||||
| #include "BattleInfo.h" | ||||
| #include "CObstacleInstance.h" | ||||
| #include "bonuses/Limiters.h" | ||||
| #include "bonuses/Updaters.h" | ||||
| #include "../CStack.h" | ||||
| #include "../CHeroHandler.h" | ||||
| #include "../NetPacks.h" | ||||
| #include "../filesystem/Filesystem.h" | ||||
| #include "../mapObjects/CGTownInstance.h" | ||||
| #include "../CGeneralTextHandler.h" | ||||
|   | ||||
| @@ -17,12 +17,12 @@ | ||||
| #include "CObstacleInstance.h" | ||||
| #include "DamageCalculator.h" | ||||
| #include "PossiblePlayerBattleAction.h" | ||||
| #include "../NetPacks.h" | ||||
| #include "../spells/ObstacleCasterProxy.h" | ||||
| #include "../spells/ISpellMechanics.h" | ||||
| #include "../spells/Problem.h" | ||||
| #include "../spells/CSpellHandler.h" | ||||
| #include "../mapObjects/CGTownInstance.h" | ||||
| #include "../networkPacks/PacksForClientBattle.h" | ||||
| #include "../BattleFieldHandler.h" | ||||
| #include "../Rect.h" | ||||
|  | ||||
|   | ||||
| @@ -11,9 +11,10 @@ | ||||
| #include "CBattleInfoEssentials.h" | ||||
| #include "../CStack.h" | ||||
| #include "BattleInfo.h" | ||||
| #include "../NetPacks.h" | ||||
| #include "CObstacleInstance.h" | ||||
| #include "../mapObjects/CGTownInstance.h" | ||||
| #include "../gameState/InfoAboutArmy.h" | ||||
| #include "../constants/EntityIdentifiers.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
|   | ||||
| @@ -13,7 +13,6 @@ | ||||
| #include "../CTownHandler.h" | ||||
| #include "../ObstacleHandler.h" | ||||
| #include "../VCMI_Lib.h" | ||||
| #include "../NetPacksBase.h" | ||||
|  | ||||
| #include "../serializer/JsonDeserializer.h" | ||||
| #include "../serializer/JsonSerializer.h" | ||||
|   | ||||
| @@ -9,8 +9,9 @@ | ||||
|  */ | ||||
| #pragma once | ||||
| #include "BattleHex.h" | ||||
| #include "NetPacksBase.h" | ||||
| #include "../filesystem/ResourcePath.h" | ||||
| #include "../networkPacks/BattleChanges.h" | ||||
| #include "../constants/EntityIdentifiers.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
|   | ||||
| @@ -13,8 +13,8 @@ | ||||
|  | ||||
| #include <vcmi/spells/Spell.h> | ||||
|  | ||||
| #include "../NetPacks.h" | ||||
| #include "../CCreatureHandler.h" | ||||
| #include "../MetaString.h" | ||||
|  | ||||
| #include "../serializer/JsonDeserializer.h" | ||||
| #include "../serializer/JsonSerializer.h" | ||||
|   | ||||
| @@ -14,7 +14,6 @@ | ||||
| #include "../VCMI_Lib.h" | ||||
| #include "../CGeneralTextHandler.h" | ||||
| #include "../MetaString.h" | ||||
| #include "../NetPacksBase.h" | ||||
|  | ||||
| #include "../serializer/JsonDeserializer.h" | ||||
| #include "../serializer/JsonSerializer.h" | ||||
|   | ||||
| @@ -12,8 +12,7 @@ | ||||
| #include <vcmi/Environment.h> | ||||
|  | ||||
| #include "ApplyDamage.h" | ||||
|  | ||||
| #include "../../lib/NetPacks.h" | ||||
| #include "../networkPacks/PacksForClientBattle.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
|   | ||||
| @@ -14,13 +14,17 @@ | ||||
| #include <vcmi/spells/Spell.h> | ||||
| #include <vcmi/spells/Service.h> | ||||
|  | ||||
| #include "../NetPacks.h" | ||||
| #include "../CGeneralTextHandler.h" | ||||
| #include "../CSoundBase.h" | ||||
| #include "../GameSettings.h" | ||||
| #include "../CPlayerState.h" | ||||
| #include "../mapObjectConstructors/CObjectClassesHandler.h" | ||||
| #include "../mapObjectConstructors/CBankInstanceConstructor.h" | ||||
| #include "../mapObjects/CGHeroInstance.h" | ||||
| #include "../networkPacks/Component.h" | ||||
| #include "../networkPacks/PacksForClient.h" | ||||
| #include "../networkPacks/PacksForClientBattle.h" | ||||
| #include "../MetaString.h" | ||||
| #include "../IGameCallback.h" | ||||
| #include "../gameState/CGameState.h" | ||||
|  | ||||
|   | ||||
| @@ -10,12 +10,15 @@ | ||||
|  | ||||
| #include "StdInc.h" | ||||
| #include "CGCreature.h" | ||||
| #include "CGHeroInstance.h" | ||||
|  | ||||
| #include "../NetPacks.h" | ||||
| #include "../CGeneralTextHandler.h" | ||||
| #include "../CConfigHandler.h" | ||||
| #include "../GameSettings.h" | ||||
| #include "../IGameCallback.h" | ||||
| #include "../networkPacks/PacksForClient.h" | ||||
| #include "../networkPacks/PacksForClientBattle.h" | ||||
| #include "../networkPacks/StackLocation.h" | ||||
| #include "../serializer/JsonSerializeFormat.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|   | ||||
| @@ -13,11 +13,14 @@ | ||||
| #include "../serializer/JsonSerializeFormat.h" | ||||
| #include "../mapObjectConstructors/AObjectTypeHandler.h" | ||||
| #include "../mapObjectConstructors/CObjectClassesHandler.h" | ||||
| #include "../mapObjects/CGHeroInstance.h" | ||||
| #include "../networkPacks/StackLocation.h" | ||||
| #include "../networkPacks/PacksForClient.h" | ||||
| #include "../networkPacks/PacksForClientBattle.h" | ||||
| #include "../CTownHandler.h" | ||||
| #include "../IGameCallback.h" | ||||
| #include "../gameState/CGameState.h" | ||||
| #include "../CPlayerState.h" | ||||
| #include "../NetPacks.h" | ||||
| #include "../GameSettings.h" | ||||
| #include "../CConfigHandler.h" | ||||
|  | ||||
|   | ||||
| @@ -14,7 +14,6 @@ | ||||
| #include <vcmi/ServerCallback.h> | ||||
| #include <vcmi/spells/Spell.h> | ||||
|  | ||||
| #include "../NetPacks.h" | ||||
| #include "../CGeneralTextHandler.h" | ||||
| #include "../ArtifactUtils.h" | ||||
| #include "../CHeroHandler.h" | ||||
| @@ -35,6 +34,8 @@ | ||||
| #include "../mapObjectConstructors/AObjectTypeHandler.h" | ||||
| #include "../mapObjectConstructors/CObjectClassesHandler.h" | ||||
| #include "../modding/ModScope.h" | ||||
| #include "../networkPacks/PacksForClient.h" | ||||
| #include "../networkPacks/PacksForClientBattle.h" | ||||
| #include "../constants/StringConstants.h" | ||||
| #include "../battle/Unit.h" | ||||
|  | ||||
|   | ||||
| @@ -11,7 +11,6 @@ | ||||
| #include "StdInc.h" | ||||
| #include "CGMarket.h" | ||||
|  | ||||
| #include "../NetPacks.h" | ||||
| #include "../CGeneralTextHandler.h" | ||||
| #include "../IGameCallback.h" | ||||
| #include "../CCreatureHandler.h" | ||||
| @@ -20,6 +19,7 @@ | ||||
| #include "../CSkillHandler.h" | ||||
| #include "../mapObjectConstructors/AObjectTypeHandler.h" | ||||
| #include "../mapObjectConstructors/CObjectClassesHandler.h" | ||||
| #include "../networkPacks/PacksForClient.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
|   | ||||
| @@ -17,12 +17,12 @@ | ||||
| #include "../gameState/CGameState.h" | ||||
| #include "../CGeneralTextHandler.h" | ||||
| #include "../IGameCallback.h" | ||||
| #include "../NetPacks.h" | ||||
| #include "../constants/StringConstants.h" | ||||
| #include "../TerrainHandler.h" | ||||
| #include "../mapObjectConstructors/AObjectTypeHandler.h" | ||||
| #include "../mapObjectConstructors/CObjectClassesHandler.h" | ||||
| #include "../mapping/CMap.h" | ||||
| #include "../networkPacks/PacksForClient.h" | ||||
| #include "../serializer/JsonSerializeFormat.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|   | ||||
| @@ -10,11 +10,14 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include "IObjectInterface.h" | ||||
| #include "../constants/EntityIdentifiers.h" | ||||
| #include "../filesystem/ResourcePath.h" | ||||
| #include "../int3.h" | ||||
| #include "../bonuses/BonusEnum.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
| struct Component; | ||||
| class JsonSerializeFormat; | ||||
| class ObjectTemplate; | ||||
| class CMap; | ||||
|   | ||||
| @@ -14,13 +14,15 @@ | ||||
| #include <vcmi/spells/Spell.h> | ||||
| #include <vcmi/spells/Service.h> | ||||
|  | ||||
| #include "../NetPacks.h" | ||||
| #include "../CSoundBase.h" | ||||
|  | ||||
| #include "../CSkillHandler.h" | ||||
| #include "../StartInfo.h" | ||||
| #include "../IGameCallback.h" | ||||
| #include "../constants/StringConstants.h" | ||||
| #include "../networkPacks/PacksForClient.h" | ||||
| #include "../networkPacks/PacksForClientBattle.h" | ||||
| #include "../mapObjects/CGHeroInstance.h" | ||||
| #include "../serializer/JsonSerializeFormat.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|   | ||||
| @@ -12,9 +12,10 @@ | ||||
| #include "CGTownBuilding.h" | ||||
| #include "CGTownInstance.h" | ||||
| #include "../CGeneralTextHandler.h" | ||||
| #include "../NetPacks.h" | ||||
| #include "../IGameCallback.h" | ||||
| #include "../gameState/CGameState.h" | ||||
| #include "../mapObjects/CGHeroInstance.h" | ||||
| #include "../networkPacks/PacksForClient.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
|   | ||||
| @@ -14,7 +14,6 @@ | ||||
| #include "../spells/CSpellHandler.h" | ||||
| #include "../bonuses/Bonus.h" | ||||
| #include "../battle/IBattleInfoCallback.h" | ||||
| #include "../NetPacks.h" | ||||
| #include "../CConfigHandler.h" | ||||
| #include "../CGeneralTextHandler.h" | ||||
| #include "../IGameCallback.h" | ||||
| @@ -24,7 +23,11 @@ | ||||
| #include "../TerrainHandler.h" | ||||
| #include "../mapObjectConstructors/AObjectTypeHandler.h" | ||||
| #include "../mapObjectConstructors/CObjectClassesHandler.h" | ||||
| #include "../mapObjects/CGHeroInstance.h" | ||||
| #include "../modding/ModScope.h" | ||||
| #include "../networkPacks/StackLocation.h" | ||||
| #include "../networkPacks/PacksForClient.h" | ||||
| #include "../networkPacks/PacksForClientBattle.h" | ||||
| #include "../serializer/JsonSerializeFormat.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|   | ||||
| @@ -13,6 +13,7 @@ | ||||
|  | ||||
| #include "CGObjectInstance.h" | ||||
| #include "../filesystem/ResourcePath.h" | ||||
| #include "../JsonNode.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
|   | ||||
| @@ -14,7 +14,6 @@ | ||||
| #include <vcmi/spells/Spell.h> | ||||
|  | ||||
| #include "../ArtifactUtils.h" | ||||
| #include "../NetPacks.h" | ||||
| #include "../CSoundBase.h" | ||||
| #include "../CGeneralTextHandler.h" | ||||
| #include "../CHeroHandler.h" | ||||
| @@ -26,8 +25,10 @@ | ||||
| #include "../constants/StringConstants.h" | ||||
| #include "../CSkillHandler.h" | ||||
| #include "../mapping/CMap.h" | ||||
| #include "../mapObjects/CGHeroInstance.h" | ||||
| #include "../modding/ModScope.h" | ||||
| #include "../modding/ModUtility.h" | ||||
| #include "../networkPacks/PacksForClient.h" | ||||
| #include "../spells/CSpellHandler.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|   | ||||
| @@ -14,9 +14,10 @@ | ||||
| #include "../CGeneralTextHandler.h" | ||||
| #include "../CPlayerState.h" | ||||
| #include "../IGameCallback.h" | ||||
| #include "../NetPacks.h" | ||||
| #include "../mapObjectConstructors/AObjectTypeHandler.h" | ||||
| #include "../mapObjectConstructors/CObjectClassesHandler.h" | ||||
| #include "../mapObjects/CGHeroInstance.h" | ||||
| #include "../networkPacks/PacksForClient.h" | ||||
| #include "../serializer/JsonSerializeFormat.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|   | ||||
| @@ -14,9 +14,10 @@ | ||||
| #include "CGTownInstance.h" | ||||
| #include "MiscObjects.h" | ||||
|  | ||||
| #include "../NetPacks.h" | ||||
| #include "../IGameCallback.h" | ||||
| #include "../TerrainHandler.h" | ||||
| #include "../mapObjects/CGHeroInstance.h" | ||||
| #include "../networkPacks/PacksForClient.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
|   | ||||
| @@ -9,18 +9,22 @@ | ||||
|  */ | ||||
| #pragma once | ||||
|  | ||||
| #include "../NetPacksBase.h" | ||||
| #include "../networkPacks/EInfoWindowMode.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
| struct BattleResult; | ||||
| struct UpgradeInfo; | ||||
| class BoatId; | ||||
| class CGObjectInstance; | ||||
| class CRandomGenerator; | ||||
| class CStackInstance; | ||||
| class CGHeroInstance; | ||||
| class IGameCallback; | ||||
| class ResourceSet; | ||||
| class int3; | ||||
| class MetaString; | ||||
| class PlayerColor; | ||||
|  | ||||
| class DLL_LINKAGE IObjectInterface | ||||
| { | ||||
|   | ||||
| @@ -12,7 +12,6 @@ | ||||
| #include "MiscObjects.h" | ||||
|  | ||||
| #include "../constants/StringConstants.h" | ||||
| #include "../NetPacks.h" | ||||
| #include "../CGeneralTextHandler.h" | ||||
| #include "../CSoundBase.h" | ||||
| #include "../CSkillHandler.h" | ||||
| @@ -24,7 +23,11 @@ | ||||
| #include "../serializer/JsonSerializeFormat.h" | ||||
| #include "../mapObjectConstructors/AObjectTypeHandler.h" | ||||
| #include "../mapObjectConstructors/CObjectClassesHandler.h" | ||||
| #include "../mapObjects/CGHeroInstance.h" | ||||
| #include "../modding/ModScope.h" | ||||
| #include "../networkPacks/PacksForClient.h" | ||||
| #include "../networkPacks/PacksForClientBattle.h" | ||||
| #include "../networkPacks/StackLocation.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
|   | ||||
| @@ -36,6 +36,8 @@ | ||||
| #include "../mapObjects/MapObjects.h" | ||||
| #include "../mapObjects/ObjectTemplate.h" | ||||
| #include "../modding/ModScope.h" | ||||
| #include "../networkPacks/Component.h" | ||||
| #include "../networkPacks/NetPacksBase.h" | ||||
| #include "../spells/CSpellHandler.h" | ||||
|  | ||||
| #include <boost/crc.hpp> | ||||
|   | ||||
							
								
								
									
										81
									
								
								lib/networkPacks/BattleChanges.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								lib/networkPacks/BattleChanges.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,81 @@ | ||||
| /* | ||||
|  * BattleChanges.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 "JsonNode.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
| class BattleChanges | ||||
| { | ||||
| public: | ||||
| 	enum class EOperation : si8 | ||||
| 	{ | ||||
| 		ADD, | ||||
| 		RESET_STATE, | ||||
| 		UPDATE, | ||||
| 		REMOVE, | ||||
| 	}; | ||||
|  | ||||
| 	JsonNode data; | ||||
| 	EOperation operation = EOperation::RESET_STATE; | ||||
|  | ||||
| 	BattleChanges() = default; | ||||
| 	explicit BattleChanges(EOperation operation_) | ||||
| 		: operation(operation_) | ||||
| 	{ | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| class UnitChanges : public BattleChanges | ||||
| { | ||||
| public: | ||||
| 	uint32_t id = 0; | ||||
| 	int64_t healthDelta = 0; | ||||
|  | ||||
| 	UnitChanges() = default; | ||||
| 	UnitChanges(uint32_t id_, EOperation operation_) | ||||
| 		: BattleChanges(operation_) | ||||
| 		, id(id_) | ||||
| 	{ | ||||
| 	} | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & id; | ||||
| 		h & healthDelta; | ||||
| 		h & data; | ||||
| 		h & operation; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| class ObstacleChanges : public BattleChanges | ||||
| { | ||||
| public: | ||||
| 	uint32_t id = 0; | ||||
|  | ||||
| 	ObstacleChanges() = default; | ||||
|  | ||||
| 	ObstacleChanges(uint32_t id_, EOperation operation_) | ||||
| 		: BattleChanges(operation_), | ||||
| 		id(id_) | ||||
| 	{ | ||||
| 	} | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & id; | ||||
| 		h & data; | ||||
| 		h & operation; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_END | ||||
|  | ||||
							
								
								
									
										54
									
								
								lib/networkPacks/Component.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								lib/networkPacks/Component.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,54 @@ | ||||
| /* | ||||
|  * Component.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 | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
| class CStackBasicDescriptor; | ||||
|  | ||||
| struct Component | ||||
| { | ||||
| 	enum class EComponentType : uint8_t | ||||
| 	{ | ||||
| 		PRIM_SKILL, | ||||
| 		SEC_SKILL, | ||||
| 		RESOURCE, | ||||
| 		CREATURE, | ||||
| 		ARTIFACT, | ||||
| 		EXPERIENCE, | ||||
| 		SPELL, | ||||
| 		MORALE, | ||||
| 		LUCK, | ||||
| 		BUILDING, | ||||
| 		HERO_PORTRAIT, | ||||
| 		FLAG, | ||||
| 		INVALID //should be last | ||||
| 	}; | ||||
| 	EComponentType id = EComponentType::INVALID; | ||||
| 	ui16 subtype = 0; //id==EXPPERIENCE subtype==0 means exp points and subtype==1 levels | ||||
| 	si32 val = 0; // + give; - take | ||||
| 	si16 when = 0; // 0 - now; +x - within x days; -x - per x days | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| 		h & id; | ||||
| 		h & subtype; | ||||
| 		h & val; | ||||
| 		h & when; | ||||
| 	} | ||||
| 	Component() = default; | ||||
| 	DLL_LINKAGE explicit Component(const CStackBasicDescriptor &stack); | ||||
| 	Component(Component::EComponentType Type, ui16 Subtype, si32 Val, si16 When) | ||||
| 		:id(Type),subtype(Subtype),val(Val),when(When) | ||||
| 	{ | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_END | ||||
							
								
								
									
										22
									
								
								lib/networkPacks/EInfoWindowMode.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								lib/networkPacks/EInfoWindowMode.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| /* | ||||
|  * EInfoWindowMode.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 | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
| enum class EInfoWindowMode : uint8_t | ||||
| { | ||||
| 	AUTO, | ||||
| 	MODAL, | ||||
| 	INFO | ||||
| }; | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_END | ||||
|  | ||||
							
								
								
									
										28
									
								
								lib/networkPacks/EOpenWindowMode.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								lib/networkPacks/EOpenWindowMode.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| /* | ||||
|  * EOpenWindowMode.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 | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
| enum class EOpenWindowMode : uint8_t | ||||
| { | ||||
| 	EXCHANGE_WINDOW, | ||||
| 	RECRUITMENT_FIRST, | ||||
| 	RECRUITMENT_ALL, | ||||
| 	SHIPYARD_WINDOW, | ||||
| 	THIEVES_GUILD, | ||||
| 	UNIVERSITY_WINDOW, | ||||
| 	HILL_FORT_WINDOW, | ||||
| 	MARKET_WINDOW, | ||||
| 	PUZZLE_MAP, | ||||
| 	TAVERN_WINDOW | ||||
| }; | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_END | ||||
							
								
								
									
										33
									
								
								lib/networkPacks/EntityChanges.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								lib/networkPacks/EntityChanges.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| /* | ||||
|  * EInfoWindowMode.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 <vcmi/Metatype.h> | ||||
|  | ||||
| #include "../JsonNode.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
| class EntityChanges | ||||
| { | ||||
| public: | ||||
| 	Metatype metatype = Metatype::UNKNOWN; | ||||
| 	int32_t entityIndex = 0; | ||||
| 	JsonNode data; | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & metatype; | ||||
| 		h & entityIndex; | ||||
| 		h & data; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_END | ||||
|  | ||||
| @@ -9,7 +9,9 @@ | ||||
|  */ | ||||
| #pragma once | ||||
|  | ||||
| #include "NetPacks.h" | ||||
| #include "PacksForClient.h" | ||||
| #include "PacksForClientBattle.h" | ||||
| #include "PacksForServer.h" | ||||
| #include "NetPacksLobby.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|   | ||||
| @@ -9,11 +9,8 @@ | ||||
|  */ | ||||
| #pragma once | ||||
|  | ||||
| #include <vcmi/Metatype.h> | ||||
|  | ||||
| #include "ConstTransitivePtr.h" | ||||
| #include "GameConstants.h" | ||||
| #include "JsonNode.h" | ||||
| #include "../ConstTransitivePtr.h" | ||||
| #include "../GameConstants.h" | ||||
|  | ||||
| class CClient; | ||||
| class CGameHandler; | ||||
| @@ -35,27 +32,6 @@ struct ArtSlotInfo; | ||||
|  | ||||
| class ICPackVisitor; | ||||
|  | ||||
| enum class EInfoWindowMode : uint8_t | ||||
| { | ||||
| 	AUTO, | ||||
| 	MODAL, | ||||
| 	INFO | ||||
| }; | ||||
|  | ||||
| enum class EOpenWindowMode : uint8_t | ||||
| { | ||||
| 	EXCHANGE_WINDOW, | ||||
| 	RECRUITMENT_FIRST, | ||||
| 	RECRUITMENT_ALL, | ||||
| 	SHIPYARD_WINDOW, | ||||
| 	THIEVES_GUILD, | ||||
| 	UNIVERSITY_WINDOW, | ||||
| 	HILL_FORT_WINDOW, | ||||
| 	MARKET_WINDOW, | ||||
| 	PUZZLE_MAP, | ||||
| 	TAVERN_WINDOW | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE CPack | ||||
| { | ||||
| 	std::shared_ptr<CConnection> c; // Pointer to connection that pack received from | ||||
| @@ -92,6 +68,11 @@ protected: | ||||
| 	virtual void visitBasic(ICPackVisitor & cpackVisitor) override; | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE Query : public CPackForClient | ||||
| { | ||||
| 	QueryID queryID; // equals to -1 if it is not an actual query (and should not be answered) | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE CPackForServer : public CPack | ||||
| { | ||||
| 	mutable PlayerColor player = PlayerColor::NEUTRAL; | ||||
| @@ -115,44 +96,6 @@ protected: | ||||
| 	virtual void visitBasic(ICPackVisitor & cpackVisitor) override; | ||||
| }; | ||||
|  | ||||
| struct Component | ||||
| { | ||||
| 	enum class EComponentType : uint8_t  | ||||
| 	{ | ||||
| 		PRIM_SKILL, | ||||
| 		SEC_SKILL, | ||||
| 		RESOURCE, | ||||
| 		CREATURE, | ||||
| 		ARTIFACT, | ||||
| 		EXPERIENCE, | ||||
| 		SPELL, | ||||
| 		MORALE, | ||||
| 		LUCK, | ||||
| 		BUILDING, | ||||
| 		HERO_PORTRAIT, | ||||
| 		FLAG, | ||||
| 		INVALID //should be last | ||||
| 	}; | ||||
| 	EComponentType id = EComponentType::INVALID; | ||||
| 	ui16 subtype = 0; //id==EXPPERIENCE subtype==0 means exp points and subtype==1 levels | ||||
| 	si32 val = 0; // + give; - take | ||||
| 	si16 when = 0; // 0 - now; +x - within x days; -x - per x days | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| 		h & id; | ||||
| 		h & subtype; | ||||
| 		h & val; | ||||
| 		h & when; | ||||
| 	} | ||||
| 	Component() = default; | ||||
| 	DLL_LINKAGE explicit Component(const CStackBasicDescriptor &stack); | ||||
| 	Component(Component::EComponentType Type, ui16 Subtype, si32 Val, si16 When) | ||||
| 		:id(Type),subtype(Subtype),val(Val),when(When) | ||||
| 	{ | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| using TArtHolder = std::variant<ConstTransitivePtr<CGHeroInstance>, ConstTransitivePtr<CStackInstance>>; | ||||
|  | ||||
| struct ArtifactLocation | ||||
| @@ -205,82 +148,4 @@ struct ArtifactLocation | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| class EntityChanges | ||||
| { | ||||
| public: | ||||
| 	Metatype metatype = Metatype::UNKNOWN; | ||||
| 	int32_t entityIndex = 0; | ||||
| 	JsonNode data; | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & metatype; | ||||
| 		h & entityIndex; | ||||
| 		h & data; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| class BattleChanges | ||||
| { | ||||
| public: | ||||
| 	enum class EOperation : si8 | ||||
| 	{ | ||||
| 		ADD, | ||||
| 		RESET_STATE, | ||||
| 		UPDATE, | ||||
| 		REMOVE, | ||||
| 	}; | ||||
|  | ||||
| 	JsonNode data; | ||||
| 	EOperation operation = EOperation::RESET_STATE; | ||||
|  | ||||
| 	BattleChanges() = default; | ||||
| 	BattleChanges(EOperation operation_) | ||||
| 		: operation(operation_) | ||||
| 	{ | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| class UnitChanges : public BattleChanges | ||||
| { | ||||
| public: | ||||
| 	uint32_t id = 0; | ||||
| 	int64_t healthDelta = 0; | ||||
|  | ||||
| 	UnitChanges() = default; | ||||
| 	UnitChanges(uint32_t id_, EOperation operation_) | ||||
| 		: BattleChanges(operation_) | ||||
| 		, id(id_) | ||||
| 	{ | ||||
| 	} | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & id; | ||||
| 		h & healthDelta; | ||||
| 		h & data; | ||||
| 		h & operation; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| class ObstacleChanges : public BattleChanges | ||||
| { | ||||
| public: | ||||
| 	uint32_t id = 0; | ||||
|  | ||||
| 	ObstacleChanges() = default; | ||||
|  | ||||
| 	ObstacleChanges(uint32_t id_, EOperation operation_) | ||||
| 		: BattleChanges(operation_), | ||||
| 		id(id_) | ||||
| 	{ | ||||
| 	} | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & id; | ||||
| 		h & data; | ||||
| 		h & operation; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_END | ||||
|   | ||||
| @@ -9,7 +9,11 @@ | ||||
|  */ | ||||
| #include "StdInc.h" | ||||
| #include "ArtifactUtils.h" | ||||
| #include "NetPacks.h" | ||||
| #include "PacksForClient.h" | ||||
| #include "PacksForClientBattle.h" | ||||
| #include "PacksForServer.h" | ||||
| #include "StackLocation.h" | ||||
| #include "NetPacksLobby.h" | ||||
| #include "NetPackVisitor.h" | ||||
| #include "CGeneralTextHandler.h" | ||||
| #include "CArtHandler.h" | ||||
|   | ||||
| @@ -9,9 +9,8 @@ | ||||
|  */ | ||||
| #pragma once | ||||
|  | ||||
| #include "NetPacksBase.h" | ||||
|  | ||||
| #include "StartInfo.h" | ||||
| #include "NetPacksBase.h" | ||||
|  | ||||
| class CServerHandler; | ||||
| class CVCMIServer; | ||||
| @@ -43,7 +42,7 @@ struct DLL_LINKAGE LobbyClientConnected : public CLobbyPackToPropagate | ||||
| 	int clientId = -1; | ||||
| 	int hostClientId = -1; | ||||
|  | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| @@ -62,7 +61,7 @@ struct DLL_LINKAGE LobbyClientDisconnected : public CLobbyPackToPropagate | ||||
| 	bool shutdownServer = false; | ||||
|  | ||||
|  | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| @@ -75,7 +74,7 @@ struct DLL_LINKAGE LobbyChatMessage : public CLobbyPackToPropagate | ||||
| { | ||||
| 	std::string playerName, message; | ||||
|  | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| @@ -91,7 +90,7 @@ struct DLL_LINKAGE LobbyGuiAction : public CLobbyPackToPropagate | ||||
| 	} action = NONE; | ||||
|  | ||||
|  | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| @@ -103,7 +102,7 @@ struct DLL_LINKAGE LobbyLoadProgress : public CLobbyPackToPropagate | ||||
| { | ||||
| 	unsigned char progress; | ||||
| 	 | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| @@ -115,7 +114,7 @@ struct DLL_LINKAGE LobbyEndGame : public CLobbyPackToPropagate | ||||
| { | ||||
| 	bool closeConnection = false, restart = false; | ||||
| 	 | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	 | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| @@ -131,7 +130,7 @@ struct DLL_LINKAGE LobbyStartGame : public CLobbyPackToPropagate | ||||
| 	CGameState * initializedGameState = nullptr; | ||||
| 	int clientId = -1; //-1 means to all clients | ||||
|  | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| @@ -148,7 +147,7 @@ struct DLL_LINKAGE LobbyChangeHost : public CLobbyPackToPropagate | ||||
| { | ||||
| 	int newHostConnectionId = -1; | ||||
|  | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| @@ -161,7 +160,7 @@ struct DLL_LINKAGE LobbyUpdateState : public CLobbyPackToPropagate | ||||
| 	LobbyState state; | ||||
| 	bool hostChanged = false; // Used on client-side only | ||||
|  | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| @@ -176,7 +175,7 @@ struct DLL_LINKAGE LobbySetMap : public CLobbyPackToServer | ||||
|  | ||||
| 	LobbySetMap() : mapInfo(nullptr), mapGenOpts(nullptr) {} | ||||
|  | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| @@ -189,7 +188,7 @@ struct DLL_LINKAGE LobbySetCampaign : public CLobbyPackToServer | ||||
| { | ||||
| 	std::shared_ptr<CampaignState> ourCampaign; | ||||
|  | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| @@ -201,7 +200,7 @@ struct DLL_LINKAGE LobbySetCampaignMap : public CLobbyPackToServer | ||||
| { | ||||
| 	CampaignScenarioID mapId = CampaignScenarioID::NONE; | ||||
|  | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| @@ -213,7 +212,7 @@ struct DLL_LINKAGE LobbySetCampaignBonus : public CLobbyPackToServer | ||||
| { | ||||
| 	int bonusId = -1; | ||||
|  | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| @@ -228,7 +227,7 @@ struct DLL_LINKAGE LobbyChangePlayerOption : public CLobbyPackToServer | ||||
| 	int32_t value = 0; | ||||
| 	PlayerColor color = PlayerColor::CANNOT_DETERMINE; | ||||
|  | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| @@ -242,7 +241,7 @@ struct DLL_LINKAGE LobbySetPlayer : public CLobbyPackToServer | ||||
| { | ||||
| 	PlayerColor clickedColor = PlayerColor::CANNOT_DETERMINE; | ||||
|  | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| @@ -255,7 +254,7 @@ struct DLL_LINKAGE LobbySetPlayerName : public CLobbyPackToServer | ||||
| 	PlayerColor color = PlayerColor::CANNOT_DETERMINE; | ||||
| 	std::string name = ""; | ||||
|  | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| @@ -268,7 +267,7 @@ struct DLL_LINKAGE LobbySetSimturns : public CLobbyPackToServer | ||||
| { | ||||
| 	SimturnsInfo simturnsInfo; | ||||
|  | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| @@ -280,7 +279,7 @@ struct DLL_LINKAGE LobbySetTurnTime : public CLobbyPackToServer | ||||
| { | ||||
| 	TurnTimerInfo turnTimerInfo; | ||||
|  | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| @@ -292,7 +291,7 @@ struct DLL_LINKAGE LobbySetDifficulty : public CLobbyPackToServer | ||||
| { | ||||
| 	ui8 difficulty = 0; | ||||
|  | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 	{ | ||||
| @@ -305,7 +304,7 @@ struct DLL_LINKAGE LobbyForceSetPlayer : public CLobbyPackToServer | ||||
| 	ui8 targetConnectedPlayer = -1; | ||||
| 	PlayerColor targetPlayerColor = PlayerColor::CANNOT_DETERMINE; | ||||
|  | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| @@ -318,7 +317,7 @@ struct DLL_LINKAGE LobbyShowMessage : public CLobbyPackToPropagate | ||||
| { | ||||
| 	std::string message; | ||||
| 	 | ||||
| 	virtual void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
| 	 | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										575
									
								
								lib/networkPacks/PacksForClientBattle.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										575
									
								
								lib/networkPacks/PacksForClientBattle.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,575 @@ | ||||
| /* | ||||
|  * NetPacks.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 "BattleChanges.h" | ||||
| #include "../MetaString.h" | ||||
| #include "../battle/BattleAction.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
| class IBattleState; | ||||
| class BattleInfo; | ||||
|  | ||||
| struct DLL_LINKAGE BattleStart : public CPackForClient | ||||
| { | ||||
| 	void applyGs(CGameState * gs) const; | ||||
|  | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
| 	BattleInfo * info = nullptr; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		h & info; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BattleNextRound : public CPackForClient | ||||
| { | ||||
| 	void applyGs(CGameState * gs) const; | ||||
|  | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BattleSetActiveStack : public CPackForClient | ||||
| { | ||||
| 	void applyGs(CGameState * gs) const; | ||||
|  | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
| 	ui32 stack = 0; | ||||
| 	ui8 askPlayerInterface = true; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		h & stack; | ||||
| 		h & askPlayerInterface; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BattleCancelled: public CPackForClient | ||||
| { | ||||
| 	void applyGs(CGameState * gs) const; | ||||
|  | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BattleResultAccepted : public CPackForClient | ||||
| { | ||||
| 	void applyGs(CGameState * gs) const; | ||||
|  | ||||
| 	struct HeroBattleResults | ||||
| 	{ | ||||
| 		HeroBattleResults() | ||||
| 			: hero(nullptr), army(nullptr), exp(0) {} | ||||
|  | ||||
| 		CGHeroInstance * hero; | ||||
| 		CArmedInstance * army; | ||||
| 		TExpType exp; | ||||
|  | ||||
| 		template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 		{ | ||||
| 			h & hero; | ||||
| 			h & army; | ||||
| 			h & exp; | ||||
| 		} | ||||
| 	}; | ||||
|  | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
| 	std::array<HeroBattleResults, 2> heroResult; | ||||
| 	ui8 winnerSide; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		h & heroResult; | ||||
| 		h & winnerSide; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BattleResult : public Query | ||||
| { | ||||
| 	void applyFirstCl(CClient * cl); | ||||
|  | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
| 	EBattleResult result = EBattleResult::NORMAL; | ||||
| 	ui8 winner = 2; //0 - attacker, 1 - defender, [2 - draw (should be possible?)] | ||||
| 	std::map<ui32, si32> casualties[2]; //first => casualties of attackers - map crid => number | ||||
| 	TExpType exp[2] = {0, 0}; //exp for attacker and defender | ||||
| 	std::set<ArtifactInstanceID> artifacts; //artifacts taken from loser to winner - currently unused | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		h & queryID; | ||||
| 		h & result; | ||||
| 		h & winner; | ||||
| 		h & casualties[0]; | ||||
| 		h & casualties[1]; | ||||
| 		h & exp; | ||||
| 		h & artifacts; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BattleLogMessage : public CPackForClient | ||||
| { | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
| 	std::vector<MetaString> lines; | ||||
|  | ||||
| 	void applyGs(CGameState * gs); | ||||
| 	void applyBattle(IBattleState * battleState); | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		h & lines; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BattleStackMoved : public CPackForClient | ||||
| { | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
| 	ui32 stack = 0; | ||||
| 	std::vector<BattleHex> tilesToMove; | ||||
| 	int distance = 0; | ||||
| 	bool teleporting = false; | ||||
|  | ||||
| 	void applyGs(CGameState * gs); | ||||
| 	void applyBattle(IBattleState * battleState); | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		h & stack; | ||||
| 		h & tilesToMove; | ||||
| 		h & distance; | ||||
| 		h & teleporting; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BattleUnitsChanged : public CPackForClient | ||||
| { | ||||
| 	void applyGs(CGameState * gs); | ||||
| 	void applyBattle(IBattleState * battleState); | ||||
|  | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
| 	std::vector<UnitChanges> changedStacks; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		h & changedStacks; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| 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; | ||||
| 	UnitChanges newState; | ||||
| 	enum EFlags { KILLED = 1, SECONDARY = 2, REBIRTH = 4, CLONE_KILLED = 8, SPELL_EFFECT = 16, FIRE_SHIELD = 32, }; | ||||
| 	ui32 flags = 0; //uses EFlags (above) | ||||
| 	SpellID spellID = SpellID::NONE; //only if flag SPELL_EFFECT is set | ||||
|  | ||||
| 	bool killed() const//if target stack was killed | ||||
| 	{ | ||||
| 		return flags & KILLED || flags & CLONE_KILLED; | ||||
| 	} | ||||
| 	bool cloneKilled() const | ||||
| 	{ | ||||
| 		return flags & CLONE_KILLED; | ||||
| 	} | ||||
| 	bool isSecondary() const//if stack was not a primary target (receives no spell effects) | ||||
| 	{ | ||||
| 		return flags & SECONDARY; | ||||
| 	} | ||||
| 	///Attacked with spell (SPELL_LIKE_ATTACK) | ||||
| 	bool isSpell() const | ||||
| 	{ | ||||
| 		return flags & SPELL_EFFECT; | ||||
| 	} | ||||
| 	bool willRebirth() const//resurrection, e.g. Phoenix | ||||
| 	{ | ||||
| 		return flags & REBIRTH; | ||||
| 	} | ||||
| 	bool fireShield() const | ||||
| 	{ | ||||
| 		return flags & FIRE_SHIELD; | ||||
| 	} | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		h & stackAttacked; | ||||
| 		h & attackerID; | ||||
| 		h & newState; | ||||
| 		h & flags; | ||||
| 		h & killedAmount; | ||||
| 		h & damageAmount; | ||||
| 		h & spellID; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
| 	bool operator<(const BattleStackAttacked & b) const | ||||
| 	{ | ||||
| 		return stackAttacked < b.stackAttacked; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BattleAttack : public CPackForClient | ||||
| { | ||||
| 	void applyGs(CGameState * gs); | ||||
| 	BattleUnitsChanged attackerChanges; | ||||
|  | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
| 	std::vector<BattleStackAttacked> bsa; | ||||
| 	ui32 stackAttacking = 0; | ||||
| 	ui32 flags = 0; //uses Eflags (below) | ||||
| 	enum EFlags { SHOT = 1, COUNTER = 2, LUCKY = 4, UNLUCKY = 8, BALLISTA_DOUBLE_DMG = 16, DEATH_BLOW = 32, SPELL_LIKE = 64, LIFE_DRAIN = 128 }; | ||||
|  | ||||
| 	BattleHex tile; | ||||
| 	SpellID spellID = SpellID::NONE; //for SPELL_LIKE | ||||
|  | ||||
| 	bool shot() const//distance attack - decrease number of shots | ||||
| 	{ | ||||
| 		return flags & SHOT; | ||||
| 	} | ||||
| 	bool counter() const//is it counterattack? | ||||
| 	{ | ||||
| 		return flags & COUNTER; | ||||
| 	} | ||||
| 	bool lucky() const | ||||
| 	{ | ||||
| 		return flags & LUCKY; | ||||
| 	} | ||||
| 	bool unlucky() const | ||||
| 	{ | ||||
| 		return flags & UNLUCKY; | ||||
| 	} | ||||
| 	bool ballistaDoubleDmg() const //if it's ballista attack and does double dmg | ||||
| 	{ | ||||
| 		return flags & BALLISTA_DOUBLE_DMG; | ||||
| 	} | ||||
| 	bool deathBlow() const | ||||
| 	{ | ||||
| 		return flags & DEATH_BLOW; | ||||
| 	} | ||||
| 	bool spellLike() const | ||||
| 	{ | ||||
| 		return flags & SPELL_LIKE; | ||||
| 	} | ||||
| 	bool lifeDrain() const | ||||
| 	{ | ||||
| 		return flags & LIFE_DRAIN; | ||||
| 	} | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		h & bsa; | ||||
| 		h & stackAttacking; | ||||
| 		h & flags; | ||||
| 		h & tile; | ||||
| 		h & spellID; | ||||
| 		h & attackerChanges; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE StartAction : public CPackForClient | ||||
| { | ||||
| 	StartAction() = default; | ||||
| 	explicit StartAction(BattleAction act) | ||||
| 		: ba(std::move(act)) | ||||
| 	{ | ||||
| 	} | ||||
| 	void applyFirstCl(CClient * cl); | ||||
| 	void applyGs(CGameState * gs); | ||||
|  | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
| 	BattleAction ba; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		h & ba; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE EndAction : public CPackForClient | ||||
| { | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BattleSpellCast : public CPackForClient | ||||
| { | ||||
| 	void applyGs(CGameState * gs) const; | ||||
|  | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
| 	bool activeCast = true; | ||||
| 	ui8 side = 0; //which hero did cast spell: 0 - attacker, 1 - defender | ||||
| 	SpellID spellID; //id of spell | ||||
| 	ui8 manaGained = 0; //mana channeling ability | ||||
| 	BattleHex tile; //destination tile (may not be set in some global/mass spells | ||||
| 	std::set<ui32> affectedCres; //ids of creatures affected by this spell, generally used if spell does not set any effect (like dispel or cure) | ||||
| 	std::set<ui32> resistedCres; // creatures that resisted the spell (e.g. Dwarves) | ||||
| 	std::set<ui32> reflectedCres; // creatures that reflected the spell (e.g. Magic Mirror spell) | ||||
| 	si32 casterStack = -1; // -1 if not cated by creature, >=0 caster stack ID | ||||
| 	bool castByHero = true; //if true - spell has been cast by hero, otherwise by a creature | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		h & side; | ||||
| 		h & spellID; | ||||
| 		h & manaGained; | ||||
| 		h & tile; | ||||
| 		h & affectedCres; | ||||
| 		h & resistedCres; | ||||
| 		h & reflectedCres; | ||||
| 		h & casterStack; | ||||
| 		h & castByHero; | ||||
| 		h & activeCast; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| 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); | ||||
| 	void applyBattle(IBattleState * battleState); | ||||
|  | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
| 	std::vector<BattleStackAttacked> stacks; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		h & stacks; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BattleResultsApplied : public CPackForClient | ||||
| { | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
| 	PlayerColor player1, player2; | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		h & player1; | ||||
| 		h & player2; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BattleObstaclesChanged : public CPackForClient | ||||
| { | ||||
| 	void applyGs(CGameState * gs); | ||||
| 	void applyBattle(IBattleState * battleState); | ||||
|  | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
| 	std::vector<ObstacleChanges> changes; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		h & changes; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE CatapultAttack : public CPackForClient | ||||
| { | ||||
| 	struct AttackInfo | ||||
| 	{ | ||||
| 		si16 destinationTile; | ||||
| 		EWallPart attackedPart; | ||||
| 		ui8 damageDealt; | ||||
|  | ||||
| 		template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 		{ | ||||
| 			h & destinationTile; | ||||
| 			h & attackedPart; | ||||
| 			h & damageDealt; | ||||
| 		} | ||||
| 	}; | ||||
|  | ||||
| 	CatapultAttack(); | ||||
| 	~CatapultAttack() override; | ||||
|  | ||||
| 	void applyGs(CGameState * gs); | ||||
| 	void applyBattle(IBattleState * battleState); | ||||
|  | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
| 	std::vector< AttackInfo > attackedParts; | ||||
| 	int attacker = -1; //if -1, then a spell caused this | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		h & attackedParts; | ||||
| 		h & attacker; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BattleSetStackProperty : public CPackForClient | ||||
| { | ||||
| 	enum BattleStackProperty { CASTS, ENCHANTER_COUNTER, UNBIND, CLONED, HAS_CLONE }; | ||||
|  | ||||
| 	void applyGs(CGameState * gs) const; | ||||
|  | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
| 	int stackID = 0; | ||||
| 	BattleStackProperty which = CASTS; | ||||
| 	int val = 0; | ||||
| 	int absolute = 0; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		h & stackID; | ||||
| 		h & which; | ||||
| 		h & val; | ||||
| 		h & absolute; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
|  | ||||
| protected: | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
| }; | ||||
|  | ||||
| ///activated at the beginning of turn | ||||
| struct DLL_LINKAGE BattleTriggerEffect : public CPackForClient | ||||
| { | ||||
| 	void applyGs(CGameState * gs) const; //effect | ||||
|  | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
| 	int stackID = 0; | ||||
| 	int effect = 0; //use corresponding Bonus type | ||||
| 	int val = 0; | ||||
| 	int additionalInfo = 0; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		h & stackID; | ||||
| 		h & effect; | ||||
| 		h & val; | ||||
| 		h & additionalInfo; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
|  | ||||
| protected: | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BattleUpdateGateState : public CPackForClient | ||||
| { | ||||
| 	void applyGs(CGameState * gs) const; | ||||
|  | ||||
| 	BattleID battleID = BattleID::NONE; | ||||
| 	EGateState state = EGateState::NONE; | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & battleID; | ||||
| 		h & state; | ||||
| 		assert(battleID != BattleID::NONE); | ||||
| 	} | ||||
|  | ||||
| protected: | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
| }; | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_END | ||||
							
								
								
									
										667
									
								
								lib/networkPacks/PacksForServer.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										667
									
								
								lib/networkPacks/PacksForServer.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,667 @@ | ||||
| /* | ||||
|  * NetPacks.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 "../int3.h" | ||||
| #include "../battle/BattleAction.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
| struct DLL_LINKAGE GamePause : public CPackForServer | ||||
| { | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE EndTurn : public CPackForServer | ||||
| { | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE DismissHero : public CPackForServer | ||||
| { | ||||
| 	DismissHero() = default; | ||||
| 	DismissHero(const ObjectInstanceID & HID) | ||||
| 		: hid(HID) | ||||
| 	{ | ||||
| 	} | ||||
| 	ObjectInstanceID hid; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & hid; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE MoveHero : public CPackForServer | ||||
| { | ||||
| 	MoveHero() = default; | ||||
| 	MoveHero(const int3 & Dest, const ObjectInstanceID & HID, bool Transit) | ||||
| 		: dest(Dest) | ||||
| 		, hid(HID) | ||||
| 		, transit(Transit) | ||||
| 	{ | ||||
| 	} | ||||
| 	int3 dest; | ||||
| 	ObjectInstanceID hid; | ||||
| 	bool transit = false; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & dest; | ||||
| 		h & hid; | ||||
| 		h & transit; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE CastleTeleportHero : public CPackForServer | ||||
| { | ||||
| 	CastleTeleportHero() = default; | ||||
| 	CastleTeleportHero(const ObjectInstanceID & HID, const ObjectInstanceID & Dest, ui8 Source) | ||||
| 		: dest(Dest) | ||||
| 		, hid(HID) | ||||
| 		, source(Source) | ||||
| 	{ | ||||
| 	} | ||||
| 	ObjectInstanceID dest; | ||||
| 	ObjectInstanceID hid; | ||||
| 	si8 source = 0; //who give teleporting, 1=castle gate | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & dest; | ||||
| 		h & hid; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE ArrangeStacks : public CPackForServer | ||||
| { | ||||
| 	ArrangeStacks() = default; | ||||
| 	ArrangeStacks(ui8 W, const SlotID & P1, const SlotID & P2, const ObjectInstanceID & ID1, const ObjectInstanceID & ID2, si32 VAL) | ||||
| 		: what(W) | ||||
| 		, p1(P1) | ||||
| 		, p2(P2) | ||||
| 		, id1(ID1) | ||||
| 		, id2(ID2) | ||||
| 		, val(VAL) | ||||
| 	{ | ||||
| 	} | ||||
|  | ||||
| 	ui8 what = 0; //1 - swap; 2 - merge; 3 - split | ||||
| 	SlotID p1, p2; //positions of first and second stack | ||||
| 	ObjectInstanceID id1, id2; //ids of objects with garrison | ||||
| 	si32 val = 0; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & what; | ||||
| 		h & p1; | ||||
| 		h & p2; | ||||
| 		h & id1; | ||||
| 		h & id2; | ||||
| 		h & val; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BulkMoveArmy : public CPackForServer | ||||
| { | ||||
| 	SlotID srcSlot; | ||||
| 	ObjectInstanceID srcArmy; | ||||
| 	ObjectInstanceID destArmy; | ||||
|  | ||||
| 	BulkMoveArmy() = default; | ||||
|  | ||||
| 	BulkMoveArmy(const ObjectInstanceID & srcArmy, const ObjectInstanceID & destArmy, const SlotID & srcSlot) | ||||
| 		: srcArmy(srcArmy) | ||||
| 		, destArmy(destArmy) | ||||
| 		, srcSlot(srcSlot) | ||||
| 	{ | ||||
| 	} | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> | ||||
| 	void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & srcSlot; | ||||
| 		h & srcArmy; | ||||
| 		h & destArmy; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BulkSplitStack : public CPackForServer | ||||
| { | ||||
| 	SlotID src; | ||||
| 	ObjectInstanceID srcOwner; | ||||
| 	si32 amount = 0; | ||||
|  | ||||
| 	BulkSplitStack() = default; | ||||
|  | ||||
| 	BulkSplitStack(const ObjectInstanceID & srcOwner, const SlotID & src, si32 howMany) | ||||
| 		: src(src) | ||||
| 		, srcOwner(srcOwner) | ||||
| 		, amount(howMany) | ||||
| 	{ | ||||
| 	} | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> | ||||
| 	void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & src; | ||||
| 		h & srcOwner; | ||||
| 		h & amount; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BulkMergeStacks : public CPackForServer | ||||
| { | ||||
| 	SlotID src; | ||||
| 	ObjectInstanceID srcOwner; | ||||
|  | ||||
| 	BulkMergeStacks() = default; | ||||
|  | ||||
| 	BulkMergeStacks(const ObjectInstanceID & srcOwner, const SlotID & src) | ||||
| 		: src(src) | ||||
| 		, srcOwner(srcOwner) | ||||
| 	{ | ||||
| 	} | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> | ||||
| 	void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & src; | ||||
| 		h & srcOwner; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BulkSmartSplitStack : public CPackForServer | ||||
| { | ||||
| 	SlotID src; | ||||
| 	ObjectInstanceID srcOwner; | ||||
|  | ||||
| 	BulkSmartSplitStack() = default; | ||||
|  | ||||
| 	BulkSmartSplitStack(const ObjectInstanceID & srcOwner, const SlotID & src) | ||||
| 		: src(src) | ||||
| 		, srcOwner(srcOwner) | ||||
| 	{ | ||||
| 	} | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> | ||||
| 	void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & src; | ||||
| 		h & srcOwner; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE DisbandCreature : public CPackForServer | ||||
| { | ||||
| 	DisbandCreature() = default; | ||||
| 	DisbandCreature(const SlotID & Pos, const ObjectInstanceID & ID) | ||||
| 		: pos(Pos) | ||||
| 		, id(ID) | ||||
| 	{ | ||||
| 	} | ||||
| 	SlotID pos; //stack pos | ||||
| 	ObjectInstanceID id; //object id | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & pos; | ||||
| 		h & id; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BuildStructure : public CPackForServer | ||||
| { | ||||
| 	BuildStructure() = default; | ||||
| 	BuildStructure(const ObjectInstanceID & TID, const BuildingID & BID) | ||||
| 		: tid(TID) | ||||
| 		, bid(BID) | ||||
| 	{ | ||||
| 	} | ||||
| 	ObjectInstanceID tid; //town id | ||||
| 	BuildingID bid; //structure id | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & tid; | ||||
| 		h & bid; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE RazeStructure : public BuildStructure | ||||
| { | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE RecruitCreatures : public CPackForServer | ||||
| { | ||||
| 	RecruitCreatures() = default; | ||||
| 	RecruitCreatures(const ObjectInstanceID & TID, const ObjectInstanceID & DST, const CreatureID & CRID, si32 Amount, si32 Level) | ||||
| 		: tid(TID) | ||||
| 		, dst(DST) | ||||
| 		, crid(CRID) | ||||
| 		, amount(Amount) | ||||
| 		, level(Level) | ||||
| 	{ | ||||
| 	} | ||||
| 	ObjectInstanceID tid; //dwelling id, or town | ||||
| 	ObjectInstanceID dst; //destination ID, e.g. hero | ||||
| 	CreatureID crid; | ||||
| 	ui32 amount = 0; //creature amount | ||||
| 	si32 level = 0; //dwelling level to buy from, -1 if any | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & tid; | ||||
| 		h & dst; | ||||
| 		h & crid; | ||||
| 		h & amount; | ||||
| 		h & level; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE UpgradeCreature : public CPackForServer | ||||
| { | ||||
| 	UpgradeCreature() = default; | ||||
| 	UpgradeCreature(const SlotID & Pos, const ObjectInstanceID & ID, const CreatureID & CRID) | ||||
| 		: pos(Pos) | ||||
| 		, id(ID) | ||||
| 		, cid(CRID) | ||||
| 	{ | ||||
| 	} | ||||
| 	SlotID pos; //stack pos | ||||
| 	ObjectInstanceID id; //object id | ||||
| 	CreatureID cid; //id of type to which we want make upgrade | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & pos; | ||||
| 		h & id; | ||||
| 		h & cid; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE GarrisonHeroSwap : public CPackForServer | ||||
| { | ||||
| 	GarrisonHeroSwap() = default; | ||||
| 	GarrisonHeroSwap(const ObjectInstanceID & TID) | ||||
| 		: tid(TID) | ||||
| 	{ | ||||
| 	} | ||||
| 	ObjectInstanceID tid; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & tid; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE ExchangeArtifacts : public CPackForServer | ||||
| { | ||||
| 	ArtifactLocation src, dst; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & src; | ||||
| 		h & dst; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BulkExchangeArtifacts : public CPackForServer | ||||
| { | ||||
| 	ObjectInstanceID srcHero; | ||||
| 	ObjectInstanceID dstHero; | ||||
| 	bool swap = false; | ||||
| 	bool equipped = true; | ||||
| 	bool backpack = true; | ||||
|  | ||||
| 	BulkExchangeArtifacts() = default; | ||||
| 	BulkExchangeArtifacts(const ObjectInstanceID & srcHero, const ObjectInstanceID & dstHero, bool swap, bool equipped, bool backpack) | ||||
| 		: srcHero(srcHero) | ||||
| 		, dstHero(dstHero) | ||||
| 		, swap(swap) | ||||
| 		, equipped(equipped) | ||||
| 		, backpack(backpack) | ||||
| 	{ | ||||
| 	} | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & srcHero; | ||||
| 		h & dstHero; | ||||
| 		h & swap; | ||||
| 		h & equipped; | ||||
| 		h & backpack; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE AssembleArtifacts : public CPackForServer | ||||
| { | ||||
| 	AssembleArtifacts() = default; | ||||
| 	AssembleArtifacts(const ObjectInstanceID & _heroID, const ArtifactPosition & _artifactSlot, bool _assemble, const ArtifactID & _assembleTo) | ||||
| 		: heroID(_heroID) | ||||
| 		, artifactSlot(_artifactSlot) | ||||
| 		, assemble(_assemble) | ||||
| 		, assembleTo(_assembleTo) | ||||
| 	{ | ||||
| 	} | ||||
| 	ObjectInstanceID heroID; | ||||
| 	ArtifactPosition artifactSlot; | ||||
| 	bool assemble = false; // True to assemble artifact, false to disassemble. | ||||
| 	ArtifactID assembleTo; // Artifact to assemble into. | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & heroID; | ||||
| 		h & artifactSlot; | ||||
| 		h & assemble; | ||||
| 		h & assembleTo; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE EraseArtifactByClient : public CPackForServer | ||||
| { | ||||
| 	EraseArtifactByClient() = default; | ||||
| 	EraseArtifactByClient(const ArtifactLocation & al) | ||||
| 		: al(al) | ||||
| 	{ | ||||
| 	} | ||||
| 	ArtifactLocation al; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer&>(*this); | ||||
| 		h & al; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BuyArtifact : public CPackForServer | ||||
| { | ||||
| 	BuyArtifact() = default; | ||||
| 	BuyArtifact(const ObjectInstanceID & HID, const ArtifactID & AID) | ||||
| 		: hid(HID) | ||||
| 		, aid(AID) | ||||
| 	{ | ||||
| 	} | ||||
| 	ObjectInstanceID hid; | ||||
| 	ArtifactID aid; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & hid; | ||||
| 		h & aid; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE TradeOnMarketplace : public CPackForServer | ||||
| { | ||||
| 	ObjectInstanceID marketId; | ||||
| 	ObjectInstanceID heroId; | ||||
|  | ||||
| 	EMarketMode mode = EMarketMode::RESOURCE_RESOURCE; | ||||
| 	std::vector<ui32> r1, r2; //mode 0: r1 - sold resource, r2 - bought res (exception: when sacrificing art r1 is art id [todo: make r2 preferred slot?] | ||||
| 	std::vector<ui32> val; //units of sold resource | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & marketId; | ||||
| 		h & heroId; | ||||
| 		h & mode; | ||||
| 		h & r1; | ||||
| 		h & r2; | ||||
| 		h & val; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE SetFormation : public CPackForServer | ||||
| { | ||||
| 	SetFormation() = default; | ||||
| 	; | ||||
| 	SetFormation(const ObjectInstanceID & HID, ui8 Formation) | ||||
| 		: hid(HID) | ||||
| 		, formation(Formation) | ||||
| 	{ | ||||
| 	} | ||||
| 	ObjectInstanceID hid; | ||||
| 	ui8 formation = 0; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & hid; | ||||
| 		h & formation; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE HireHero : public CPackForServer | ||||
| { | ||||
| 	HireHero() = default; | ||||
| 	HireHero(HeroTypeID HID, const ObjectInstanceID & TID) | ||||
| 		: hid(HID) | ||||
| 		, tid(TID) | ||||
| 	{ | ||||
| 	} | ||||
| 	HeroTypeID hid; //available hero serial | ||||
| 	ObjectInstanceID tid; //town (tavern) id | ||||
| 	PlayerColor player; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & hid; | ||||
| 		h & tid; | ||||
| 		h & player; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE BuildBoat : public CPackForServer | ||||
| { | ||||
| 	ObjectInstanceID objid; //where player wants to buy a boat | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & objid; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE QueryReply : public CPackForServer | ||||
| { | ||||
| 	QueryReply() = default; | ||||
| 	QueryReply(const QueryID & QID, std::optional<int32_t> Reply) | ||||
| 		: qid(QID) | ||||
| 		, reply(Reply) | ||||
| 	{ | ||||
| 	} | ||||
| 	QueryID qid; | ||||
| 	PlayerColor player; | ||||
| 	std::optional<int32_t> reply; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & qid; | ||||
| 		h & player; | ||||
| 		h & reply; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE MakeAction : public CPackForServer | ||||
| { | ||||
| 	MakeAction() = default; | ||||
| 	MakeAction(BattleAction BA) | ||||
| 		: ba(std::move(BA)) | ||||
| 	{ | ||||
| 	} | ||||
| 	BattleAction ba; | ||||
| 	BattleID battleID; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & ba; | ||||
| 		h & battleID; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE DigWithHero : public CPackForServer | ||||
| { | ||||
| 	ObjectInstanceID id; //digging hero id | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & id; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE CastAdvSpell : public CPackForServer | ||||
| { | ||||
| 	ObjectInstanceID hid; //hero id | ||||
| 	SpellID sid; //spell id | ||||
| 	int3 pos; //selected tile (not always used) | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & hid; | ||||
| 		h & sid; | ||||
| 		h & pos; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| /***********************************************************************************************************/ | ||||
|  | ||||
| struct DLL_LINKAGE SaveGame : public CPackForServer | ||||
| { | ||||
| 	SaveGame() = default; | ||||
| 	SaveGame(std::string Fname) | ||||
| 		: fname(std::move(Fname)) | ||||
| 	{ | ||||
| 	} | ||||
| 	std::string fname; | ||||
|  | ||||
| 	void applyGs(CGameState * gs) {}; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & fname; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| struct DLL_LINKAGE PlayerMessage : public CPackForServer | ||||
| { | ||||
| 	PlayerMessage() = default; | ||||
| 	PlayerMessage(std::string Text, const ObjectInstanceID & obj) | ||||
| 		: text(std::move(Text)) | ||||
| 		, currObj(obj) | ||||
| 	{ | ||||
| 	} | ||||
|  | ||||
| 	void applyGs(CGameState * gs) {}; | ||||
|  | ||||
| 	void visitTyped(ICPackVisitor & visitor) override; | ||||
|  | ||||
| 	std::string text; | ||||
| 	ObjectInstanceID currObj; // optional parameter that specifies current object. For cheats :) | ||||
|  | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & static_cast<CPackForServer &>(*this); | ||||
| 		h & text; | ||||
| 		h & currObj; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_END | ||||
							
								
								
									
										40
									
								
								lib/networkPacks/StackLocation.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								lib/networkPacks/StackLocation.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | ||||
| /* | ||||
|  * StackLocation.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 "../ConstTransitivePtr.h" | ||||
| #include "../GameConstants.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
| class CArmedInstance; | ||||
| class CStackInstance; | ||||
|  | ||||
| struct StackLocation | ||||
| { | ||||
| 	ConstTransitivePtr<CArmedInstance> army; | ||||
| 	SlotID slot; | ||||
|  | ||||
| 	StackLocation() = default; | ||||
| 	StackLocation(const CArmedInstance * Army, const SlotID & Slot) | ||||
| 		: army(const_cast<CArmedInstance *>(Army))  //we are allowed here to const cast -> change will go through one of our packages... do not abuse! | ||||
| 		, slot(Slot) | ||||
| 	{ | ||||
| 	} | ||||
|  | ||||
| 	DLL_LINKAGE const CStackInstance * getStack(); | ||||
| 	template <typename Handler> void serialize(Handler & h, const int version) | ||||
| 	{ | ||||
| 		h & army; | ||||
| 		h & slot; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_END | ||||
| @@ -9,8 +9,10 @@ | ||||
|  */ | ||||
| #pragma once | ||||
|  | ||||
| #include "../NetPacks.h" | ||||
| #include "../NetPacksLobby.h" | ||||
| #include "../networkPacks/PacksForClient.h" | ||||
| #include "../networkPacks/PacksForClientBattle.h" | ||||
| #include "../networkPacks/PacksForServer.h" | ||||
| #include "../networkPacks/NetPacksLobby.h" | ||||
| #include "../VCMI_Lib.h" | ||||
| #include "../CArtHandler.h" | ||||
| #include "../CCreatureSet.h" | ||||
|   | ||||
| @@ -18,7 +18,6 @@ | ||||
| #include "../CHeroHandler.h" | ||||
| #include "../spells/CSpellHandler.h" | ||||
| #include "../CTownHandler.h" | ||||
| #include "../NetPacks.h" | ||||
|  | ||||
| #include "../serializer/BinaryDeserializer.h" | ||||
| #include "../serializer/BinarySerializer.h" | ||||
|   | ||||
| @@ -20,7 +20,6 @@ | ||||
| #include "../CHeroHandler.h" | ||||
| #include "../spells/CSpellHandler.h" | ||||
| #include "../CTownHandler.h" | ||||
| #include "../NetPacks.h" | ||||
|  | ||||
| #include "../serializer/BinaryDeserializer.h" | ||||
| #include "../serializer/BinarySerializer.h" | ||||
|   | ||||
| @@ -27,7 +27,6 @@ | ||||
| #include "../RiverHandler.h" | ||||
| #include "../TerrainHandler.h" | ||||
| #include "../campaign/CampaignState.h" | ||||
| #include "../NetPacks.h" | ||||
| #include "../rmg/CMapGenOptions.h" | ||||
|  | ||||
| #include "../serializer/BinaryDeserializer.h" | ||||
|   | ||||
| @@ -18,7 +18,6 @@ | ||||
| #include "../CHeroHandler.h" | ||||
| #include "../spells/CSpellHandler.h" | ||||
| #include "../CTownHandler.h" | ||||
| #include "../NetPacks.h" | ||||
|  | ||||
| #include "../serializer/BinaryDeserializer.h" | ||||
| #include "../serializer/BinarySerializer.h" | ||||
|   | ||||
| @@ -20,7 +20,6 @@ | ||||
| #include "../CHeroHandler.h" | ||||
| #include "../spells/CSpellHandler.h" | ||||
| #include "../CTownHandler.h" | ||||
| #include "../NetPacks.h" | ||||
|  | ||||
| #include "../serializer/BinaryDeserializer.h" | ||||
| #include "../serializer/BinarySerializer.h" | ||||
|   | ||||
| @@ -18,7 +18,6 @@ | ||||
| #include "../CHeroHandler.h" | ||||
| #include "../spells/CSpellHandler.h" | ||||
| #include "../CTownHandler.h" | ||||
| #include "../NetPacks.h" | ||||
|  | ||||
| #include "../serializer/BinaryDeserializer.h" | ||||
| #include "../serializer/BinarySerializer.h" | ||||
|   | ||||
| @@ -18,7 +18,6 @@ | ||||
| #include "../CHeroHandler.h" | ||||
| #include "../spells/CSpellHandler.h" | ||||
| #include "../CTownHandler.h" | ||||
| #include "../NetPacks.h" | ||||
|  | ||||
| #include "../serializer/BinaryDeserializer.h" | ||||
| #include "../serializer/BinarySerializer.h" | ||||
|   | ||||
| @@ -12,8 +12,8 @@ | ||||
|  | ||||
| #include "Limiter.h" | ||||
| #include "MetaString.h" | ||||
| #include "NetPacksBase.h" | ||||
| #include "Reward.h" | ||||
| #include "../networkPacks/EInfoWindowMode.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
|   | ||||
| @@ -15,11 +15,14 @@ | ||||
| #include "../TerrainHandler.h" | ||||
| #include "../CPlayerState.h" | ||||
| #include "../CSoundBase.h" | ||||
| #include "../NetPacks.h" | ||||
| #include "../gameState/CGameState.h" | ||||
| #include "../spells/CSpellHandler.h" | ||||
| #include "../spells/ISpellMechanics.h" | ||||
| #include "../mapObjects/CGHeroInstance.h" | ||||
| #include "../mapObjects/MiscObjects.h" | ||||
| #include "../mapping/CMapDefines.h" | ||||
| #include "../networkPacks/StackLocation.h" | ||||
| #include "../networkPacks/PacksForClient.h" | ||||
| #include "../IGameCallback.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|   | ||||
| @@ -14,6 +14,7 @@ | ||||
| #include "../IGameCallback.h" | ||||
| #include "../CPlayerState.h" | ||||
| #include "../mapObjects/CGHeroInstance.h" | ||||
| #include "../networkPacks/Component.h" | ||||
| #include "../serializer/JsonSerializeFormat.h" | ||||
| #include "../constants/StringConstants.h" | ||||
| #include "../CHeroHandler.h" | ||||
|   | ||||
| @@ -13,6 +13,7 @@ | ||||
| #include "../ResourceSet.h" | ||||
| #include "../bonuses/Bonus.h" | ||||
| #include "../CCreatureSet.h" | ||||
| #include "../networkPacks/Component.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
|   | ||||
| @@ -14,12 +14,12 @@ | ||||
|  | ||||
| #include "CSpellHandler.h" | ||||
|  | ||||
| #include "../CGameInfoCallback.h" | ||||
| #include "../CPlayerState.h" | ||||
| #include "../CRandomGenerator.h" | ||||
| #include "../mapObjects/CGHeroInstance.h" | ||||
| #include "../NetPacks.h" | ||||
| #include "../CGameInfoCallback.h" | ||||
| #include "../mapping/CMap.h" | ||||
| #include "../CPlayerState.h" | ||||
| #include "../networkPacks/PacksForClient.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
|   | ||||
| @@ -16,9 +16,8 @@ | ||||
|  | ||||
| #include "../battle/IBattleState.h" | ||||
| #include "../battle/CBattleInfoCallback.h" | ||||
|  | ||||
| #include "../networkPacks/PacksForClientBattle.h" | ||||
| #include "../CStack.h" | ||||
| #include "../NetPacks.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
|   | ||||
| @@ -36,7 +36,6 @@ | ||||
| #include "effects/Timed.h" | ||||
|  | ||||
| #include "CSpellHandler.h" | ||||
| #include "../NetPacks.h" | ||||
|  | ||||
| #include "../CHeroHandler.h"//todo: remove | ||||
| #include "../IGameCallback.h"//todo: remove | ||||
|   | ||||
| @@ -9,7 +9,6 @@ | ||||
|  */ | ||||
|  | ||||
| #include "ProxyCaster.h" | ||||
| #include "../lib/NetPacksBase.h" | ||||
| #include "../battle/BattleHex.h" | ||||
| #include "../battle/CObstacleInstance.h" | ||||
|  | ||||
|   | ||||
| @@ -14,11 +14,11 @@ | ||||
| #include "Registry.h" | ||||
| #include "../ISpellMechanics.h" | ||||
|  | ||||
| #include "../../NetPacks.h" | ||||
| #include "../../battle/IBattleState.h" | ||||
| #include "../../battle/CBattleInfoCallback.h" | ||||
| #include "../../battle/Unit.h" | ||||
| #include "../../mapObjects/CGTownInstance.h" | ||||
| #include "../../networkPacks/PacksForClientBattle.h" | ||||
| #include "../../serializer/JsonSerializeFormat.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|   | ||||
| @@ -12,10 +12,10 @@ | ||||
| #include "Clone.h" | ||||
| #include "Registry.h" | ||||
| #include "../ISpellMechanics.h" | ||||
| #include "../../NetPacks.h" | ||||
| #include "../../battle/CBattleInfoCallback.h" | ||||
| #include "../../battle/IBattleState.h" | ||||
| #include "../../battle/CUnitState.h" | ||||
| #include "../../networkPacks/PacksForClientBattle.h" | ||||
| #include "../../serializer/JsonSerializeFormat.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|   | ||||
| @@ -14,10 +14,11 @@ | ||||
| #include "../CSpellHandler.h" | ||||
| #include "../ISpellMechanics.h" | ||||
|  | ||||
| #include "../../NetPacks.h" | ||||
| #include "../../MetaString.h" | ||||
| #include "../../CStack.h" | ||||
| #include "../../battle/IBattleState.h" | ||||
| #include "../../battle/CBattleInfoCallback.h" | ||||
| #include "../../networkPacks/PacksForClientBattle.h" | ||||
| #include "../../CGeneralTextHandler.h" | ||||
| #include "../../serializer/JsonSerializeFormat.h" | ||||
|  | ||||
|   | ||||
| @@ -12,10 +12,10 @@ | ||||
| #include "DemonSummon.h" | ||||
| #include "Registry.h" | ||||
| #include "../ISpellMechanics.h" | ||||
| #include "../../NetPacks.h" | ||||
| #include "../../battle/CBattleInfoCallback.h" | ||||
| #include "../../battle/BattleInfo.h" | ||||
| #include "../../battle/CUnitState.h" | ||||
| #include "../../networkPacks/PacksForClientBattle.h" | ||||
| #include "../../serializer/JsonSerializeFormat.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|   | ||||
| @@ -16,10 +16,12 @@ | ||||
|  | ||||
| #include "../ISpellMechanics.h" | ||||
|  | ||||
| #include "../../NetPacks.h" | ||||
| #include "../../MetaString.h" | ||||
| #include "../../battle/IBattleState.h" | ||||
| #include "../../battle/CBattleInfoCallback.h" | ||||
| #include "../../battle/Unit.h" | ||||
| #include "../../bonuses/BonusList.h" | ||||
| #include "../../networkPacks/PacksForClientBattle.h" | ||||
| #include "../../serializer/JsonSerializeFormat.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|   | ||||
| @@ -13,11 +13,12 @@ | ||||
| #include "Registry.h" | ||||
| #include "../ISpellMechanics.h" | ||||
|  | ||||
| #include "../../NetPacks.h" | ||||
| #include "../../MetaString.h" | ||||
| #include "../../battle/IBattleState.h" | ||||
| #include "../../battle/CUnitState.h" | ||||
| #include "../../battle/CBattleInfoCallback.h" | ||||
| #include "../../battle/Unit.h" | ||||
| #include "../../networkPacks/PacksForClientBattle.h" | ||||
| #include "../../serializer/JsonSerializeFormat.h" | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_BEGIN | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user