summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-25 17:43:16 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-25 17:48:01 +0300
commitc1c666d37d924f4ef9c544b7ce25fc3ef7b6dd15 (patch)
treebf2b183127384c9b0b77719c1176db51f917f6f4 /src/utils
parentf2a2fe38f1185cbe6acb978b37190aaae76f1b62 (diff)
downloadplus-c1c666d37d924f4ef9c544b7ce25fc3ef7b6dd15.tar.gz
plus-c1c666d37d924f4ef9c544b7ce25fc3ef7b6dd15.tar.bz2
plus-c1c666d37d924f4ef9c544b7ce25fc3ef7b6dd15.tar.xz
plus-c1c666d37d924f4ef9c544b7ce25fc3ef7b6dd15.zip
Replace direct gm commands to gm command functions.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/gmfunctions.cpp29
-rw-r--r--src/utils/gmfunctions.h5
2 files changed, 34 insertions, 0 deletions
diff --git a/src/utils/gmfunctions.cpp b/src/utils/gmfunctions.cpp
index 35f68b133..d548cf79d 100644
--- a/src/utils/gmfunctions.cpp
+++ b/src/utils/gmfunctions.cpp
@@ -54,6 +54,14 @@ void runCommand(const std::string &command,
}
}
+void runCommand(const std::string &command)
+{
+ chatHandler->talk(std::string(
+ settings.gmCommandSymbol).append(
+ command),
+ GENERAL_CHANNEL);
+}
+
void runCharCommand(const std::string &command,
const std::string &name,
const std::string &params)
@@ -90,4 +98,25 @@ void runCharCommand(const std::string &command,
}
}
+void runCharCommand(const std::string &command,
+ const std::string &name)
+{
+ if (localPlayer && name == localPlayer->getName())
+ {
+ chatHandler->talk(std::string(
+ settings.gmCommandSymbol).append(
+ command),
+ GENERAL_CHANNEL);
+ }
+ else
+ {
+ chatHandler->talk(std::string(
+ settings.gmCharCommandSymbol).append(
+ command).append(
+ " ").append(
+ name),
+ GENERAL_CHANNEL);
+ }
+}
+
} // namespace Gm
diff --git a/src/utils/gmfunctions.h b/src/utils/gmfunctions.h
index 6ef32996e..833ef5bd1 100644
--- a/src/utils/gmfunctions.h
+++ b/src/utils/gmfunctions.h
@@ -30,9 +30,14 @@ namespace Gm
void runCommand(const std::string &command,
const std::string &params);
+ void runCommand(const std::string &command);
+
void runCharCommand(const std::string &command,
const std::string &name,
const std::string &params);
+
+ void runCharCommand(const std::string &command,
+ const std::string &name);
} // namespace Gm
#endif // UTILS_GMFUNCTIONS_H