summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/being/localplayer.cpp3
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/game.cpp11
-rw-r--r--src/gui/windows/chatwindow.cpp10
-rw-r--r--src/gui/windows/chatwindow.h2
5 files changed, 19 insertions, 8 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index e85301754..52201e7fb 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -404,8 +404,7 @@ void LocalPlayer::setGMLevel(const int level)
if (chatWindow)
{
chatWindow->loadGMCommands();
- if (!gmChatTab && config.getBoolValue("enableGmTab"))
- chatWindow->addSpecialChannelTab(GM_CHANNEL, false);
+ chatWindow->showGMTab();
}
}
}
diff --git a/src/defaults.cpp b/src/defaults.cpp
index dbecffe75..43f3c57eb 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -596,6 +596,7 @@ DefaultsData* getPathsDefaults()
AddDEF("poisonEffectName", "poison");
AddDEF("cartEffectName", "cart");
AddDEF("ridingEffectName", "riding");
+ AddDEF("gmTabMinimalLevel", "2");
return configData;
}
diff --git a/src/game.cpp b/src/game.cpp
index b364bd2e3..00de21004 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -287,14 +287,13 @@ static void createGuiWindows()
battleChatTab = nullptr;
}
- if (localPlayer && !gmChatTab && config.getBoolValue("enableGmTab")
- && localPlayer->getGMLevel() > 0)
+ if (chatWindow)
{
- chatWindow->addSpecialChannelTab(GM_CHANNEL, false);
- }
+ chatWindow->showGMTab();
- if (!isSafeMode && chatWindow)
- chatWindow->loadState();
+ if (!isSafeMode)
+ chatWindow->loadState();
+ }
if (setupWindow)
setupWindow->externalUpdate();
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 111ce4642..72b547c2a 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -2149,6 +2149,16 @@ void ChatWindow::debugMessage(const std::string &msg)
debugChatTab->chatLog(msg, ChatMsgType::BY_SERVER);
}
+void ChatWindow::showGMTab()
+{
+ if (!gmChatTab &&
+ config.getBoolValue("enableGmTab") &&
+ localPlayer->getGMLevel() >= paths.getIntValue("gmTabMinimalLevel"))
+ {
+ addSpecialChannelTab(GM_CHANNEL, false);
+ }
+}
+
#ifdef EATHENA_SUPPORT
void ChatWindow::joinRoom(const bool isJoin)
{
diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h
index ca8250fa0..c5b5aea1a 100644
--- a/src/gui/windows/chatwindow.h
+++ b/src/gui/windows/chatwindow.h
@@ -323,6 +323,8 @@ class ChatWindow final : public Window,
void postConnection();
+ void showGMTab();
+
#ifdef USE_PROFILER
void logicChildren();
#endif