Explorar o código

Split CConnection into GameConnection and IGameConnection classes

Ivan Savenko hai 3 meses
pai
achega
58de180083

+ 2 - 3
client/CServerHandler.cpp

@@ -48,8 +48,7 @@
 #include "../lib/mapObjects/MiscObjects.h"
 #include "../lib/mapObjects/MiscObjects.h"
 #include "../lib/modding/ModIncompatibility.h"
 #include "../lib/modding/ModIncompatibility.h"
 #include "../lib/rmg/CMapGenOptions.h"
 #include "../lib/rmg/CMapGenOptions.h"
-#include "../lib/serializer/Connection.h"
-#include "../lib/filesystem/Filesystem.h"
+#include "../lib/serializer/GameConnection.h"
 #include "../lib/UnlockGuard.h"
 #include "../lib/UnlockGuard.h"
 
 
 #include <boost/uuid/uuid.hpp>
 #include <boost/uuid/uuid.hpp>
@@ -269,7 +268,7 @@ void CServerHandler::onConnectionEstablished(const NetworkConnectionPtr & netCon
 		getGlobalLobby().sendProxyConnectionLogin(netConnection);
 		getGlobalLobby().sendProxyConnectionLogin(netConnection);
 	}
 	}
 
 
-	logicConnection = std::make_shared<CConnection>(netConnection);
+	logicConnection = std::make_shared<GameConnection>(netConnection);
 	logicConnection->uuid = uuid;
 	logicConnection->uuid = uuid;
 	logicConnection->enterLobbyConnectionMode();
 	logicConnection->enterLobbyConnectionMode();
 	sendClientConnecting();
 	sendClientConnecting();

+ 2 - 2
client/CServerHandler.h

@@ -17,7 +17,7 @@
 
 
 VCMI_LIB_NAMESPACE_BEGIN
 VCMI_LIB_NAMESPACE_BEGIN
 
 
-class CConnection;
+class GameConnection;
 class PlayerColor;
 class PlayerColor;
 struct StartInfo;
 struct StartInfo;
 struct TurnTimerInfo;
 struct TurnTimerInfo;
@@ -125,7 +125,7 @@ class CServerHandler final : public IServerAPI, public LobbyInfo, public INetwor
 
 
 public:
 public:
 	/// High-level connection overlay that is capable of (de)serializing network data
 	/// High-level connection overlay that is capable of (de)serializing network data
-	std::shared_ptr<CConnection> logicConnection;
+	std::shared_ptr<GameConnection> logicConnection;
 
 
 	////////////////////
 	////////////////////
 	// FIXME: Bunch of crutches to glue it all together
 	// FIXME: Bunch of crutches to glue it all together

+ 2 - 5
client/Client.cpp

@@ -30,16 +30,16 @@
 #include "../lib/callback/CDynLibHandler.h"
 #include "../lib/callback/CDynLibHandler.h"
 #include "../lib/callback/CGlobalAI.h"
 #include "../lib/callback/CGlobalAI.h"
 #include "../lib/callback/IGameInfoCallback.h"
 #include "../lib/callback/IGameInfoCallback.h"
+#include "../lib/filesystem/Filesystem.h"
 #include "../lib/gameState/CGameState.h"
 #include "../lib/gameState/CGameState.h"
 #include "../lib/CPlayerState.h"
 #include "../lib/CPlayerState.h"
 #include "../lib/CThreadHelper.h"
 #include "../lib/CThreadHelper.h"
 #include "../lib/VCMIDirs.h"
 #include "../lib/VCMIDirs.h"
 #include "../lib/UnlockGuard.h"
 #include "../lib/UnlockGuard.h"
-#include "../lib/serializer/Connection.h"
 #include "../lib/mapObjects/army/CArmedInstance.h"
 #include "../lib/mapObjects/army/CArmedInstance.h"
 #include "../lib/mapping/CMapService.h"
 #include "../lib/mapping/CMapService.h"
 #include "../lib/pathfinder/CGPathNode.h"
 #include "../lib/pathfinder/CGPathNode.h"
-#include "../lib/filesystem/Filesystem.h"
+#include "../lib/serializer/GameConnection.h"
 
 
 #include <memory>
 #include <memory>
 #include <vcmi/events/EventBus.h>
 #include <vcmi/events/EventBus.h>
@@ -125,7 +125,6 @@ events::EventBus * CClient::eventBus() const
 void CClient::newGame(std::shared_ptr<CGameState> initializedGameState)
 void CClient::newGame(std::shared_ptr<CGameState> initializedGameState)
 {
 {
 	GAME->server().th->update();
 	GAME->server().th->update();
-	CMapService mapService;
 	assert(initializedGameState);
 	assert(initializedGameState);
 	gamestate = initializedGameState;
 	gamestate = initializedGameState;
 	gamestate->preInit(LIBRARY);
 	gamestate->preInit(LIBRARY);
@@ -148,9 +147,7 @@ void CClient::loadGame(std::shared_ptr<CGameState> initializedGameState)
 	logNetwork->info("Game loaded, initialize interfaces.");
 	logNetwork->info("Game loaded, initialize interfaces.");
 
 
 	initMapHandler();
 	initMapHandler();
-
 	reinitScripting();
 	reinitScripting();
-
 	initPlayerEnvironments();
 	initPlayerEnvironments();
 	initPlayerInterfaces();
 	initPlayerInterfaces();
 }
 }

+ 1 - 1
client/ClientCommandManager.cpp

@@ -38,9 +38,9 @@
 #include "../lib/modding/CModHandler.h"
 #include "../lib/modding/CModHandler.h"
 #include "../lib/modding/ContentTypeHandler.h"
 #include "../lib/modding/ContentTypeHandler.h"
 #include "../lib/modding/ModUtility.h"
 #include "../lib/modding/ModUtility.h"
+#include "../lib/serializer/GameConnection.h"
 #include "../lib/VCMIDirs.h"
 #include "../lib/VCMIDirs.h"
 #include "../lib/logging/VisualLogger.h"
 #include "../lib/logging/VisualLogger.h"
-#include "../lib/serializer/Connection.h"
 
 
 #ifdef SCRIPTING_ENABLED
 #ifdef SCRIPTING_ENABLED
 #include "../lib/ScriptHandler.h"
 #include "../lib/ScriptHandler.h"

+ 1 - 1
client/NetPacksClient.cpp

@@ -31,7 +31,6 @@
 #include "../lib/callback/CCallback.h"
 #include "../lib/callback/CCallback.h"
 #include "../lib/filesystem/Filesystem.h"
 #include "../lib/filesystem/Filesystem.h"
 #include "../lib/filesystem/FileInfo.h"
 #include "../lib/filesystem/FileInfo.h"
-#include "../lib/serializer/Connection.h"
 #include "../lib/texts/CGeneralTextHandler.h"
 #include "../lib/texts/CGeneralTextHandler.h"
 #include "../lib/GameLibrary.h"
 #include "../lib/GameLibrary.h"
 #include "../lib/mapping/CMap.h"
 #include "../lib/mapping/CMap.h"
@@ -44,6 +43,7 @@
 #include "../lib/mapObjects/CGMarket.h"
 #include "../lib/mapObjects/CGMarket.h"
 #include "../lib/mapObjects/CGTownInstance.h"
 #include "../lib/mapObjects/CGTownInstance.h"
 #include "../lib/gameState/CGameState.h"
 #include "../lib/gameState/CGameState.h"
+#include "../lib/serializer/GameConnection.h"
 #include "../lib/CStack.h"
 #include "../lib/CStack.h"
 #include "../lib/battle/BattleInfo.h"
 #include "../lib/battle/BattleInfo.h"
 #include "../lib/GameConstants.h"
 #include "../lib/GameConstants.h"

+ 2 - 2
client/NetPacksLobbyClient.cpp

@@ -36,9 +36,9 @@
 #include "windows/GUIClasses.h"
 #include "windows/GUIClasses.h"
 
 
 #include "../lib/CConfigHandler.h"
 #include "../lib/CConfigHandler.h"
-#include "../lib/texts/CGeneralTextHandler.h"
-#include "../lib/serializer/Connection.h"
 #include "../lib/campaign/CampaignState.h"
 #include "../lib/campaign/CampaignState.h"
+#include "../lib/serializer/GameConnection.h"
+#include "../lib/texts/CGeneralTextHandler.h"
 
 
 void ApplyOnLobbyHandlerNetPackVisitor::visitLobbyClientConnected(LobbyClientConnected & pack)
 void ApplyOnLobbyHandlerNetPackVisitor::visitLobbyClientConnected(LobbyClientConnected & pack)
 {
 {

+ 3 - 2
lib/CMakeLists.txt

@@ -246,7 +246,7 @@ set(lib_MAIN_SRCS
 
 
 	serializer/CLoadFile.cpp
 	serializer/CLoadFile.cpp
 	serializer/CMemorySerializer.cpp
 	serializer/CMemorySerializer.cpp
-	serializer/Connection.cpp
+	serializer/GameConnection.cpp
 	serializer/CSaveFile.cpp
 	serializer/CSaveFile.cpp
 	serializer/CTypeList.cpp
 	serializer/CTypeList.cpp
 	serializer/JsonDeserializer.cpp
 	serializer/JsonDeserializer.cpp
@@ -705,10 +705,11 @@ set(lib_MAIN_HEADERS
 	serializer/BinarySerializer.h
 	serializer/BinarySerializer.h
 	serializer/CLoadFile.h
 	serializer/CLoadFile.h
 	serializer/CMemorySerializer.h
 	serializer/CMemorySerializer.h
-	serializer/Connection.h
+	serializer/GameConnection.h
 	serializer/CSaveFile.h
 	serializer/CSaveFile.h
 	serializer/CSerializer.h
 	serializer/CSerializer.h
 	serializer/CTypeList.h
 	serializer/CTypeList.h
+	serializer/IGameConnection.h
 	serializer/JsonDeserializer.h
 	serializer/JsonDeserializer.h
 	serializer/JsonSerializeFormat.h
 	serializer/JsonSerializeFormat.h
 	serializer/JsonSerializer.h
 	serializer/JsonSerializer.h

+ 0 - 2
lib/networkPacks/NetPacksBase.h

@@ -15,8 +15,6 @@
 VCMI_LIB_NAMESPACE_BEGIN
 VCMI_LIB_NAMESPACE_BEGIN
 
 
 class CGameState;
 class CGameState;
-class CConnection;
-
 class ICPackVisitor;
 class ICPackVisitor;
 
 
 struct DLL_LINKAGE CPack : public Serializeable
 struct DLL_LINKAGE CPack : public Serializeable

+ 16 - 11
lib/serializer/Connection.cpp → lib/serializer/GameConnection.cpp

@@ -1,5 +1,5 @@
 /*
 /*
- * Connection.cpp, part of VCMI engine
+ * GameConnection.cpp, part of VCMI engine
  *
  *
  * Authors: listed in file AUTHORS in main folder
  * Authors: listed in file AUTHORS in main folder
  *
  *
@@ -8,7 +8,7 @@
  *
  *
  */
  */
 #include "StdInc.h"
 #include "StdInc.h"
-#include "Connection.h"
+#include "GameConnection.h"
 
 
 #include "BinaryDeserializer.h"
 #include "BinaryDeserializer.h"
 #include "BinarySerializer.h"
 #include "BinarySerializer.h"
@@ -52,7 +52,7 @@ int ConnectionPackReader::read(std::byte * data, unsigned size)
 	return size;
 	return size;
 }
 }
 
 
-CConnection::CConnection(std::weak_ptr<INetworkConnection> networkConnection)
+GameConnection::GameConnection(std::weak_ptr<INetworkConnection> networkConnection)
 	: networkConnection(networkConnection)
 	: networkConnection(networkConnection)
 	, packReader(std::make_unique<ConnectionPackReader>())
 	, packReader(std::make_unique<ConnectionPackReader>())
 	, packWriter(std::make_unique<ConnectionPackWriter>())
 	, packWriter(std::make_unique<ConnectionPackWriter>())
@@ -66,9 +66,14 @@ CConnection::CConnection(std::weak_ptr<INetworkConnection> networkConnection)
 	deserializer->version = ESerializationVersion::CURRENT;
 	deserializer->version = ESerializationVersion::CURRENT;
 }
 }
 
 
-CConnection::~CConnection() = default;
+GameConnection::~GameConnection() = default;
 
 
-void CConnection::sendPack(const CPack & pack)
+int GameConnection::getConnectionID() const
+{
+	return connectionID;
+}
+
+void GameConnection::sendPack(const CPack & pack)
 {
 {
 	std::scoped_lock lock(writeMutex);
 	std::scoped_lock lock(writeMutex);
 
 
@@ -87,7 +92,7 @@ void CConnection::sendPack(const CPack & pack)
 	serializer->clear();
 	serializer->clear();
 }
 }
 
 
-std::unique_ptr<CPack> CConnection::retrievePack(const std::vector<std::byte> & data)
+std::unique_ptr<CPack> GameConnection::retrievePack(const std::vector<std::byte> & data)
 {
 {
 	std::unique_ptr<CPack> result;
 	std::unique_ptr<CPack> result;
 
 
@@ -108,28 +113,28 @@ std::unique_ptr<CPack> CConnection::retrievePack(const std::vector<std::byte> &
 	return result;
 	return result;
 }
 }
 
 
-bool CConnection::isMyConnection(const std::shared_ptr<INetworkConnection> & otherConnection) const
+bool GameConnection::isMyConnection(const std::shared_ptr<INetworkConnection> & otherConnection) const
 {
 {
 	return otherConnection != nullptr && networkConnection.lock() == otherConnection;
 	return otherConnection != nullptr && networkConnection.lock() == otherConnection;
 }
 }
 
 
-std::shared_ptr<INetworkConnection> CConnection::getConnection()
+std::shared_ptr<INetworkConnection> GameConnection::getConnection()
 {
 {
 	return networkConnection.lock();
 	return networkConnection.lock();
 }
 }
 
 
-void CConnection::enterLobbyConnectionMode()
+void GameConnection::enterLobbyConnectionMode()
 {
 {
 	deserializer->clear();
 	deserializer->clear();
 	serializer->clear();
 	serializer->clear();
 }
 }
 
 
-void CConnection::setCallback(IGameInfoCallback & cb)
+void GameConnection::setCallback(IGameInfoCallback & cb)
 {
 {
 	deserializer->cb = &cb;
 	deserializer->cb = &cb;
 }
 }
 
 
-void CConnection::setSerializationVersion(ESerializationVersion version)
+void GameConnection::setSerializationVersion(ESerializationVersion version)
 {
 {
 	deserializer->version = version;
 	deserializer->version = version;
 	serializer->version = version;
 	serializer->version = version;

+ 8 - 5
lib/serializer/Connection.h → lib/serializer/GameConnection.h

@@ -1,5 +1,5 @@
 /*
 /*
- * Connection.h, part of VCMI engine
+ * GameConnection.h, part of VCMI engine
  *
  *
  * Authors: listed in file AUTHORS in main folder
  * Authors: listed in file AUTHORS in main folder
  *
  *
@@ -9,6 +9,8 @@
  */
  */
 #pragma once
 #pragma once
 
 
+#include "IGameConnection.h"
+
 enum class ESerializationVersion : int32_t;
 enum class ESerializationVersion : int32_t;
 
 
 VCMI_LIB_NAMESPACE_BEGIN
 VCMI_LIB_NAMESPACE_BEGIN
@@ -24,7 +26,7 @@ class IGameInfoCallback;
 
 
 /// Wrapper class for game connection
 /// Wrapper class for game connection
 /// Handles serialization and deserialization of data received from network
 /// Handles serialization and deserialization of data received from network
-class DLL_LINKAGE CConnection : boost::noncopyable
+class DLL_LINKAGE GameConnection final : public IGameConnection
 {
 {
 	/// Non-owning pointer to underlying connection
 	/// Non-owning pointer to underlying connection
 	std::weak_ptr<INetworkConnection> networkConnection;
 	std::weak_ptr<INetworkConnection> networkConnection;
@@ -43,10 +45,11 @@ public:
 	std::string uuid;
 	std::string uuid;
 	int connectionID;
 	int connectionID;
 
 
-	explicit CConnection(std::weak_ptr<INetworkConnection> networkConnection);
-	~CConnection();
+	explicit GameConnection(std::weak_ptr<INetworkConnection> networkConnection);
+	~GameConnection();
 
 
-	void sendPack(const CPack & pack);
+	void sendPack(const CPack & pack) override;
+	int getConnectionID() const override;
 	std::unique_ptr<CPack> retrievePack(const std::vector<std::byte> & data);
 	std::unique_ptr<CPack> retrievePack(const std::vector<std::byte> & data);
 
 
 	void enterLobbyConnectionMode();
 	void enterLobbyConnectionMode();

+ 23 - 0
lib/serializer/IGameConnection.h

@@ -0,0 +1,23 @@
+/*
+ * IConnection.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
+
+struct CPack;
+
+class DLL_LINKAGE IGameConnection : boost::noncopyable
+{
+public:
+	virtual void sendPack(const CPack & pack) = 0;
+	virtual int getConnectionID() const = 0;
+};
+
+VCMI_LIB_NAMESPACE_END

+ 19 - 12
server/CGameHandler.cpp

@@ -75,7 +75,7 @@
 
 
 #include "../lib/serializer/CSaveFile.h"
 #include "../lib/serializer/CSaveFile.h"
 #include "../lib/serializer/CLoadFile.h"
 #include "../lib/serializer/CLoadFile.h"
-#include "../lib/serializer/Connection.h"
+#include "../lib/serializer/IGameConnection.h"
 
 
 #include "../lib/spells/CSpellHandler.h"
 #include "../lib/spells/CSpellHandler.h"
 
 
@@ -437,7 +437,7 @@ void CGameHandler::changeSecSkill(const CGHeroInstance * hero, SecondarySkill wh
 
 
 }
 }
 
 
-void CGameHandler::handleClientDisconnection(const std::shared_ptr<CConnection> & c)
+void CGameHandler::handleClientDisconnection(const std::shared_ptr<IGameConnection> & c)
 {
 {
 	if(gameServer().getState() == EServerState::SHUTDOWN || !gameState().getStartInfo())
 	if(gameServer().getState() == EServerState::SHUTDOWN || !gameState().getStartInfo())
 	{
 	{
@@ -474,7 +474,7 @@ void CGameHandler::handleClientDisconnection(const std::shared_ptr<CConnection>
 	}
 	}
 }
 }
 
 
-void CGameHandler::handleReceivedPack(std::shared_ptr<CConnection> connection, CPackForServer & pack)
+void CGameHandler::handleReceivedPack(std::shared_ptr<IGameConnection> connection, CPackForServer & pack)
 {
 {
 	//prepare struct informing that action was applied
 	//prepare struct informing that action was applied
 	auto sendPackageResponse = [&](bool successfullyApplied)
 	auto sendPackageResponse = [&](bool successfullyApplied)
@@ -524,6 +524,13 @@ void CGameHandler::handleReceivedPack(std::shared_ptr<CConnection> connection, C
 	}
 	}
 }
 }
 
 
+CGameHandler::CGameHandler(IGameServer & server, const std::shared_ptr<CGameState> & initialGamestate)
+	:CGameHandler(server)
+{
+	gs = initialGamestate;
+	randomizer = std::make_unique<GameRandomizer>(*gs);
+}
+
 CGameHandler::CGameHandler(IGameServer & server)
 CGameHandler::CGameHandler(IGameServer & server)
 	: server(server)
 	: server(server)
 	, heroPool(std::make_unique<HeroPoolProcessor>(this))
 	, heroPool(std::make_unique<HeroPoolProcessor>(this))
@@ -1529,12 +1536,12 @@ void CGameHandler::sendAndApply(NewStructures & pack)
 	checkVictoryLossConditionsForPlayer(gameInfo().getTown(pack.tid)->tempOwner);
 	checkVictoryLossConditionsForPlayer(gameInfo().getTown(pack.tid)->tempOwner);
 }
 }
 
 
-bool CGameHandler::isPlayerOwns(const std::shared_ptr<CConnection> & connection, const CPackForServer * pack, ObjectInstanceID id)
+bool CGameHandler::isPlayerOwns(const std::shared_ptr<IGameConnection> & connection, const CPackForServer * pack, ObjectInstanceID id)
 {
 {
 	return pack->player == gameState().getOwner(id) && hasPlayerAt(gameState().getOwner(id), connection);
 	return pack->player == gameState().getOwner(id) && hasPlayerAt(gameState().getOwner(id), connection);
 }
 }
 
 
-void CGameHandler::throwNotAllowedAction(const std::shared_ptr<CConnection> & connection)
+void CGameHandler::throwNotAllowedAction(const std::shared_ptr<IGameConnection> & connection)
 {
 {
 	playerMessages->sendSystemMessage(connection, MetaString::createFromTextID("vcmi.server.errors.notAllowed"));
 	playerMessages->sendSystemMessage(connection, MetaString::createFromTextID("vcmi.server.errors.notAllowed"));
 
 
@@ -1542,7 +1549,7 @@ void CGameHandler::throwNotAllowedAction(const std::shared_ptr<CConnection> & co
 	throw ExceptionNotAllowedAction();
 	throw ExceptionNotAllowedAction();
 }
 }
 
 
-void CGameHandler::wrongPlayerMessage(const std::shared_ptr<CConnection> & connection, const CPackForServer * pack, PlayerColor expectedplayer)
+void CGameHandler::wrongPlayerMessage(const std::shared_ptr<IGameConnection> & connection, const CPackForServer * pack, PlayerColor expectedplayer)
 {
 {
 	auto str = MetaString::createFromTextID("vcmi.server.errors.wrongIdentified");
 	auto str = MetaString::createFromTextID("vcmi.server.errors.wrongIdentified");
 	str.replaceName(pack->player);
 	str.replaceName(pack->player);
@@ -1552,7 +1559,7 @@ void CGameHandler::wrongPlayerMessage(const std::shared_ptr<CConnection> & conne
 	playerMessages->sendSystemMessage(connection, str);
 	playerMessages->sendSystemMessage(connection, str);
 }
 }
 
 
-void CGameHandler::throwIfWrongOwner(const std::shared_ptr<CConnection> & connection, const CPackForServer * pack, ObjectInstanceID id)
+void CGameHandler::throwIfWrongOwner(const std::shared_ptr<IGameConnection> & connection, const CPackForServer * pack, ObjectInstanceID id)
 {
 {
 	if(!isPlayerOwns(connection, pack, id))
 	if(!isPlayerOwns(connection, pack, id))
 	{
 	{
@@ -1561,18 +1568,18 @@ void CGameHandler::throwIfWrongOwner(const std::shared_ptr<CConnection> & connec
 	}
 	}
 }
 }
 
 
-void CGameHandler::throwIfPlayerNotActive(const std::shared_ptr<CConnection> & connection, const CPackForServer * pack)
+void CGameHandler::throwIfPlayerNotActive(const std::shared_ptr<IGameConnection> & connection, const CPackForServer * pack)
 {
 {
 	if (!turnOrder->isPlayerMakingTurn(pack->player))
 	if (!turnOrder->isPlayerMakingTurn(pack->player))
 		throwNotAllowedAction(connection);
 		throwNotAllowedAction(connection);
 }
 }
 
 
-void CGameHandler::throwIfWrongPlayer(const std::shared_ptr<CConnection> & connection, const CPackForServer * pack)
+void CGameHandler::throwIfWrongPlayer(const std::shared_ptr<IGameConnection> & connection, const CPackForServer * pack)
 {
 {
 	throwIfWrongPlayer(connection, pack, pack->player);
 	throwIfWrongPlayer(connection, pack, pack->player);
 }
 }
 
 
-void CGameHandler::throwIfWrongPlayer(const std::shared_ptr<CConnection> & connection, const CPackForServer * pack, PlayerColor player)
+void CGameHandler::throwIfWrongPlayer(const std::shared_ptr<IGameConnection> & connection, const CPackForServer * pack, PlayerColor player)
 {
 {
 	if(!hasPlayerAt(player, connection) || pack->player != player)
 	if(!hasPlayerAt(player, connection) || pack->player != player)
 	{
 	{
@@ -1581,7 +1588,7 @@ void CGameHandler::throwIfWrongPlayer(const std::shared_ptr<CConnection> & conne
 	}
 	}
 }
 }
 
 
-void CGameHandler::throwAndComplain(const std::shared_ptr<CConnection> & connection, const std::string & txt)
+void CGameHandler::throwAndComplain(const std::shared_ptr<IGameConnection> & connection, const std::string & txt)
 {
 {
 	complain(txt);
 	complain(txt);
 	throwNotAllowedAction(connection);
 	throwNotAllowedAction(connection);
@@ -2038,7 +2045,7 @@ bool CGameHandler::arrangeStacks(ObjectInstanceID id1, ObjectInstanceID id2, ui8
 	return true;
 	return true;
 }
 }
 
 
-bool CGameHandler::hasPlayerAt(PlayerColor player,  const std::shared_ptr<CConnection> & c) const
+bool CGameHandler::hasPlayerAt(PlayerColor player,  const std::shared_ptr<IGameConnection> & c) const
 {
 {
 	return gameServer().hasPlayerAt(player, c);
 	return gameServer().hasPlayerAt(player, c);
 }
 }

+ 13 - 12
server/CGameHandler.h

@@ -22,7 +22,7 @@ VCMI_LIB_NAMESPACE_BEGIN
 struct SideInBattle;
 struct SideInBattle;
 class IMarket;
 class IMarket;
 class SpellCastEnvironment;
 class SpellCastEnvironment;
-class CConnection;
+class IGameConnection;
 class CCommanderInstance;
 class CCommanderInstance;
 class EVictoryLossCheckResult;
 class EVictoryLossCheckResult;
 class CRandomGenerator;
 class CRandomGenerator;
@@ -110,6 +110,7 @@ public:
 	void newObject(std::shared_ptr<CGObjectInstance> object, PlayerColor initiator);
 	void newObject(std::shared_ptr<CGObjectInstance> object, PlayerColor initiator);
 
 
 	explicit CGameHandler(IGameServer & server);
 	explicit CGameHandler(IGameServer & server);
+	CGameHandler(IGameServer & server, const std::shared_ptr<CGameState> & gamestate);
 	~CGameHandler();
 	~CGameHandler();
 
 
 	//////////////////////////////////////////////////////////////////////////
 	//////////////////////////////////////////////////////////////////////////
@@ -203,9 +204,9 @@ public:
 	//////////////////////////////////////////////////////////////////////////
 	//////////////////////////////////////////////////////////////////////////
 
 
 	void init(StartInfo *si, Load::ProgressAccumulator & progressTracking);
 	void init(StartInfo *si, Load::ProgressAccumulator & progressTracking);
-	void handleClientDisconnection(const std::shared_ptr<CConnection> & c);
-	void handleReceivedPack(std::shared_ptr<CConnection> c, CPackForServer & pack);
-	bool hasPlayerAt(PlayerColor player, const std::shared_ptr<CConnection> & c) const;
+	void handleClientDisconnection(const std::shared_ptr<IGameConnection> & c);
+	void handleReceivedPack(std::shared_ptr<IGameConnection> c, CPackForServer & pack);
+	bool hasPlayerAt(PlayerColor player, const std::shared_ptr<IGameConnection> & c) const;
 	bool hasBothPlayersAtSameConnection(PlayerColor left, PlayerColor right) const;
 	bool hasBothPlayersAtSameConnection(PlayerColor left, PlayerColor right) const;
 
 
 	bool queryReply( QueryID qid, std::optional<int32_t> reply, PlayerColor player );
 	bool queryReply( QueryID qid, std::optional<int32_t> reply, PlayerColor player );
@@ -281,19 +282,19 @@ public:
 	void sendAndApply(SetResources & pack);
 	void sendAndApply(SetResources & pack);
 	void sendAndApply(NewStructures & pack);
 	void sendAndApply(NewStructures & pack);
 
 
-	void wrongPlayerMessage(const std::shared_ptr<CConnection> & connection, const CPackForServer * pack, PlayerColor expectedplayer);
+	void wrongPlayerMessage(const std::shared_ptr<IGameConnection> & connection, const CPackForServer * pack, PlayerColor expectedplayer);
 	/// Unconditionally throws with "Action not allowed" message
 	/// Unconditionally throws with "Action not allowed" message
-	[[noreturn]] void throwNotAllowedAction(const std::shared_ptr<CConnection> & connection);
+	[[noreturn]] void throwNotAllowedAction(const std::shared_ptr<IGameConnection> & connection);
 	/// Throws if player stated in pack is not making turn right now
 	/// Throws if player stated in pack is not making turn right now
-	void throwIfPlayerNotActive(const std::shared_ptr<CConnection> & connection, const CPackForServer * pack);
+	void throwIfPlayerNotActive(const std::shared_ptr<IGameConnection> & connection, const CPackForServer * pack);
 	/// Throws if object is not owned by pack sender
 	/// Throws if object is not owned by pack sender
-	void throwIfWrongOwner(const std::shared_ptr<CConnection> & connection, const CPackForServer * pack, ObjectInstanceID id);
+	void throwIfWrongOwner(const std::shared_ptr<IGameConnection> & connection, const CPackForServer * pack, ObjectInstanceID id);
 	/// Throws if player is not present on connection of this pack
 	/// Throws if player is not present on connection of this pack
-	void throwIfWrongPlayer(const std::shared_ptr<CConnection> & connection, const CPackForServer * pack, PlayerColor player);
-	void throwIfWrongPlayer(const std::shared_ptr<CConnection> & connection, const CPackForServer * pack);
-	[[noreturn]] void throwAndComplain(const std::shared_ptr<CConnection> & connection, const std::string & txt);
+	void throwIfWrongPlayer(const std::shared_ptr<IGameConnection> & connection, const CPackForServer * pack, PlayerColor player);
+	void throwIfWrongPlayer(const std::shared_ptr<IGameConnection> & connection, const CPackForServer * pack);
+	[[noreturn]] void throwAndComplain(const std::shared_ptr<IGameConnection> & connection, const std::string & txt);
 
 
-	bool isPlayerOwns(const std::shared_ptr<CConnection> & connection, const CPackForServer * pack, ObjectInstanceID id);
+	bool isPlayerOwns(const std::shared_ptr<IGameConnection> & connection, const CPackForServer * pack, ObjectInstanceID id);
 
 
 	void start(bool resume);
 	void start(bool resume);
 	void tick(int millisecondsPassed);
 	void tick(int millisecondsPassed);

+ 12 - 12
server/CVCMIServer.cpp

@@ -26,7 +26,7 @@
 #include "../lib/modding/ModIncompatibility.h"
 #include "../lib/modding/ModIncompatibility.h"
 #include "../lib/rmg/CMapGenOptions.h"
 #include "../lib/rmg/CMapGenOptions.h"
 #include "../lib/serializer/CMemorySerializer.h"
 #include "../lib/serializer/CMemorySerializer.h"
-#include "../lib/serializer/Connection.h"
+#include "../lib/serializer/GameConnection.h"
 #include "../lib/texts/CGeneralTextHandler.h"
 #include "../lib/texts/CGeneralTextHandler.h"
 
 
 // UUID generation
 // UUID generation
@@ -40,10 +40,10 @@ class CVCMIServerPackVisitor : public VCMI_LIB_WRAP_NAMESPACE(ICPackVisitor)
 private:
 private:
 	CVCMIServer & handler;
 	CVCMIServer & handler;
 	std::shared_ptr<CGameHandler> gh;
 	std::shared_ptr<CGameHandler> gh;
-	std::shared_ptr<CConnection> connection;
+	std::shared_ptr<GameConnection> connection;
 
 
 public:
 public:
-	CVCMIServerPackVisitor(CVCMIServer & handler, const std::shared_ptr<CGameHandler> & gh, const std::shared_ptr<CConnection> & connection)
+	CVCMIServerPackVisitor(CVCMIServer & handler, const std::shared_ptr<CGameHandler> & gh, const std::shared_ptr<GameConnection> & connection)
 		: handler(handler)
 		: handler(handler)
 		, gh(gh)
 		, gh(gh)
 		, connection(connection)
 		, connection(connection)
@@ -117,7 +117,7 @@ void CVCMIServer::onNewConnection(const std::shared_ptr<INetworkConnection> & co
 {
 {
 	if(getState() == EServerState::LOBBY)
 	if(getState() == EServerState::LOBBY)
 	{
 	{
-		activeConnections.push_back(std::make_shared<CConnection>(connection));
+		activeConnections.push_back(std::make_shared<GameConnection>(connection));
 		activeConnections.back()->enterLobbyConnectionMode();
 		activeConnections.back()->enterLobbyConnectionMode();
 	}
 	}
 	else
 	else
@@ -129,7 +129,7 @@ void CVCMIServer::onNewConnection(const std::shared_ptr<INetworkConnection> & co
 
 
 void CVCMIServer::onPacketReceived(const std::shared_ptr<INetworkConnection> & connection, const std::vector<std::byte> & message)
 void CVCMIServer::onPacketReceived(const std::shared_ptr<INetworkConnection> & connection, const std::vector<std::byte> & message)
 {
 {
-	std::shared_ptr<CConnection> c = findConnection(connection);
+	std::shared_ptr<GameConnection> c = findConnection(connection);
 	if (c == nullptr)
 	if (c == nullptr)
 		throw std::out_of_range("Unknown connection received in CVCMIServer::findConnection");
 		throw std::out_of_range("Unknown connection received in CVCMIServer::findConnection");
 
 
@@ -156,7 +156,7 @@ EServerState CVCMIServer::getState() const
 	return state;
 	return state;
 }
 }
 
 
-std::shared_ptr<CConnection> CVCMIServer::findConnection(const std::shared_ptr<INetworkConnection> & netConnection)
+std::shared_ptr<GameConnection> CVCMIServer::findConnection(const std::shared_ptr<INetworkConnection> & netConnection)
 {
 {
 	for(const auto & gameConnection : activeConnections)
 	for(const auto & gameConnection : activeConnections)
 	{
 	{
@@ -319,7 +319,7 @@ void CVCMIServer::onDisconnected(const std::shared_ptr<INetworkConnection> & con
 {
 {
 	logNetwork->error("Network error receiving a pack. Connection has been closed");
 	logNetwork->error("Network error receiving a pack. Connection has been closed");
 
 
-	std::shared_ptr<CConnection> c = findConnection(connection);
+	std::shared_ptr<GameConnection> c = findConnection(connection);
 
 
 	// player may have already disconnected via clientDisconnected call
 	// player may have already disconnected via clientDisconnected call
 	if (c)
 	if (c)
@@ -330,7 +330,7 @@ void CVCMIServer::onDisconnected(const std::shared_ptr<INetworkConnection> & con
 	}
 	}
 }
 }
 
 
-void CVCMIServer::handleReceivedPack(std::shared_ptr<CConnection> connection, CPackForLobby & pack)
+void CVCMIServer::handleReceivedPack(std::shared_ptr<GameConnection> connection, CPackForLobby & pack)
 {
 {
 	ClientPermissionsCheckerNetPackVisitor checker(*this, connection);
 	ClientPermissionsCheckerNetPackVisitor checker(*this, connection);
 	pack.visit(checker);
 	pack.visit(checker);
@@ -406,7 +406,7 @@ bool CVCMIServer::passHost(int toConnectionId)
 	return false;
 	return false;
 }
 }
 
 
-void CVCMIServer::clientConnected(std::shared_ptr<CConnection> c, std::vector<std::string> & names, const std::string & uuid, EStartMode mode)
+void CVCMIServer::clientConnected(std::shared_ptr<GameConnection> c, std::vector<std::string> & names, const std::string & uuid, EStartMode mode)
 {
 {
 	assert(getState() == EServerState::LOBBY);
 	assert(getState() == EServerState::LOBBY);
 
 
@@ -444,7 +444,7 @@ void CVCMIServer::clientConnected(std::shared_ptr<CConnection> c, std::vector<st
 	}
 	}
 }
 }
 
 
-void CVCMIServer::clientDisconnected(std::shared_ptr<CConnection> connection)
+void CVCMIServer::clientDisconnected(std::shared_ptr<GameConnection> connection)
 {
 {
 	assert(vstd::contains(activeConnections, connection));
 	assert(vstd::contains(activeConnections, connection));
 	logGlobal->trace("Received disconnection request");
 	logGlobal->trace("Received disconnection request");
@@ -1142,9 +1142,9 @@ bool CVCMIServer::isPlayerHost(const PlayerColor & color) const
 	return LobbyInfo::isPlayerHost(color);
 	return LobbyInfo::isPlayerHost(color);
 }
 }
 
 
-bool CVCMIServer::hasPlayerAt(PlayerColor player, const std::shared_ptr<CConnection> & c) const
+bool CVCMIServer::hasPlayerAt(PlayerColor player, const std::shared_ptr<IGameConnection> & c) const
 {
 {
-	return vstd::contains(getAllClientPlayers(c->connectionID), player);
+	return vstd::contains(getAllClientPlayers(c->getConnectionID()), player);
 }
 }
 
 
 bool CVCMIServer::hasBothPlayersAtSameConnection(PlayerColor left, PlayerColor right) const
 bool CVCMIServer::hasBothPlayersAtSameConnection(PlayerColor left, PlayerColor right) const

+ 8 - 8
server/CVCMIServer.h

@@ -20,7 +20,7 @@ class CMapInfo;
 
 
 struct CPackForLobby;
 struct CPackForLobby;
 
 
-class CConnection;
+class GameConnection;
 struct StartInfo;
 struct StartInfo;
 struct LobbyInfo;
 struct LobbyInfo;
 struct PlayerSettings;
 struct PlayerSettings;
@@ -47,7 +47,7 @@ class CVCMIServer : public LobbyInfo, public INetworkServerListener, public INet
 
 
 	EServerState state = EServerState::LOBBY;
 	EServerState state = EServerState::LOBBY;
 
 
-	std::shared_ptr<CConnection> findConnection(const std::shared_ptr<INetworkConnection> &);
+	std::shared_ptr<GameConnection> findConnection(const std::shared_ptr<INetworkConnection> &);
 
 
 	int currentClientId;
 	int currentClientId;
 	ui8 currentPlayerId;
 	ui8 currentPlayerId;
@@ -62,12 +62,12 @@ public:
 	void setState(EServerState value) override;
 	void setState(EServerState value) override;
 	EServerState getState() const override;
 	EServerState getState() const override;
 	bool isPlayerHost(const PlayerColor & color) const override;
 	bool isPlayerHost(const PlayerColor & color) const override;
-	bool hasPlayerAt(PlayerColor player, const std::shared_ptr<CConnection> & c) const override;
+	bool hasPlayerAt(PlayerColor player, const std::shared_ptr<IGameConnection> & c) const override;
 	bool hasBothPlayersAtSameConnection(PlayerColor left, PlayerColor right) const override;
 	bool hasBothPlayersAtSameConnection(PlayerColor left, PlayerColor right) const override;
 	void broadcastPack(const CPackForClient & pack) override;
 	void broadcastPack(const CPackForClient & pack) override;
 
 
 	/// List of all active connections
 	/// List of all active connections
-	std::vector<std::shared_ptr<CConnection>> activeConnections;
+	std::vector<std::shared_ptr<GameConnection>> activeConnections;
 
 
 	uint16_t prepare(bool connectToLobby, bool listenForConnections);
 	uint16_t prepare(bool connectToLobby, bool listenForConnections);
 
 
@@ -90,7 +90,7 @@ public:
 	void startGameImmediately();
 	void startGameImmediately();
 	uint16_t startAcceptingIncomingConnections(bool listenForConnections);
 	uint16_t startAcceptingIncomingConnections(bool listenForConnections);
 
 
-	void threadHandleClient(std::shared_ptr<CConnection> c);
+	void threadHandleClient(std::shared_ptr<GameConnection> c);
 
 
 	void announcePack(CPackForLobby & pack);
 	void announcePack(CPackForLobby & pack);
 	bool passHost(int toConnectionId);
 	bool passHost(int toConnectionId);
@@ -101,14 +101,14 @@ public:
 	void setPlayerConnectedId(PlayerSettings & pset, ui8 player) const;
 	void setPlayerConnectedId(PlayerSettings & pset, ui8 player) const;
 	void updateStartInfoOnMapChange(std::shared_ptr<CMapInfo> mapInfo, std::shared_ptr<CMapGenOptions> mapGenOpt = {});
 	void updateStartInfoOnMapChange(std::shared_ptr<CMapInfo> mapInfo, std::shared_ptr<CMapGenOptions> mapGenOpt = {});
 
 
-	void clientConnected(std::shared_ptr<CConnection> c, std::vector<std::string> & names, const std::string & uuid, EStartMode mode);
-	void clientDisconnected(std::shared_ptr<CConnection> c);
+	void clientConnected(std::shared_ptr<GameConnection> c, std::vector<std::string> & names, const std::string & uuid, EStartMode mode);
+	void clientDisconnected(std::shared_ptr<GameConnection> c);
 	void reconnectPlayer(int connId);
 	void reconnectPlayer(int connId);
 
 
 	void announceMessage(const MetaString & txt);
 	void announceMessage(const MetaString & txt);
 	void announceMessage(const std::string & txt);
 	void announceMessage(const std::string & txt);
 
 
-	void handleReceivedPack(std::shared_ptr<CConnection> connection, CPackForLobby & pack);
+	void handleReceivedPack(std::shared_ptr<GameConnection> connection, CPackForLobby & pack);
 
 
 	void updateAndPropagateLobbyState();
 	void updateAndPropagateLobbyState();
 
 

+ 2 - 2
server/IGameServer.h

@@ -11,7 +11,7 @@
 
 
 VCMI_LIB_NAMESPACE_BEGIN
 VCMI_LIB_NAMESPACE_BEGIN
 class PlayerColor;
 class PlayerColor;
-class CConnection;
+class IGameConnection;
 struct CPackForClient;
 struct CPackForClient;
 VCMI_LIB_NAMESPACE_END
 VCMI_LIB_NAMESPACE_END
 
 
@@ -31,7 +31,7 @@ public:
 	virtual void setState(EServerState value) = 0;
 	virtual void setState(EServerState value) = 0;
 	virtual EServerState getState() const = 0;
 	virtual EServerState getState() const = 0;
 	virtual bool isPlayerHost(const PlayerColor & color) const = 0;
 	virtual bool isPlayerHost(const PlayerColor & color) const = 0;
-	virtual bool hasPlayerAt(PlayerColor player, const std::shared_ptr<CConnection> & c) const = 0;
+	virtual bool hasPlayerAt(PlayerColor player, const std::shared_ptr<IGameConnection> & c) const = 0;
 	virtual bool hasBothPlayersAtSameConnection(PlayerColor left, PlayerColor right) const = 0;
 	virtual bool hasBothPlayersAtSameConnection(PlayerColor left, PlayerColor right) const = 0;
 	virtual void broadcastPack(const CPackForClient & pack) = 0;
 	virtual void broadcastPack(const CPackForClient & pack) = 0;
 };
 };

+ 8 - 4
server/LobbyNetPackVisitors.h

@@ -11,15 +11,19 @@
 
 
 #include "../lib/networkPacks/NetPackVisitor.h"
 #include "../lib/networkPacks/NetPackVisitor.h"
 
 
+VCMI_LIB_NAMESPACE_BEGIN
+class GameConnection;
+VCMI_LIB_NAMESPACE_END
+
 class ClientPermissionsCheckerNetPackVisitor : public VCMI_LIB_WRAP_NAMESPACE(ICPackVisitor)
 class ClientPermissionsCheckerNetPackVisitor : public VCMI_LIB_WRAP_NAMESPACE(ICPackVisitor)
 {
 {
 private:
 private:
-	std::shared_ptr<CConnection> connection;
+	std::shared_ptr<GameConnection> connection;
 	CVCMIServer & srv;
 	CVCMIServer & srv;
 	bool result;
 	bool result;
 
 
 public:
 public:
-	ClientPermissionsCheckerNetPackVisitor(CVCMIServer & srv, const std::shared_ptr<CConnection> & connection)
+	ClientPermissionsCheckerNetPackVisitor(CVCMIServer & srv, const std::shared_ptr<GameConnection> & connection)
 		: connection(connection)
 		: connection(connection)
 		, srv(srv)
 		, srv(srv)
 		, result(false)
 		, result(false)
@@ -67,12 +71,12 @@ public:
 class ApplyOnServerNetPackVisitor : public VCMI_LIB_WRAP_NAMESPACE(ICPackVisitor)
 class ApplyOnServerNetPackVisitor : public VCMI_LIB_WRAP_NAMESPACE(ICPackVisitor)
 {
 {
 private:
 private:
-	std::shared_ptr<CConnection> connection;
+	std::shared_ptr<GameConnection> connection;
 	CVCMIServer & srv;
 	CVCMIServer & srv;
 	bool result;
 	bool result;
 
 
 public:
 public:
-	ApplyOnServerNetPackVisitor(CVCMIServer & srv, const std::shared_ptr<CConnection> & connection)
+	ApplyOnServerNetPackVisitor(CVCMIServer & srv, const std::shared_ptr<GameConnection> & connection)
 		: connection(connection)
 		: connection(connection)
 		, srv(srv)
 		, srv(srv)
 		, result(true)
 		, result(true)

+ 1 - 1
server/NetPacksLobbyServer.cpp

@@ -22,7 +22,7 @@
 #include "../lib/filesystem/Filesystem.h"
 #include "../lib/filesystem/Filesystem.h"
 #include "../lib/gameState/CGameState.h"
 #include "../lib/gameState/CGameState.h"
 #include "../lib/mapping/CMapInfo.h"
 #include "../lib/mapping/CMapInfo.h"
-#include "../lib/serializer/Connection.h"
+#include "../lib/serializer/GameConnection.h"
 
 
 void ClientPermissionsCheckerNetPackVisitor::visitForLobby(CPackForLobby & pack)
 void ClientPermissionsCheckerNetPackVisitor::visitForLobby(CPackForLobby & pack)
 {
 {

+ 4 - 2
server/ServerNetPackVisitors.h

@@ -11,15 +11,17 @@
 
 
 #include "../lib/networkPacks/NetPackVisitor.h"
 #include "../lib/networkPacks/NetPackVisitor.h"
 
 
+class IGameConnection;
+
 class ApplyGhNetPackVisitor : public VCMI_LIB_WRAP_NAMESPACE(ICPackVisitor)
 class ApplyGhNetPackVisitor : public VCMI_LIB_WRAP_NAMESPACE(ICPackVisitor)
 {
 {
 private:
 private:
-	std::shared_ptr<CConnection> connection;
+	std::shared_ptr<IGameConnection> connection;
 	CGameHandler & gh;
 	CGameHandler & gh;
 	bool result;
 	bool result;
 
 
 public:
 public:
-	ApplyGhNetPackVisitor(CGameHandler & gh, const std::shared_ptr<CConnection> & connection)
+	ApplyGhNetPackVisitor(CGameHandler & gh, const std::shared_ptr<IGameConnection> & connection)
 		: connection(connection)
 		: connection(connection)
 		, gh(gh)
 		, gh(gh)
 		, result(false)
 		, result(false)

+ 3 - 3
server/processors/PlayerMessageProcessor.cpp

@@ -32,7 +32,7 @@
 #include "../../lib/mapping/CMap.h"
 #include "../../lib/mapping/CMap.h"
 #include "../../lib/networkPacks/PacksForClient.h"
 #include "../../lib/networkPacks/PacksForClient.h"
 #include "../../lib/networkPacks/StackLocation.h"
 #include "../../lib/networkPacks/StackLocation.h"
-#include "../../lib/serializer/Connection.h"
+#include "../../lib/serializer/IGameConnection.h"
 #include "../../lib/spells/CSpellHandler.h"
 #include "../../lib/spells/CSpellHandler.h"
 #include "../lib/VCMIDirs.h"
 #include "../lib/VCMIDirs.h"
 
 
@@ -964,14 +964,14 @@ void PlayerMessageProcessor::executeCheatCode(const std::string & cheatName, Pla
 		callbacks.at(cheatName)();
 		callbacks.at(cheatName)();
 }
 }
 
 
-void PlayerMessageProcessor::sendSystemMessage(std::shared_ptr<CConnection> connection, const MetaString & message)
+void PlayerMessageProcessor::sendSystemMessage(std::shared_ptr<IGameConnection> connection, const MetaString & message)
 {
 {
 	SystemMessage sm;
 	SystemMessage sm;
 	sm.text = message;
 	sm.text = message;
 	connection->sendPack(sm);
 	connection->sendPack(sm);
 }
 }
 
 
-void PlayerMessageProcessor::sendSystemMessage(std::shared_ptr<CConnection> connection, const std::string & message)
+void PlayerMessageProcessor::sendSystemMessage(std::shared_ptr<IGameConnection> connection, const std::string & message)
 {
 {
 	MetaString str;
 	MetaString str;
 	str.appendRawString(message);
 	str.appendRawString(message);

+ 3 - 3
server/processors/PlayerMessageProcessor.h

@@ -14,7 +14,7 @@
 VCMI_LIB_NAMESPACE_BEGIN
 VCMI_LIB_NAMESPACE_BEGIN
 class CGHeroInstance;
 class CGHeroInstance;
 class CGTownInstance;
 class CGTownInstance;
-class CConnection;
+class IGameConnection;
 class MetaString;
 class MetaString;
 VCMI_LIB_NAMESPACE_END
 VCMI_LIB_NAMESPACE_END
 
 
@@ -80,8 +80,8 @@ public:
 	void playerMessage(PlayerColor player, const std::string & message, ObjectInstanceID currObj);
 	void playerMessage(PlayerColor player, const std::string & message, ObjectInstanceID currObj);
 
 
 	/// Send message to specific client with "System" as sender
 	/// Send message to specific client with "System" as sender
-	void sendSystemMessage(std::shared_ptr<CConnection> connection, const MetaString & message);
-	void sendSystemMessage(std::shared_ptr<CConnection> connection, const std::string & message);
+	void sendSystemMessage(std::shared_ptr<IGameConnection> connection, const MetaString & message);
+	void sendSystemMessage(std::shared_ptr<IGameConnection> connection, const std::string & message);
 
 
 	/// Send message to all players with "System" as sender
 	/// Send message to all players with "System" as sender
 	void broadcastSystemMessage(MetaString message);
 	void broadcastSystemMessage(MetaString message);