feat(rules): add game-specific metadata attachment and unify match metadata initialization
Added AttachGameMetadata to GameRules interface Implemented metadata setup for Battleship (phase + readiness flags) Implemented no-op metadata hook for TicTacToe Moved generic phase/ready metadata out of MatchInit Added game/mode metadata to match state Fixed json:"metadata" tag in MatchState
This commit is contained in:
@@ -31,6 +31,13 @@ func (t *TicTacToeRules) AssignPlayerSymbols(players []*structs.Player) {
|
||||
players[1].Metadata["symbol"] = "O"
|
||||
}
|
||||
|
||||
// ------------------------------
|
||||
// Attach Game Metadata
|
||||
// ------------------------------
|
||||
func (b *TicTacToeRules) AttachGameMetadata(state *structs.MatchState) {
|
||||
// nothing needed for tictactoe
|
||||
}
|
||||
|
||||
// ValidateMove checks bounds and empty cell.
|
||||
func (t *TicTacToeRules) ValidateMove(state *structs.MatchState, playerIdx int, payload MovePayload) bool {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user