1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00
vcmi/server/processors/PlayerMessageProcessor.h
Ivan Savenko 0c07384293 Refactoring of serialization versioning handling
- Removed 'version' field from serialize() method
- Handler classes - Binary(De)Serializer now have 'version' field
- Serialization versioning now uses named enum

Save compatibility with 1.4.X saves should be intact
2024-01-20 20:34:51 +02:00

67 lines
2.6 KiB
C++

/*
* CGameHandler.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 "../../lib/GameConstants.h"
VCMI_LIB_NAMESPACE_BEGIN
class CGHeroInstance;
class CGTownInstance;
class CConnection;
VCMI_LIB_NAMESPACE_END
class CGameHandler;
class PlayerMessageProcessor
{
void executeCheatCode(const std::string & cheatName, PlayerColor player, ObjectInstanceID currObj, const std::vector<std::string> & arguments );
bool handleCheatCode(const std::string & cheatFullCommand, PlayerColor player, ObjectInstanceID currObj);
bool handleHostCommand(PlayerColor player, const std::string & message);
void cheatGiveSpells(PlayerColor player, const CGHeroInstance * hero);
void cheatBuildTown(PlayerColor player, const CGTownInstance * town);
void cheatGiveArmy(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
void cheatGiveMachines(PlayerColor player, const CGHeroInstance * hero);
void cheatGiveArtifacts(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
void cheatLevelup(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
void cheatExperience(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
void cheatMovement(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
void cheatResources(PlayerColor player, std::vector<std::string> words);
void cheatVictory(PlayerColor player);
void cheatDefeat(PlayerColor player);
void cheatMapReveal(PlayerColor player, bool reveal);
void cheatPuzzleReveal(PlayerColor player);
void cheatMaxLuck(PlayerColor player, const CGHeroInstance * hero);
void cheatMaxMorale(PlayerColor player, const CGHeroInstance * hero);
void cheatFly(PlayerColor player, const CGHeroInstance * hero);
public:
CGameHandler * gameHandler;
PlayerMessageProcessor();
PlayerMessageProcessor(CGameHandler * gameHandler);
/// incoming NetPack handling
void playerMessage(PlayerColor player, const std::string & message, ObjectInstanceID currObj);
/// Send message to specific client with "System" as sender
void sendSystemMessage(std::shared_ptr<CConnection> connection, const std::string & message);
/// Send message to all players with "System" as sender
void broadcastSystemMessage(const std::string & message);
/// Send message from specific player to all other players
void broadcastMessage(PlayerColor playerSender, const std::string & message);
template <typename Handler> void serialize(Handler &h)
{
}
};