diff --git a/src/gui/web_request_window.cpp b/src/gui/web_request_window.cpp index 5d800f9a..ad40421e 100644 --- a/src/gui/web_request_window.cpp +++ b/src/gui/web_request_window.cpp @@ -13,7 +13,7 @@ // ----------------------------------------------------------------------------- : WebRequestWindow WebRequestWindow::WebRequestWindow(const String& url, bool sizer) - : wxDialog(wxTheApp->GetTopWindow(), wxID_ANY, _TITLE_("web request"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) + : wxDialog(NULL, wxID_ANY, _TITLE_("web request"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxDIALOG_NO_PARENT) { // init controls info = new wxStaticText(this, -1, _LABEL_("web request address")); diff --git a/src/script/functions/construction.cpp b/src/script/functions/construction.cpp index 5c985bfe..21589409 100644 --- a/src/script/functions/construction.cpp +++ b/src/script/functions/construction.cpp @@ -60,9 +60,18 @@ SCRIPT_FUNCTION(new_card) { ScriptValueP script_input = field->import_script.invoke(ctx, true); // if the script result is a collection, iterate on the key/value pairs // treat the keys as field names and the values as what to populate those fields with - if (script_input->type() == SCRIPT_COLLECTION) { + if (script_input->type() == SCRIPT_COLLECTION) { + // check for a stylesheet first, since other things depend on it ScriptValueP script_it = script_input->makeIterator(); ScriptValueP script_key; + while (ScriptValueP script_value = script_it->next(&script_key)) { + assert(script_key); + if (script_key == script_nil) continue; + String script_key_name = script_key->toString(); + if (set_stylesheet_container(*game, new_card, script_value, script_key_name, ignore_field_not_found)) break; + } + // iterate on the rest of the key/value pairs given by the script + script_it = script_input->makeIterator(); while (ScriptValueP script_value = script_it->next(&script_key)) { assert(script_key); if (script_key == script_nil) continue; @@ -94,10 +103,18 @@ SCRIPT_FUNCTION(new_card) { ScriptValueP ctx_card = ctx.getVariableOpt(SCRIPT_VAR_card); ctx.setVariable(SCRIPT_VAR_card, to_script(new_card)); ScriptValueP script_input = game->import_script.invoke(ctx, true); - if (script_input->type() == SCRIPT_COLLECTION) { - // iterate on the key/value pairs given by the script + if (script_input->type() == SCRIPT_COLLECTION) { + // check for a stylesheet first, since other things depend on it ScriptValueP script_it = script_input->makeIterator(); ScriptValueP script_key; + while (ScriptValueP script_value = script_it->next(&script_key)) { + assert(script_key); + if (script_key == script_nil) continue; + String script_key_name = script_key->toString(); + if (set_stylesheet_container(*game, new_card, script_value, script_key_name, ignore_field_not_found)) break; + } + // iterate on the rest of the key/value pairs given by the script + script_it = script_input->makeIterator(); while (ScriptValueP script_value = script_it->next(&script_key)) { assert(script_key); if (script_key == script_nil) continue;