sundry tweaks

- prevent infinite loop and warn when a game has no card fields
- choice fields are no longer ignored if they have no choices defined
- templates can now have the same name as their game folder (no hyphen needed)
- indent made by 4 spaces is now considered a tab (but will still produce a warning let's no kid ourselves)
This commit is contained in:
GenevensiS
2025-11-28 19:12:33 +01:00
parent 46ffe62f15
commit 614f69ab47
5 changed files with 15 additions and 7 deletions
+4 -1
View File
@@ -39,7 +39,10 @@ IMPLEMENT_REFLECTION(ChoiceField) {
}
void ChoiceField::after_reading(Version ver) {
Field::after_reading(ver);
Field::after_reading(ver);
if (choices->choices.size() < 1) {
choices->choices.push_back(make_intrusive<Choice>(name));
}
choices->initIds();
}
// ----------------------------------------------------------------------------- : ChoiceField::Choice
+5 -1
View File
@@ -66,7 +66,11 @@ IMPLEMENT_REFLECTION(Game) {
REFLECT_NO_SCRIPT(auto_replaces);
}
void Game::validate(Version v) {
void Game::validate(Version v) {
// check that we have at least one card field
if (card_fields.size() < 1) {
throw Error(_ERROR_1_("no card fields", name()));
}
Packaged::validate(v);
// automatic statistics dimensions
{