mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Full rework of pre-game interface and networking
New features for players: * Loading for multiplayer. Any save could be used for multiplayer. * Restart for multiplayer. All clients will restart together. * Loading from single save. * Hotseat mixed with network game. Multiple players per client. * Now connection to server could be cancelled. * Return to menu on disconnections instead of crashes. * Restoring of last selected map, save or campaign on next run. TLDR on important changes in engine code: * UI: work with server separated from UI * UI: all explitic blitting replaced with IntObject's * UI: all new code use smart pointers instead of DISPOSE * Gameplay always start through lobby controlled by server. * Threads receiving netpacks now shared for lobby and gameplay. * Campaigns: heroes for crossover now serialized as JsonNode.
This commit is contained in:
@@ -20,7 +20,6 @@ class CArmedInstance;
|
||||
class CArtifactSet;
|
||||
class CBonusSystemNode;
|
||||
struct ArtSlotInfo;
|
||||
class BattleInfo;
|
||||
|
||||
#include "ConstTransitivePtr.h"
|
||||
#include "GameConstants.h"
|
||||
@@ -28,7 +27,9 @@ class BattleInfo;
|
||||
|
||||
struct DLL_LINKAGE CPack
|
||||
{
|
||||
CPack() {};
|
||||
std::shared_ptr<CConnection> c; // Pointer to connection that pack received from
|
||||
|
||||
CPack() : c(nullptr) {};
|
||||
virtual ~CPack() {};
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
@@ -54,12 +55,11 @@ struct CPackForClient : public CPack
|
||||
|
||||
struct CPackForServer : public CPack
|
||||
{
|
||||
PlayerColor player;
|
||||
CConnection *c;
|
||||
mutable PlayerColor player;
|
||||
mutable si32 requestID;
|
||||
CGameState* GS(CGameHandler *gh);
|
||||
CPackForServer():
|
||||
player(PlayerColor::NEUTRAL),
|
||||
c(nullptr)
|
||||
player(PlayerColor::NEUTRAL)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -69,6 +69,12 @@ struct CPackForServer : public CPack
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & player;
|
||||
h & requestID;
|
||||
}
|
||||
|
||||
protected:
|
||||
void throwNotAllowedAction();
|
||||
void throwOnWrongOwner(CGameHandler * gh, ObjectInstanceID id);
|
||||
|
||||
Reference in New Issue
Block a user