summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/game.cpp b/src/game.cpp
index e3d6b0bc6..09b8aab42 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1417,8 +1417,7 @@ struct VolatileRunFlags {
* hides most of the stuff in this class (nothing in this class is required
* by any other file) but exposes the public methods/data only.
*/
-class Game
-{
+class Game {
public:
Game();
~Game();
@@ -1434,6 +1433,7 @@ public:
std::string *address,
u16 port,
std::string &error_message,
+ bool *reconnect,
ChatBackend *chat_backend,
const SubgameSpec &gamespec, // Used for local game
bool simple_singleplayer_mode);
@@ -1588,6 +1588,7 @@ private:
scene::ISceneManager *smgr;
bool *kill;
std::string *error_message;
+ bool *reconnect_requested;
IGameDef *gamedef; // Convenience (same as *client)
scene::ISceneNode *skybox;
@@ -1716,17 +1717,19 @@ bool Game::startup(bool *kill,
std::string *address, // can change if simple_singleplayer_mode
u16 port,
std::string &error_message,
+ bool *reconnect,
ChatBackend *chat_backend,
const SubgameSpec &gamespec,
bool simple_singleplayer_mode)
{
// "cache"
- this->device = device;
- this->kill = kill;
- this->error_message = &error_message;
- this->random_input = random_input;
- this->input = input;
- this->chat_backend = chat_backend;
+ this->device = device;
+ this->kill = kill;
+ this->error_message = &error_message;
+ this->reconnect_requested = reconnect;
+ this->random_input = random_input;
+ this->input = input;
+ this->chat_backend = chat_backend;
this->simple_singleplayer_mode = simple_singleplayer_mode;
driver = device->getVideoDriver();
@@ -2239,6 +2242,7 @@ bool Game::connectToServer(const std::string &playername,
if (client->accessDenied()) {
*error_message = "Access denied. Reason: "
+ client->accessDeniedReason();
+ *reconnect_requested = client->reconnectRequested();
errorstream << *error_message << std::endl;
break;
}
@@ -2376,6 +2380,7 @@ inline bool Game::checkConnection()
if (client->accessDenied()) {
*error_message = "Access denied. Reason: "
+ client->accessDeniedReason();
+ *reconnect_requested = client->reconnectRequested();
errorstream << *error_message << std::endl;
return false;
}
@@ -4330,6 +4335,7 @@ void the_game(bool *kill,
std::string &error_message,
ChatBackend &chat_backend,
+ bool *reconnect_requested,
const SubgameSpec &gamespec, // Used for local game
bool simple_singleplayer_mode)
{
@@ -4344,8 +4350,8 @@ void the_game(bool *kill,
try {
if (game.startup(kill, random_input, input, device, map_dir,
- playername, password, &server_address, port,
- error_message, &chat_backend, gamespec,
+ playername, password, &server_address, port, error_message,
+ reconnect_requested, &chat_backend, gamespec,
simple_singleplayer_mode)) {
game.run();
game.shutdown();