summaryrefslogtreecommitdiff
path: root/src/progs/manaverse
diff options
context:
space:
mode:
Diffstat (limited to 'src/progs/manaverse')
-rw-r--r--src/progs/manaverse/actions/commands.cpp18
-rw-r--r--src/progs/manaverse/client.cpp47
-rw-r--r--src/progs/manaverse/gui/viewport.cpp1
3 files changed, 56 insertions, 10 deletions
diff --git a/src/progs/manaverse/actions/commands.cpp b/src/progs/manaverse/actions/commands.cpp
index 9a622b627..668c54b80 100644
--- a/src/progs/manaverse/actions/commands.cpp
+++ b/src/progs/manaverse/actions/commands.cpp
@@ -58,6 +58,7 @@
#include "input/inputactionoperators.h"
#include "listeners/inputactionreplaylistener.h"
+#include "listeners/inputactionreplayconfirmlistener.h"
#include "net/adminhandler.h"
#include "net/chathandler.h"
@@ -966,7 +967,22 @@ impHandler(setHomunculusName)
impHandler0(fireHomunculus)
{
- if (homunculusHandler != nullptr)
+ const HomunculusInfo *const info = PlayerInfo::getHomunculus();
+ if (info == nullptr)
+ return false;
+
+ const std::string &args = event.args;
+ if (args.empty())
+ {
+ inputActionReplayConfirmListener.openDialog(
+ // TRANSLATORS: dialog title
+ _("Really?"),
+ // TRANSLATORS: dialog question
+ _("Really kill your homunculous? This is irreversible!"),
+ InputAction::HOMUNCULUS_FIRE);
+ return true;
+ }
+ else if (args == "yes" && homunculusHandler != nullptr)
{
homunculusHandler->fire();
return true;
diff --git a/src/progs/manaverse/client.cpp b/src/progs/manaverse/client.cpp
index ece3c9d8d..980ffdc91 100644
--- a/src/progs/manaverse/client.cpp
+++ b/src/progs/manaverse/client.cpp
@@ -128,6 +128,7 @@
#ifdef ANDROID
#include "fs/paths.h"
#endif // ANDROID
+#include "utils/performance.h"
#include "utils/perfstat.h"
#include "utils/sdlcheckutils.h"
#include "utils/sdlhelper.h"
@@ -145,14 +146,14 @@
#include "configuration.h"
#endif // USE_OPENGL
-#ifdef WIN32
+#ifdef _WIN32
PRAGMA48(GCC diagnostic push)
PRAGMA48(GCC diagnostic ignored "-Wshadow")
#include <SDL_syswm.h>
PRAGMA48(GCC diagnostic pop)
#include "fs/specialfolder.h"
#undef ERROR
-#endif // WIN32
+#endif // _WIN32
#ifdef ANDROID
#ifndef USE_SDL2
@@ -392,9 +393,9 @@ void Client::gameInit()
eventsManager.init();
eventsManager.enableEvents();
-#ifdef WIN32
+#ifdef _WIN32
Dirs::mountDataDir();
-#endif // WIN32
+#endif // _WIN32
#ifndef USE_SDL2
WindowManager::setIcon();
#endif // USE_SDL2
@@ -424,10 +425,10 @@ void Client::gameInit()
touchManager.init();
-#ifndef WIN32
+#ifndef _WIN32
Dirs::extractDataDir();
Dirs::mountDataDir();
-#endif // WIN32
+#endif // _WIN32
Dirs::updateDataPath();
@@ -754,7 +755,7 @@ void Client::gameClear()
logger->log1("Quitting11");
#ifdef USE_PROFILER
- Perfomance::clear();
+ Performance::clear();
#endif // USE_PROFILER
#ifdef DEBUG_OPENGL_LEAKS
@@ -1579,6 +1580,34 @@ int Client::gameExec()
BLOCK_END("Client::gameExec State::SWITCH_SERVER")
break;
+ case State::SWITCH_WORLD:
+ BLOCK_START("Client::gameExec State::SWITCH_WORLD")
+ logger->log1("State: SWITCH WORLD");
+
+ if (loginHandler != nullptr)
+ {
+ loginHandler->logout();
+ loginHandler->disconnect();
+ }
+ if (gameHandler != nullptr)
+ gameHandler->disconnect();
+ if (loginHandler != nullptr)
+ loginHandler->connect();
+
+ if (loginHandler != nullptr &&
+ loginHandler->getWorlds().size() > 1)
+ {
+ mState = State::LOGIN_ATTEMPT;
+ }
+ else
+ {
+ settings.login.clear();
+ WindowManager::updateTitle();
+ mState = State::LOGIN;
+ }
+ BLOCK_END("Client::gameExec State::SWITCH_WORLD")
+ break;
+
case State::SWITCH_LOGIN:
BLOCK_START("Client::gameExec State::SWITCH_LOGIN")
logger->log1("State: SWITCH LOGIN");
@@ -1880,7 +1909,7 @@ void Client::moveButtons(const int width)
{
int x = width - mSetupButton->getWidth() - mButtonPadding;
mSetupButton->setPosition(x, mButtonPadding);
-#ifndef WIN32
+#ifndef _WIN32
x -= mPerfomanceButton->getWidth() + mButtonSpacing;
mPerfomanceButton->setPosition(x, mButtonPadding);
@@ -1899,7 +1928,7 @@ void Client::moveButtons(const int width)
x -= mCloseButton->getWidth() + mButtonSpacing;
mCloseButton->setPosition(x, mButtonPadding);
#endif // ANDROID
-#endif // WIN32
+#endif // _WIN32
}
}
diff --git a/src/progs/manaverse/gui/viewport.cpp b/src/progs/manaverse/gui/viewport.cpp
index 4902b7175..654559967 100644
--- a/src/progs/manaverse/gui/viewport.cpp
+++ b/src/progs/manaverse/gui/viewport.cpp
@@ -53,6 +53,7 @@
#include "utils/checkutils.h"
#include "utils/foreach.h"
+#include "utils/performance.h"
#include "resources/map/map.h"
#include "resources/map/mapitem.h"