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;
|
|
|
|
}
|
|
|
|
|
2024-02-03 22:59:56 +02:00
|
|
|
void visitForLobby(CPackForLobby & pack) override;
|
|
|
|
void visitLobbyClientConnected(LobbyClientConnected & pack) override;
|
|
|
|
void visitLobbyClientDisconnected(LobbyClientDisconnected & pack) override;
|
|
|
|
void visitLobbyRestartGame(LobbyRestartGame & pack) override;
|
|
|
|
void visitLobbyPrepareStartGame(LobbyPrepareStartGame & pack) override;
|
|
|
|
void visitLobbyStartGame(LobbyStartGame & pack) override;
|
|
|
|
void visitLobbyChangeHost(LobbyChangeHost & pack) override;
|
|
|
|
void visitLobbyChangePlayerOption(LobbyChangePlayerOption & pack) override;
|
|
|
|
void visitLobbyChatMessage(LobbyChatMessage & pack) override;
|
|
|
|
void visitLobbyGuiAction(LobbyGuiAction & pack) override;
|
2024-05-01 15:58:22 +02:00
|
|
|
void visitLobbyPvPAction(LobbyPvPAction & pack) override;
|
2024-10-31 22:57:20 +02:00
|
|
|
void visitLobbyDelete(LobbyDelete & pack) override;
|
2023-02-12 09:23:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class ApplyOnServerAfterAnnounceNetPackVisitor : public VCMI_LIB_WRAP_NAMESPACE(ICPackVisitor)
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
CVCMIServer & srv;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ApplyOnServerAfterAnnounceNetPackVisitor(CVCMIServer & srv)
|
|
|
|
:srv(srv)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2024-02-03 22:59:56 +02:00
|
|
|
void visitForLobby(CPackForLobby & pack) override;
|
|
|
|
void visitLobbyClientConnected(LobbyClientConnected & pack) override;
|
|
|
|
void visitLobbyClientDisconnected(LobbyClientDisconnected & pack) override;
|
|
|
|
void visitLobbyRestartGame(LobbyRestartGame & pack) override;
|
|
|
|
void visitLobbyStartGame(LobbyStartGame & pack) override;
|
|
|
|
void visitLobbyChangeHost(LobbyChangeHost & pack) override;
|
2023-02-12 09:23:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2024-02-03 22:59:56 +02:00
|
|
|
void visitLobbyClientConnected(LobbyClientConnected & pack) override;
|
|
|
|
void visitLobbyClientDisconnected(LobbyClientDisconnected & pack) override;
|
|
|
|
void visitLobbySetMap(LobbySetMap & pack) override;
|
|
|
|
void visitLobbySetCampaign(LobbySetCampaign & pack) override;
|
|
|
|
void visitLobbySetCampaignMap(LobbySetCampaignMap & pack) override;
|
|
|
|
void visitLobbySetCampaignBonus(LobbySetCampaignBonus & pack) override;
|
|
|
|
void visitLobbyRestartGame(LobbyRestartGame & pack) override;
|
|
|
|
void visitLobbyStartGame(LobbyStartGame & pack) override;
|
|
|
|
void visitLobbyChangeHost(LobbyChangeHost & pack) override;
|
|
|
|
void visitLobbyChangePlayerOption(LobbyChangePlayerOption & pack) override;
|
|
|
|
void visitLobbySetPlayer(LobbySetPlayer & pack) override;
|
|
|
|
void visitLobbySetPlayerName(LobbySetPlayerName & pack) override;
|
2024-07-16 00:40:39 +02:00
|
|
|
void visitLobbySetPlayerHandicap(LobbySetPlayerHandicap & pack) override;
|
2024-02-03 22:59:56 +02:00
|
|
|
void visitLobbySetTurnTime(LobbySetTurnTime & pack) override;
|
|
|
|
void visitLobbySetExtraOptions(LobbySetExtraOptions & pack) override;
|
|
|
|
void visitLobbySetSimturns(LobbySetSimturns & pack) override;
|
|
|
|
void visitLobbySetDifficulty(LobbySetDifficulty & pack) override;
|
|
|
|
void visitLobbyForceSetPlayer(LobbyForceSetPlayer & pack) override;
|
2024-04-30 01:52:49 +02:00
|
|
|
void visitLobbyPvPAction(LobbyPvPAction & pack) override;
|
2024-10-31 22:57:20 +02:00
|
|
|
void visitLobbyDelete(LobbyDelete & pack) override;
|
2023-09-22 18:57:43 +02:00
|
|
|
};
|