PR 0: introduce GameConfig, strategy pattern, and refactor Server_Game constructor

- Add GameConfig struct consolidating 14 construction parameters
- Add strategy interfaces for deck validation, game lifecycle, and match results
- Add Server_MatchGameFactory abstract factory (forward-looking for tournaments)
- Replace 15-arg Server_Game constructor with (GameConfig, Server_Room*)
- Wire default strategies into Server_Game with lifecycle/match hooks
- Update server_protocolhandler to build GameConfig from protobuf
- Update reverse_card_move_test to use new constructor
- Update CMakeLists.txt with new headers

Took 7 minutes

Took 2 minutes
This commit is contained in:
Lukas Brübach 2026-07-29 09:16:03 +02:00
parent be6a783c12
commit 1c62588c38
10 changed files with 219 additions and 44 deletions

View file

@ -1,3 +1,4 @@
#include "game/game_config.h"
#include "game/server_abstract_player.h"
#include "game/server_card.h"
#include "game/server_cardzone.h"
@ -22,7 +23,12 @@ TEST(ReverseCardMoveTest, MoveCardFromBottomTest)
// instantiate a fake server instance
FakeServer server;
Server_Room room(0, 0, "", "", "", "", false, "", {}, &server);
Server_Game game(user, 1, "", "", 2, QList<int>(), false, false, false, false, false, false, 20, false, &room);
GameConfig config;
config.creatorInfo = user;
config.gameId = 1;
config.maxPlayers = 2;
config.startingLifeTotal = 20;
Server_Game game(config, &room);
Server_AbstractPlayer player(&game, 1, user, false, nullptr);
Server_CardZone deckZone(&player, ZoneNames::DECK, true, ServerInfo_Zone::PublicZone);
Server_CardZone exileZone(&player, ZoneNames::EXILE, true, ServerInfo_Zone::PublicZone);