mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
script for match string of keywords
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@353 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -49,6 +49,7 @@ IMPLEMENT_REFLECTION(Game) {
|
||||
REFLECT_NO_SCRIPT(statistics_dimensions);
|
||||
REFLECT_NO_SCRIPT(statistics_categories);
|
||||
REFLECT_NO_SCRIPT(pack_types);
|
||||
REFLECT_NO_SCRIPT(keyword_match_script);
|
||||
REFLECT(has_keywords);
|
||||
REFLECT(keyword_modes);
|
||||
REFLECT(keyword_parameter_types);
|
||||
|
||||
@@ -44,6 +44,7 @@ class Game : public Packaged {
|
||||
vector<PackTypeP> pack_types; ///< Types of random card packs to generate
|
||||
|
||||
bool has_keywords; ///< Does this game use keywords?
|
||||
OptionalScript keyword_match_script; ///< For the keyword editor
|
||||
vector<KeywordParamP> keyword_parameter_types;///< Types of keyword parameters
|
||||
vector<KeywordModeP> keyword_modes; ///< Modes of keywords
|
||||
vector<KeywordP> keywords; ///< Keywords for use in text
|
||||
|
||||
@@ -259,6 +259,7 @@ void KeywordsPanel::onChangeSet() {
|
||||
match ->getStyle().font.size = 12;
|
||||
match ->getStyle().padding_bottom = 1;
|
||||
match ->updateSize();
|
||||
match ->getField().script = set->game->keyword_match_script;
|
||||
reminder->setSet(set);
|
||||
reminder->getStyle().padding_bottom = 2;
|
||||
match ->getStyle().font.size = 10;
|
||||
|
||||
@@ -136,6 +136,9 @@ void SetScriptManager::onAction(const Action& action, bool undone) {
|
||||
KeywordTextValue* value = dynamic_cast<KeywordTextValue*>(action.valueP.get());
|
||||
if (value) {
|
||||
if (value->underlying == &value->keyword.match) {
|
||||
// script
|
||||
Context& ctx = getContext(set.stylesheet);
|
||||
value->update(ctx);
|
||||
// changed the 'match' string of a keyword, rebuild database and regex so matching is correct
|
||||
value->keyword.prepare(set.game->keyword_parameter_types, true);
|
||||
set.keyword_db.clear();
|
||||
|
||||
Reference in New Issue
Block a user