mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
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:
@@ -542,8 +542,8 @@ SCRIPT_FUNCTION(random_select) {
|
||||
SCRIPT_FUNCTION_WITH_DEP(expand_keywords) {
|
||||
SCRIPT_PARAM_C(String, input);
|
||||
SCRIPT_PARAM_C(Set*, set);
|
||||
SCRIPT_PARAM_N(ScriptValueP, _("condition"), match_condition);
|
||||
SCRIPT_PARAM_N(ScriptValueP, _("default expand"), default_expand);
|
||||
SCRIPT_OPTIONAL_PARAM_N_(ScriptValueP, _("condition"), match_condition);
|
||||
SCRIPT_OPTIONAL_PARAM_N_(ScriptValueP, _("default expand"), default_expand);
|
||||
SCRIPT_PARAM_N(ScriptValueP, _("combine"), combine);
|
||||
KeywordDatabase& db = set->keyword_db;
|
||||
if (db.empty()) {
|
||||
@@ -562,10 +562,10 @@ SCRIPT_FUNCTION_WITH_DEP(expand_keywords) {
|
||||
}
|
||||
SCRIPT_FUNCTION_DEPENDENCIES(expand_keywords) {
|
||||
SCRIPT_PARAM_C(Set*, set);
|
||||
SCRIPT_PARAM_N(ScriptValueP, _("condition"), match_condition);
|
||||
SCRIPT_PARAM_N(ScriptValueP, _("default expand"), default_expand);
|
||||
SCRIPT_OPTIONAL_PARAM_N_(ScriptValueP, _("condition"), match_condition);
|
||||
SCRIPT_OPTIONAL_PARAM_N_(ScriptValueP, _("default expand"), default_expand);
|
||||
SCRIPT_PARAM_N(ScriptValueP, _("combine"), combine);
|
||||
match_condition->dependencies(ctx,dep);
|
||||
if (match_condition) match_condition->dependencies(ctx,dep);
|
||||
default_expand ->dependencies(ctx,dep);
|
||||
combine ->dependencies(ctx,dep);
|
||||
set->game->dependent_scripts_keywords.add(dep); // this depends on the set's keywords
|
||||
|
||||
@@ -77,7 +77,7 @@ bool ScriptableImage::update(Context& ctx) {
|
||||
}
|
||||
}
|
||||
|
||||
ScriptP ScriptableImage::getScriptP() {
|
||||
ScriptP ScriptableImage::getValidScriptP() {
|
||||
if (script) return script.getScriptP();
|
||||
// return value or a blank image
|
||||
ScriptP s(new Script);
|
||||
|
||||
@@ -54,9 +54,9 @@ class ScriptableImage {
|
||||
inline bool local() const { return value && value->local(); }
|
||||
|
||||
/// Get access to the script, be careful
|
||||
inline Script& getScript() { return script.getScript(); }
|
||||
inline Script& getMutableScript() { return script.getMutableScript(); }
|
||||
/// Get access to the script, always returns a valid script
|
||||
ScriptP getScriptP();
|
||||
ScriptP getValidScriptP();
|
||||
|
||||
protected:
|
||||
OptionalScript script; ///< The script, not really optional
|
||||
|
||||
@@ -75,7 +75,7 @@ void OptionalScript::initDependencies(Context& ctx, const Dependency& dep) const
|
||||
}
|
||||
}
|
||||
|
||||
Script& OptionalScript::getScript() {
|
||||
Script& OptionalScript::getMutableScript() {
|
||||
if (!script) script = new_intrusive<Script>();
|
||||
return *script;
|
||||
}
|
||||
|
||||
@@ -84,11 +84,13 @@ class OptionalScript {
|
||||
void initDependencies(Context&, const Dependency& dep) const;
|
||||
|
||||
/// Get access to the script, be careful
|
||||
Script& getScript();
|
||||
inline ScriptP& getScriptP() { return script; }
|
||||
Script& getMutableScript();
|
||||
inline ScriptP getScriptP() const { return script; }
|
||||
inline void setScriptP(const ScriptP& new_script) { script = new_script; }
|
||||
/// Get access to the unparsed value
|
||||
inline String& getUnparsed() { return unparsed; }
|
||||
inline const String& getUnparsed() const { return unparsed; }
|
||||
inline const String& getUnparsed() const { return unparsed; }
|
||||
inline String& getMutableUnparsed() { return unparsed; }
|
||||
inline void setUnparsed(String& new_unparsed) { unparsed = new_unparsed; }
|
||||
|
||||
protected:
|
||||
ScriptP script; ///< The script, may be null if there is no script
|
||||
|
||||
Reference in New Issue
Block a user