diff options
Diffstat (limited to 'src/game-server/mapcomposite.cpp')
-rw-r--r-- | src/game-server/mapcomposite.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/game-server/mapcomposite.cpp b/src/game-server/mapcomposite.cpp index ae88a37c..451147f7 100644 --- a/src/game-server/mapcomposite.cpp +++ b/src/game-server/mapcomposite.cpp @@ -22,6 +22,7 @@ #include <cassert> #include "common/configuration.h" +#include "accountconnection.h" #include "game-server/map.h" #include "game-server/mapcomposite.h" #include "game-server/character.h" @@ -593,3 +594,28 @@ const std::vector< Thing * > &MapComposite::getEverything() const { return mContent->things; } + + +std::string MapComposite::getVariable(const std::string &key) +{ + std::map<std::string, std::string>::iterator iValue = mScriptVariables.find(key); + if (iValue != mScriptVariables.end()) + { + return iValue->second; + } else { + return std::string(); + } +} + +void MapComposite::setVariable(const std::string &key, const std::string &value) +{ + // check if the value actually changed + std::map<std::string, std::string>::iterator iOldValue = mScriptVariables.find(key); + if (iOldValue == mScriptVariables.end() || iOldValue->second != value) + { + // changed valu or unknown variable + mScriptVariables[key] = value; + // update accountserver + accountHandler->updateMapVar(this, key, value); + } +} |