mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
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:
@@ -985,6 +985,7 @@ error:
|
|||||||
images used for blending must have the same size: Images used for blending must have the same size
|
images used for blending must have the same size: Images used for blending must have the same size
|
||||||
|
|
||||||
# error from files
|
# error from files
|
||||||
|
no card fields: Game '%s' does not have any card fields. Define at least one card field.
|
||||||
no game specified: No game specified for the %s
|
no game specified: No game specified for the %s
|
||||||
no stylesheet specified for the set: No stylesheet specified for the set
|
no stylesheet specified for the set: No stylesheet specified for the set
|
||||||
stylesheet and set refer to different game:
|
stylesheet and set refer to different game:
|
||||||
|
|||||||
@@ -39,7 +39,10 @@ IMPLEMENT_REFLECTION(ChoiceField) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ChoiceField::after_reading(Version ver) {
|
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();
|
choices->initIds();
|
||||||
}
|
}
|
||||||
// ----------------------------------------------------------------------------- : ChoiceField::Choice
|
// ----------------------------------------------------------------------------- : ChoiceField::Choice
|
||||||
|
|||||||
+5
-1
@@ -66,7 +66,11 @@ IMPLEMENT_REFLECTION(Game) {
|
|||||||
REFLECT_NO_SCRIPT(auto_replaces);
|
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);
|
Packaged::validate(v);
|
||||||
// automatic statistics dimensions
|
// automatic statistics dimensions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ void NewSetWindow::onGameSelect(wxCommandEvent&) {
|
|||||||
GameP game = game_list->getSelection<Game>(false);
|
GameP game = game_list->getSelection<Game>(false);
|
||||||
//handle_pending_errors(); // errors are ignored until set window is shown
|
//handle_pending_errors(); // errors are ignored until set window is shown
|
||||||
settings.default_game = game->name();
|
settings.default_game = game->name();
|
||||||
stylesheet_list->showData<StyleSheet>(game->name() + _("-*"));
|
stylesheet_list->showData<StyleSheet>(game->name() + _("*"));
|
||||||
stylesheet_list->select(settings.gameSettingsFor(*game).default_stylesheet);
|
stylesheet_list->select(settings.gameSettingsFor(*game).default_stylesheet);
|
||||||
UpdateWindowUI(wxUPDATE_UI_RECURSE);
|
UpdateWindowUI(wxUPDATE_UI_RECURSE);
|
||||||
// resize (yuck)
|
// resize (yuck)
|
||||||
|
|||||||
@@ -208,10 +208,10 @@ void Reader::readLine(bool in_string) {
|
|||||||
size_t pos = line.find_first_of(_(':'), indent);
|
size_t pos = line.find_first_of(_(':'), indent);
|
||||||
key = line.substr(indent, pos - indent);
|
key = line.substr(indent, pos - indent);
|
||||||
if (!ignore_invalid && !in_string && starts_with(key, _(" "))) {
|
if (!ignore_invalid && !in_string && starts_with(key, _(" "))) {
|
||||||
warning(_("key: '") + key + _("' starts with a space; only use TABs for indentation!"), 0, false);
|
warning(String(_("key: '")) << key << _("' on line number ") << line_number << _(" starts with a space; only use TABs for indentation!"), 0, false);
|
||||||
// try to fix up: 8 spaces is a tab
|
// try to fix up: 4 spaces is a tab
|
||||||
while (starts_with(key, _(" "))) {
|
while (starts_with(key, _(" "))) {
|
||||||
key = key.substr(8);
|
key = key.substr(4);
|
||||||
indent += 1;
|
indent += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user