mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Script errors now have information on where the error occureed (what value);
Script operator "int + object" now uses string concatenation instead of converting the object to integer; Html export window uses a dummy set for editing options, so we don't pollute the set's undo stack; Choice rendererer in nativelook 'both' style always leaves room for the icon; Version bump git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@438 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -214,9 +214,13 @@ void SetScriptManager::updateStyles(const CardP& card) {
|
||||
}
|
||||
void SetScriptManager::updateStyles(Context& ctx, const IndexMap<FieldP,StyleP>& styles) {
|
||||
FOR_EACH_CONST(s, styles) {
|
||||
if (s->update(ctx)) {
|
||||
// style has changed, tell listeners
|
||||
s->tellListeners();
|
||||
try {
|
||||
if (s->update(ctx)) {
|
||||
// style has changed, tell listeners
|
||||
s->tellListeners();
|
||||
}
|
||||
} catch (const ScriptError& e) {
|
||||
throw ScriptError(e.what() + _("\nWhile updating styles for '") + s->fieldP->name + _("'"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -251,13 +255,21 @@ void SetScriptManager::updateAll() {
|
||||
// update set data
|
||||
Context& ctx = getContext(set.stylesheet);
|
||||
FOR_EACH(v, set.data) {
|
||||
v->update(ctx);
|
||||
try {
|
||||
v->update(ctx);
|
||||
} catch (const ScriptError& e) {
|
||||
throw ScriptError(e.what() + _("\nWhile updating set value '") + v->fieldP->name + _("'"));
|
||||
}
|
||||
}
|
||||
// update card data of all cards
|
||||
FOR_EACH(card, set.cards) {
|
||||
Context& ctx = getContext(card);
|
||||
FOR_EACH(v, card->data) {
|
||||
v->update(ctx);
|
||||
try {
|
||||
v->update(ctx);
|
||||
} catch (const ScriptError& e) {
|
||||
throw ScriptError(e.what() + _("\nWhile updating card value '") + v->fieldP->name + _("'"));
|
||||
}
|
||||
}
|
||||
}
|
||||
// update things that depend on the card list
|
||||
@@ -286,7 +298,13 @@ void SetScriptManager::updateToUpdate(const ToUpdate& u, deque<ToUpdate>& to_upd
|
||||
Age age = u.value->last_script_update;
|
||||
if (starting_age < age) return; // this value was already updated
|
||||
Context& ctx = getContext(u.card);
|
||||
if (u.value->update(ctx)) {
|
||||
bool changes;
|
||||
try {
|
||||
changes = u.value->update(ctx);
|
||||
} catch (const ScriptError& e) {
|
||||
throw ScriptError(e.what() + _("\nWhile updating value '") + u.value->fieldP->name + _("'"));
|
||||
}
|
||||
if (changes) {
|
||||
// changed, send event
|
||||
ScriptValueEvent change(u.card.get(), u.value);
|
||||
set.actions.tellListeners(change, false);
|
||||
|
||||
Reference in New Issue
Block a user