summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_client.cpp9
-rw-r--r--src/network/network_client.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index 2d75353df..9bf8ec0b4 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -463,6 +463,15 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendMove(CompanyID company, co
return NETWORK_RECV_STATUS_OKAY;
}
+/**
+ * Check whether the client is actually connected (and in the game).
+ * @return True when the client is connected.
+ */
+bool ClientNetworkGameSocketHandler::IsConnected()
+{
+ return my_client != NULL && my_client->status == STATUS_ACTIVE;
+}
+
/***********
* Receiving functions
diff --git a/src/network/network_client.h b/src/network/network_client.h
index 096544156..c1ded6035 100644
--- a/src/network/network_client.h
+++ b/src/network/network_client.h
@@ -100,6 +100,8 @@ public:
static NetworkRecvStatus SendRCon(const char *password, const char *command);
static NetworkRecvStatus SendMove(CompanyID company, const char *password);
+ static bool IsConnected();
+
static void Send();
static bool Receive();
static bool GameLoop();