fix: use canonical name for stylesheet settings (fixes #8)

This commit is contained in:
Brendan Hagan
2022-07-08 23:00:01 -04:00
parent 0fea17e519
commit 9dbb65b109
2 changed files with 6 additions and 3 deletions
+4 -2
View File
@@ -223,8 +223,10 @@ ColumnSettings& Settings::columnSettingsFor(const Game& game, const Field& field
}
return cs;
}
StyleSheetSettings& Settings::stylesheetSettingsFor(const StyleSheet& stylesheet) {
StyleSheetSettingsP& ss = stylesheet_settings[stylesheet.name()];
StyleSheetSettings& Settings::stylesheetSettingsFor(const StyleSheet& stylesheet) {
// Use the canonical form here since the stylesheet name will be used as a stored key.
// This does introduce the possibility of collision if two stylesheets return the same value canonically, but I think that's just a necessary risk.
StyleSheetSettingsP& ss = stylesheet_settings[canonical_name_form(stylesheet.name())];
if (!ss) ss = make_intrusive<StyleSheetSettings>();
ss->useDefault(default_stylesheet_settings); // update default settings
return *ss;