mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 00:55:09 -07:00
[Server] Add abstract match game factory for future tournament modes (#7132)
Took 5 minutes Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
a571a9aa04
commit
1459b3869d
2 changed files with 30 additions and 0 deletions
|
|
@ -15,6 +15,7 @@ set(HEADERS
|
|||
game/server_game.h
|
||||
game/server_game_lifecycle_strategy.h
|
||||
game/server_match_result_strategy.h
|
||||
game/server_match_game_factory.h
|
||||
game/server_player.h
|
||||
game/server_spectator.h
|
||||
server.h
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef SERVER_MATCH_GAME_FACTORY_H
|
||||
#define SERVER_MATCH_GAME_FACTORY_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
class GameConfig;
|
||||
class Server_Game;
|
||||
class Server_AbstractUserInterface;
|
||||
|
||||
/**
|
||||
* @brief Abstract factory for creating match games, forward-looking for tournament modes.
|
||||
*
|
||||
* Implementations own the rules of how a match game is constructed, how player
|
||||
* interfaces are resolved, and how games are registered with a room.
|
||||
*/
|
||||
class Server_MatchGameFactory
|
||||
{
|
||||
public:
|
||||
virtual ~Server_MatchGameFactory() = default;
|
||||
|
||||
/** @brief Create a match game from @p config, storing the assigned game id in @p outGameId. */
|
||||
virtual Server_Game *createMatchGame(const GameConfig &config, int &outGameId) = 0;
|
||||
/** @brief Resolve the user interface for @p playerName. */
|
||||
virtual Server_AbstractUserInterface *getUserInterface(const QString &playerName) = 0;
|
||||
/** @brief Register @p game with the room that owns it. */
|
||||
virtual void addGameToRoom(Server_Game *game) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue