2023-02-12 09:23:39 +02:00
|
|
|
/*
|
|
|
|
* LobbyNetPackVisitors.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
|
|
|
|
|
2023-10-23 12:59:15 +02:00
|
|
|
#include "../lib/networkPacks/NetPackVisitor.h"
|
2023-02-12 09:23:39 +02:00
|
|
|
|
|
|
|
class ClientPermissionsCheckerNetPackVisitor : public VCMI_LIB_WRAP_NAMESPACE(ICPackVisitor)
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
bool result;
|
|
|
|
CVCMIServer & srv;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ClientPermissionsCheckerNetPackVisitor(CVCMIServer & srv)
|
|
|
|
:srv(srv), result(false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getResult() const
|
|
|
|
{
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void visitForLobby(CPackForLobby & pack) override;
|
|
|
|
virtual void visitLobbyClientConnected(LobbyClientConnected & pack) override;
|
|
|
|
virtual void visitLobbyClientDisconnected(LobbyClientDisconnected & pack) override;
|
|
|
|
virtual void visitLobbyEndGame(LobbyEndGame & pack) override;
|
|
|
|
virtual void visitLobbyStartGame(LobbyStartGame & pack) override;
|
|
|
|
virtual void visitLobbyChangeHost(LobbyChangeHost & pack) override;
|
|
|
|
virtual void visitLobbyChangePlayerOption(LobbyChangePlayerOption & pack) override;
|
|
|
|
virtual void visitLobbyChatMessage(LobbyChatMessage & pack) override;
|
|
|
|
virtual void visitLobbyGuiAction(LobbyGuiAction & pack) override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ApplyOnServerAfterAnnounceNetPackVisitor : public VCMI_LIB_WRAP_NAMESPACE(ICPackVisitor)
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
CVCMIServer & srv;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ApplyOnServerAfterAnnounceNetPackVisitor(CVCMIServer & srv)
|
|
|
|
:srv(srv)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void visitForLobby(CPackForLobby & pack) override;
|
|
|
|
virtual void visitLobbyClientConnected(LobbyClientConnected & pack) override;
|
|
|
|
virtual void visitLobbyClientDisconnected(LobbyClientDisconnected & pack) override;
|
|
|
|
virtual void visitLobbyEndGame(LobbyEndGame & pack) override;
|
|
|
|
virtual void visitLobbyStartGame(LobbyStartGame & pack) override;
|
|
|
|
virtual void visitLobbyChangeHost(LobbyChangeHost & pack) override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ApplyOnServerNetPackVisitor : public VCMI_LIB_WRAP_NAMESPACE(ICPackVisitor)
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
bool result;
|
|
|
|
CVCMIServer & srv;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ApplyOnServerNetPackVisitor(CVCMIServer & srv)
|
|
|
|
:srv(srv), result(true)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getResult() const
|
|
|
|
{
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void visitLobbyClientConnected(LobbyClientConnected & pack) override;
|
|
|
|
virtual void visitLobbyClientDisconnected(LobbyClientDisconnected & pack) override;
|
|
|
|
virtual void visitLobbySetMap(LobbySetMap & pack) override;
|
|
|
|
virtual void visitLobbySetCampaign(LobbySetCampaign & pack) override;
|
|
|
|
virtual void visitLobbySetCampaignMap(LobbySetCampaignMap & pack) override;
|
|
|
|
virtual void visitLobbySetCampaignBonus(LobbySetCampaignBonus & pack) override;
|
|
|
|
virtual void visitLobbyEndGame(LobbyEndGame & pack) override;
|
|
|
|
virtual void visitLobbyStartGame(LobbyStartGame & pack) override;
|
|
|
|
virtual void visitLobbyChangeHost(LobbyChangeHost & pack) override;
|
|
|
|
virtual void visitLobbyChangePlayerOption(LobbyChangePlayerOption & pack) override;
|
|
|
|
virtual void visitLobbySetPlayer(LobbySetPlayer & pack) override;
|
2023-10-13 23:04:35 +02:00
|
|
|
virtual void visitLobbySetPlayerName(LobbySetPlayerName & pack) override;
|
2023-02-12 09:23:39 +02:00
|
|
|
virtual void visitLobbySetTurnTime(LobbySetTurnTime & pack) override;
|
2023-09-22 18:57:43 +02:00
|
|
|
virtual void visitLobbySetSimturns(LobbySetSimturns & pack) override;
|
2023-02-12 09:23:39 +02:00
|
|
|
virtual void visitLobbySetDifficulty(LobbySetDifficulty & pack) override;
|
|
|
|
virtual void visitLobbyForceSetPlayer(LobbyForceSetPlayer & pack) override;
|
2023-09-22 18:57:43 +02:00
|
|
|
};
|