summaryrefslogtreecommitdiff
path: root/src/game-server/mapcomposite.h
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2012-03-10 23:31:32 +0100
committerErik Schilling <ablu.erikschilling@googlemail.com>2012-03-11 10:16:35 +0100
commit520705579d6a68cf6908275026eef2edee0758af (patch)
tree2d37eb5e28a1f6d95bac4094a613f054c08c55b2 /src/game-server/mapcomposite.h
parent78c912fb4007c3e5f0b43de02646772acb21ecf2 (diff)
downloadmanaserv-520705579d6a68cf6908275026eef2edee0758af.tar.gz
manaserv-520705579d6a68cf6908275026eef2edee0758af.tar.bz2
manaserv-520705579d6a68cf6908275026eef2edee0758af.tar.xz
manaserv-520705579d6a68cf6908275026eef2edee0758af.zip
Added callbacks for map/worldvar changes
Reviewed-by: bjorn.
Diffstat (limited to 'src/game-server/mapcomposite.h')
-rw-r--r--src/game-server/mapcomposite.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/game-server/mapcomposite.h b/src/game-server/mapcomposite.h
index 54334663..15310a97 100644
--- a/src/game-server/mapcomposite.h
+++ b/src/game-server/mapcomposite.h
@@ -338,6 +338,21 @@ class MapComposite
const std::string &value)
{ mScriptVariables[key] = value; }
+ /**
+ * Sets callback for map variable
+ */
+ void setMapVariableCallback(const std::string &key, Script *script)
+ { script->assignCallback(mMapVariableCallbacks[key]); }
+
+ /**
+ * Sets callback for global variable
+ */
+ void setWorldVariableCallback(const std::string &key, Script *script)
+ { script->assignCallback(mWorldVariableCallbacks[key]); }
+
+ void callWorldVariableCallback(const std::string &key,
+ const std::string &value);
+
static void setInitializeCallback(Script *script)
{ script->assignCallback(mInitializeCallback); }
@@ -345,6 +360,8 @@ class MapComposite
MapComposite(const MapComposite &);
void initializeContent();
+ void callMapVariableCallback(const std::string &key,
+ const std::string &value);
Map *mMap; /**< Actual map. */
MapContent *mContent; /**< Entities on the map. */
@@ -353,6 +370,8 @@ class MapComposite
/** Cached persistent variables */
std::map<std::string, std::string> mScriptVariables;
PvPRules mPvPRules;
+ std::map<const std::string, Script::Ref> mMapVariableCallbacks;
+ std::map<const std::string, Script::Ref> mWorldVariableCallbacks;
static Script::Ref mInitializeCallback;
};