mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-23 01:55:10 -07:00
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:
parent
be6a783c12
commit
1c62588c38
10 changed files with 219 additions and 44 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue