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 | |
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')
-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 | ||||
-rw-r--r-- | src/scripting/lua.cpp | 8 |
5 files changed, 22 insertions, 19 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 ; } diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index f55b96d1..0189f8ed 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -1085,7 +1085,7 @@ static int chr_get_quest(lua_State *s) * gets the value of a persistent map variable. * mana.getvar_map(string): string */ - static int getvar_map(lua_State *s) +static int getvar_map(lua_State *s) { const char *m = luaL_checkstring(s, 1); if (m[0] == 0) @@ -1107,7 +1107,7 @@ static int chr_get_quest(lua_State *s) * sets the value of a persistent map variable. * mana.setvar_map(string, string) */ - static int setvar_map(lua_State *s) +static int setvar_map(lua_State *s) { const char *m = luaL_checkstring(s, 1); if (m[0] == 0) @@ -1130,7 +1130,7 @@ static int chr_get_quest(lua_State *s) * gets the value of a persistent global variable. * mana.getvar_world(string): string */ - static int getvar_world(lua_State *s) +static int getvar_world(lua_State *s) { const char *m = luaL_checkstring(s, 1); if (m[0] == 0) @@ -1149,7 +1149,7 @@ static int chr_get_quest(lua_State *s) * sets the value of a persistent global variable. * mana.setvar_world(string, string) */ - static int setvar_world(lua_State *s) +static int setvar_world(lua_State *s) { const char *m = luaL_checkstring(s, 1); if (m[0] == 0) |