[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:
BruebachL 2026-08-24 07:54:47 +02:00 committed by GitHub
parent a571a9aa04
commit 1459b3869d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 0 deletions

View file

@ -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

View file

@ -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