Fix board template being ignored when set on default ruleset
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 <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user