diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-02-08 04:54:13 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-02-08 04:54:13 +0300 |
commit | 30b2f0350767d4d0e78d27b9a1fd33e2095171b9 (patch) | |
tree | 753a5b2a235ec49deb768f18135d2e6640c9e759 | |
parent | 2f34575b834e2c70583af83a17da59750978f15e (diff) | |
download | mv-30b2f0350767d4d0e78d27b9a1fd33e2095171b9.tar.gz mv-30b2f0350767d4d0e78d27b9a1fd33e2095171b9.tar.bz2 mv-30b2f0350767d4d0e78d27b9a1fd33e2095171b9.tar.xz mv-30b2f0350767d4d0e78d27b9a1fd33e2095171b9.zip |
Add chat command /setdrop N to set change drop counter.
-rw-r--r-- | src/commandhandler.cpp | 9 | ||||
-rw-r--r-- | src/commandhandler.h | 2 | ||||
-rw-r--r-- | src/gui/chatwindow.cpp | 1 | ||||
-rw-r--r-- | src/localplayer.cpp | 10 | ||||
-rw-r--r-- | src/localplayer.h | 2 |
5 files changed, 24 insertions, 0 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index 4022d8d58..9f832c021 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -201,6 +201,8 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab) handleServerIgnoreAll(args, tab); else if (type == "serverunignoreall") handleServerUnIgnoreAll(args, tab); + else if (type == "setdrop") + handleSetDrop(args, tab); else if (type == "dumpg") handleDumpGraphics(args, tab); else if (type == "dumpt") @@ -1187,6 +1189,13 @@ void CommandHandler::outStringNormal(ChatTab *tab, const std::string &str, } } +void CommandHandler::handleSetDrop(const std::string &args, + ChatTab *tab A_UNUSED) +{ + if (player_node) + player_node->setQuickDropCounter(atoi(args.c_str())); +} + #ifdef DEBUG_DUMP_LEAKS void showRes(std::string str, ResourceManager::Resources *res); diff --git a/src/commandhandler.h b/src/commandhandler.h index 16e5e94ce..cd25c234a 100644 --- a/src/commandhandler.h +++ b/src/commandhandler.h @@ -295,6 +295,8 @@ class CommandHandler void handleServerUnIgnoreAll(const std::string &args, ChatTab *tab); + void handleSetDrop(const std::string &args, ChatTab *tab); + void handleDump(const std::string &args, ChatTab *tab); void handleDumpGraphics(const std::string &args, ChatTab *tab); diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 4fa608f35..69e4d703f 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -311,6 +311,7 @@ void ChatWindow::fillCommands() mCommands.push_back("<MONSTER>"); mCommands.push_back("<PEOPLE>"); mCommands.push_back("<PARTY>"); + mCommands.push_back("/setdrop "); } void ChatWindow::loadGMCommands() diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 6dd55dace..01e8c1ae8 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -2067,6 +2067,16 @@ std::string LocalPlayer::getQuickDropCounterString() } } +void LocalPlayer::setQuickDropCounter(int n) +{ + if (n < 1 || n >= (signed)quickDropCounterSize) + return; + mQuickDropCounter = n; + config.setValue("quickDropCounter", mQuickDropCounter); + if (miniStatusWindow) + miniStatusWindow->updateStatus(); +} + const unsigned pickUpTypeSize = 7; void LocalPlayer::changePickUpType() diff --git a/src/localplayer.h b/src/localplayer.h index bf65096b5..03b3a2538 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -256,6 +256,8 @@ class LocalPlayer : public Being, public ActorSpriteListener, int getQuickDropCounter() const { return mQuickDropCounter; } + void setQuickDropCounter(int n); + void changeQuickDropCounter(); int getMoveState() const |