summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjak1 <mike.wollmann@gmail.com>2021-06-06 14:24:49 +0200
committerjak1 <mike.wollmann@gmail.com>2021-06-06 14:24:49 +0200
commit825ef1e963fd8a30e04e69f676eecc90e601f4e1 (patch)
tree593221735bbd9cce62cfc34db1f706d20d5c9d92 /src
parent534de91101fca098a8cc3878295cf4ce529810b7 (diff)
downloadManaVerse-825ef1e963fd8a30e04e69f676eecc90e601f4e1.tar.gz
ManaVerse-825ef1e963fd8a30e04e69f676eecc90e601f4e1.tar.bz2
ManaVerse-825ef1e963fd8a30e04e69f676eecc90e601f4e1.tar.xz
ManaVerse-825ef1e963fd8a30e04e69f676eecc90e601f4e1.zip
added exitcode 7 to unique sessions (-S)
Diffstat (limited to 'src')
-rw-r--r--src/net/eathena/generalrecv.cpp15
-rw-r--r--src/net/tmwa/generalrecv.cpp17
-rw-r--r--src/progs/manaplus/actions/actions.cpp11
-rw-r--r--src/progs/manaplus/client.cpp2
-rw-r--r--src/settings.h4
5 files changed, 44 insertions, 5 deletions
diff --git a/src/net/eathena/generalrecv.cpp b/src/net/eathena/generalrecv.cpp
index f1a6654dc..c3dc4b4b8 100644
--- a/src/net/eathena/generalrecv.cpp
+++ b/src/net/eathena/generalrecv.cpp
@@ -24,6 +24,7 @@
#include "client.h"
#include "logger.h"
+#include "settings.h"
#include "net/messagein.h"
@@ -78,6 +79,20 @@ void GeneralRecv::processConnectionProblem(Net::MessageIn &msg)
// TRANSLATORS: error message
errorMessage = _("Sorry, you are underaged.");
break;
+ // all launcher (-S) cases should be added here (exitcode = code)
+ case 7:
+ if (settings.options.uniqueSession)
+ {
+ settings.exitcode = code;
+ client->setState(State::EXIT);
+ return;
+ }
+ else
+ {
+ // TRANSLATORS: error message
+ errorMessage = _("Unique Session required.");
+ }
+ break;
case 8:
// TRANSLATORS: error message
errorMessage = _("Duplicated login.");
diff --git a/src/net/tmwa/generalrecv.cpp b/src/net/tmwa/generalrecv.cpp
index 711e627c6..7cc386c67 100644
--- a/src/net/tmwa/generalrecv.cpp
+++ b/src/net/tmwa/generalrecv.cpp
@@ -24,6 +24,8 @@
#include "client.h"
#include "logger.h"
+#include "settings.h"
+
#include "net/messagein.h"
@@ -70,6 +72,21 @@ void GeneralRecv::processConnectionProblem(Net::MessageIn &msg)
// TRANSLATORS: error message
errorMessage = _("Speed hack detected.");
break;
+ // all launcher (-S) cases should be added here (exitcode = code)
+ case 7:
+ if (settings.options.uniqueSession)
+ {
+ settings.exitcode = code;
+ client->setState(State::EXIT);
+ return;
+ }
+ else
+ {
+ // TRANSLATORS: error message
+ errorMessage = _("Wrong Argument set! "
+ "(launcher option)");
+ }
+ break;
case 8:
// TRANSLATORS: error message
errorMessage = _("Duplicated login.");
diff --git a/src/progs/manaplus/actions/actions.cpp b/src/progs/manaplus/actions/actions.cpp
index 6f9bf56b9..52eca62d9 100644
--- a/src/progs/manaplus/actions/actions.cpp
+++ b/src/progs/manaplus/actions/actions.cpp
@@ -1236,9 +1236,14 @@ impHandler0(cacheInfo)
impHandler0(disconnect)
{
- if (gameHandler != nullptr)
- gameHandler->disconnect2();
- return true;
+ if (!settings.options.uniqueSession)
+ {
+ if (gameHandler != nullptr)
+ gameHandler->disconnect2();
+ return true;
+ }
+ else
+ return false;
}
impHandler(undress)
diff --git a/src/progs/manaplus/client.cpp b/src/progs/manaplus/client.cpp
index 5b86774b4..d8ba7e1c2 100644
--- a/src/progs/manaplus/client.cpp
+++ b/src/progs/manaplus/client.cpp
@@ -1700,7 +1700,7 @@ int Client::gameExec()
PROFILER_END();
}
- return 0;
+ return settings.exitcode;
}
void Client::optionChanged(const std::string &name)
diff --git a/src/settings.h b/src/settings.h
index 2e34780d9..7b76534bf 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -96,7 +96,8 @@ class Settings final
uselonglivesprites(false),
unknownSkillsAutoTab(true),
enableNewMailSystem(true),
- showButtonIcons(false)
+ showButtonIcons(false),
+ exitcode(0)
{ }
A_DELETE_COPY(Settings)
@@ -163,6 +164,7 @@ class Settings final
bool unknownSkillsAutoTab;
bool enableNewMailSystem;
bool showButtonIcons;
+ int exitcode;
};
extern Settings settings;