Tweaked the way to use getScript() like functions;

Made condition and default_expand parameters of expand_keywords optional.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1080 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-08-07 01:54:13 +00:00
parent 36065707ab
commit c6fe6634dd
12 changed files with 31 additions and 29 deletions
+3 -3
View File
@@ -53,7 +53,7 @@ void AddKeywordAction::perform(bool to_undo) {
// ----------------------------------------------------------------------------- : Changing keywords
KeywordReminderTextValue::KeywordReminderTextValue(Set& set, const TextFieldP& field, Keyword* keyword, bool editable)
: KeywordTextValue(field, keyword, &keyword->reminder.getUnparsed(), editable)
: KeywordTextValue(field, keyword, &keyword->reminder.getMutableUnparsed(), editable)
, set(set)
, keyword(*keyword)
{}
@@ -72,8 +72,8 @@ void KeywordReminderTextValue::store() {
// parsed okay
if (checkScript(new_script)) {
// also runs okay, assign
keyword.reminder.getScriptP() = new_script;
keyword.reminder.getUnparsed() = new_value;
keyword.reminder.setScriptP(new_script);
keyword.reminder.setUnparsed(new_value);
}
} else {
// parse errors, report
+2 -2
View File
@@ -200,9 +200,9 @@ void ChoiceStyle::initImage() {
// OR_ELSE
ScriptCustomCollectionP lookup(new ScriptCustomCollection());
FOR_EACH(ci, choice_images) {
lookup->key_value[ci.first] = ci.second.getScriptP();
lookup->key_value[ci.first] = ci.second.getValidScriptP();
}
Script& script = image.getScript();
Script& script = image.getMutableScript();
script.addInstruction(I_PUSH_CONST, lookup);
script.addInstruction(I_GET_VAR, SCRIPT_VAR_input);
script.addInstruction(I_BINARY, I_MEMBER);
+1 -1
View File
@@ -94,7 +94,7 @@ void Game::initCardListColorScript() {
if (cf && !cf->choice_colors_cardlist.empty()) {
// found the field to use
// initialize script: field.colors[card.field-name] or else rgb(0,0,0)
Script& s = card_list_color_script.getScript();
Script& s = card_list_color_script.getMutableScript();
s.addInstruction(I_PUSH_CONST, to_script(&cf->choice_colors_cardlist));
s.addInstruction(I_GET_VAR, SCRIPT_VAR_card);
s.addInstruction(I_MEMBER_C, cf->name);
+1 -1
View File
@@ -670,7 +670,7 @@ bool KeywordDatabase::tryExpand(const Keyword& kw,
bool expand = expand_type == _('1');
if (!expand && expand_type != _('0')) {
// default expand, determined by script
expand = expand_default && (bool)*expand_default->eval(ctx);
expand = expand_default ? (bool)*expand_default->eval(ctx) : true;
expand_type = expand ? _('A') : _('a');
}
+2 -2
View File
@@ -51,7 +51,7 @@ StatsDimension::StatsDimension(const Field& field)
groups.push_back(g->name);
}
// initialize script: primary_choice(card.{field_name})
Script& s = script.getScript();
Script& s = script.getMutableScript();
s.addInstruction(I_PUSH_CONST, script_primary_choice);
s.addInstruction(I_GET_VAR, SCRIPT_VAR_card);
s.addInstruction(I_MEMBER_C, field.name);
@@ -59,7 +59,7 @@ StatsDimension::StatsDimension(const Field& field)
s.addInstruction(I_NOP, SCRIPT_VAR_input);
} else {
// initialize script, card.{field_name}
Script& s = script.getScript();
Script& s = script.getMutableScript();
s.addInstruction(I_GET_VAR, SCRIPT_VAR_card);
s.addInstruction(I_MEMBER_C, field.name);
}