diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-03-06 11:18:47 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-03-06 11:18:47 +0100 |
commit | 80f8af40b33b71f04ec71ff12cfbb2a21de61703 (patch) | |
tree | 7e17bd6abcbc420d89e4ee432650efa62f73c487 /src/game-server | |
parent | 54d5f7e577db0639e42b18beae4b5c87af6d6843 (diff) | |
download | manaserv-80f8af40b33b71f04ec71ff12cfbb2a21de61703.tar.gz manaserv-80f8af40b33b71f04ec71ff12cfbb2a21de61703.tar.bz2 manaserv-80f8af40b33b71f04ec71ff12cfbb2a21de61703.tar.xz manaserv-80f8af40b33b71f04ec71ff12cfbb2a21de61703.zip |
Small fixes coming from my comment on issue #77.
Trivial.
Diffstat (limited to 'src/game-server')
-rw-r--r-- | src/game-server/accountconnection.cpp | 3 | ||||
-rw-r--r-- | src/game-server/mapcomposite.cpp | 12 | ||||
-rw-r--r-- | src/game-server/mapcomposite.h | 8 | ||||
-rw-r--r-- | src/game-server/state.cpp | 10 |
4 files changed, 18 insertions, 15 deletions
diff --git a/src/game-server/accountconnection.cpp b/src/game-server/accountconnection.cpp index 32d64a3c..5276bce3 100644 --- a/src/game-server/accountconnection.cpp +++ b/src/game-server/accountconnection.cpp @@ -173,7 +173,8 @@ void AccountConnection::processMessage(MessageIn &msg) std::string key = msg.readString(); std::string value = msg.readString(); GameState::setVariableFromDbserver(key, value); - LOG_INFO("Global variable \""<<key<<"\" has changed to \""<<value<<"\""); + LOG_DEBUG("Global variable \"" << key << "\" has changed to \"" + << value << "\""); } break; case AGMSG_REDIRECT_RESPONSE: diff --git a/src/game-server/mapcomposite.cpp b/src/game-server/mapcomposite.cpp index 451147f7..56c983f3 100644 --- a/src/game-server/mapcomposite.cpp +++ b/src/game-server/mapcomposite.cpp @@ -598,22 +598,22 @@ const std::vector< Thing * > &MapComposite::getEverything() const std::string MapComposite::getVariable(const std::string &key) { - std::map<std::string, std::string>::iterator iValue = mScriptVariables.find(key); + std::map<std::string, std::string>::iterator iValue = + mScriptVariables.find(key); if (iValue != mScriptVariables.end()) - { return iValue->second; - } else { + 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); + std::map<std::string, std::string>::iterator iOldValue = + mScriptVariables.find(key); if (iOldValue == mScriptVariables.end() || iOldValue->second != value) { - // changed valu or unknown variable + // changed value or unknown variable mScriptVariables[key] = value; // update accountserver accountHandler->updateMapVar(this, key, value); diff --git a/src/game-server/mapcomposite.h b/src/game-server/mapcomposite.h index 351a0572..a695de0d 100644 --- a/src/game-server/mapcomposite.h +++ b/src/game-server/mapcomposite.h @@ -348,8 +348,9 @@ class MapComposite * Changes a script variable without notifying the database server * about the change */ - void setVariableFromDbserver (const std::string &key, const std::string &value) - { mScriptVariables[key] = value ;} + void setVariableFromDbserver (const std::string &key, + const std::string &value) + { mScriptVariables[key] = value; } private: MapComposite(const MapComposite &); @@ -359,7 +360,8 @@ class MapComposite Script *mScript; /**< Script associated to this map. */ std::string mName; /**< Name of the map. */ unsigned short mID; /**< ID of the map. */ - std::map< std::string, std::string > mScriptVariables; /** Cached persistent variables */ + /** Cached persistent variables */ + std::map< std::string, std::string > mScriptVariables; PvPRules mPvPRules; }; diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp index 642d5dbe..5cd15881 100644 --- a/src/game-server/state.cpp +++ b/src/game-server/state.cpp @@ -819,13 +819,12 @@ void GameState::sayToAll(const std::string &text) std::string GameState::getVariable(const std::string &key) { - std::map<std::string, std::string>::iterator iValue = mScriptVariables.find(key); + std::map<std::string, std::string>::iterator iValue = + mScriptVariables.find(key); if (iValue != mScriptVariables.end()) - { return iValue->second; - } else { + else return std::string(); - } } void GameState::setVariable(const std::string &key, const std::string &value) @@ -834,7 +833,8 @@ void GameState::setVariable(const std::string &key, const std::string &value) accountHandler->updateWorldVar(key, value); } -void GameState::setVariableFromDbserver(const std::string &key, const std::string &value) +void GameState::setVariableFromDbserver(const std::string &key, + const std::string &value) { mScriptVariables[key] = value ; } |