diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-09-15 21:26:07 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-09-15 21:26:07 +0200 |
commit | fa901d1cb94cdd47cb066402ae7e478154113306 (patch) | |
tree | 369e02549b3facf6aac2c9af3b995df07fa7581d /src/game-server/commandhandler.cpp | |
parent | a92a2f3255e9b7eabedb8eec7e25cd80e82481fb (diff) | |
download | manaserv-fa901d1cb94cdd47cb066402ae7e478154113306.tar.gz manaserv-fa901d1cb94cdd47cb066402ae7e478154113306.tar.bz2 manaserv-fa901d1cb94cdd47cb066402ae7e478154113306.tar.xz manaserv-fa901d1cb94cdd47cb066402ae7e478154113306.zip |
Reordered the manaserv.xml.example file and made related code cleanups.
Reviewed-by: Thorbjorn.
Diffstat (limited to 'src/game-server/commandhandler.cpp')
-rw-r--r-- | src/game-server/commandhandler.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/game-server/commandhandler.cpp b/src/game-server/commandhandler.cpp index eb894b5c..0e6dad6b 100644 --- a/src/game-server/commandhandler.cpp +++ b/src/game-server/commandhandler.cpp @@ -931,12 +931,12 @@ static void handleMute(Character *player, std::string &args) { Character *other; int length; - // get arguments + // Get arguments. std::string character = getArgument(args); std::string valuestr = getArgument(args); - // check for valid player + // Check for a valid player. other = getPlayer(character); if (!other) { @@ -944,30 +944,34 @@ static void handleMute(Character *player, std::string &args) return; } - // change the length to an integer + // Turn the length back to an integer. if (valuestr.empty()) - { - length = Configuration::getValue("defaultMuteLength", 60); - } else { + length = Configuration::getValue("command_defaultMuteLength", 60); + else length = utils::stringToInt(valuestr); - } + if (length < 0) { say("Invalid length, using default", player); - length = Configuration::getValue("defaultMuteLength", 60); + length = Configuration::getValue("command_defaultMuteLength", 60); } - // mute the player + // Mute the player. other->mute(length); - // feedback + // Feedback. std::stringstream targetMsg; std::stringstream userMsg; if (length > 0) { - targetMsg << player->getName() << " muted you for " << length << " seconds."; - userMsg << "You muted " << other->getName() << " for " << length << " seconds."; - } else { + targetMsg << player->getName() << " muted you for " + << length << " seconds."; + + userMsg << "You muted " << other->getName() + << " for " << length << " seconds."; + } + else + { targetMsg << player->getName() << " unmuted you."; userMsg << "You unmuted " << other->getName() << "."; } |