From 225a16e4a37293a3a3e3c9f6377e5442382b8719 Mon Sep 17 00:00:00 2001 From: dingo Date: Fri, 27 Mar 2026 23:15:45 -0400 Subject: [PATCH] Fix board template being ignored when set on default ruleset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The lobby ready handler only checked lobby.BoardTemplateIdOverride and never fell back to dbDefaults.BoardTemplateId, so templates configured on the admin default GameRuleSet were silently skipped and the auto-shape generator ran instead. Apply the same override → default fallback chain as all other rules: effectiveTemplateId = lobby.BoardTemplateIdOverride ?? dbDefaults?.BoardTemplateId Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- Server/src/SOR.Game/Handlers/GameLobbyReadyHandler.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Server/src/SOR.Game/Handlers/GameLobbyReadyHandler.cs b/Server/src/SOR.Game/Handlers/GameLobbyReadyHandler.cs index 9eb0c99..0879e71 100644 --- a/Server/src/SOR.Game/Handlers/GameLobbyReadyHandler.cs +++ b/Server/src/SOR.Game/Handlers/GameLobbyReadyHandler.cs @@ -232,11 +232,14 @@ internal sealed class GameLobbyReadyHandler : GameHandlerBase, IMessageHandler // If the lobby specifies a board template, load it and build a snapshot JSON string // that will be embedded in the rule snapshot so in-flight games are unaffected by later edits. + // Fallback chain: lobby override → admin custom-default ruleset → none. + var effectiveTemplateId = lobby.BoardTemplateIdOverride ?? dbDefaults?.BoardTemplateId; + string? boardTemplateJson = null; - if (lobby.BoardTemplateIdOverride.HasValue) + if (effectiveTemplateId.HasValue) { var tmpl = await _gameDb.BoardTemplates - .FindAsync(new object[] { lobby.BoardTemplateIdOverride.Value }, ct); + .FindAsync(new object[] { effectiveTemplateId.Value }, ct); if (tmpl is not null) { var tileOpts = new JsonSerializerOptions(JsonSerializerDefaults.Web);