Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-02-19 17:37:01 +0000
committerStijn Buys <ingar@osirion.org>2008-02-19 17:37:01 +0000
commit41ad1e4c9e2a70d0a8811f4b035f0d3018045e61 (patch)
treeabe7fa4544c22ba0cfa6375fd56f2e596f1bf626 /src/core/application.cc
parent7daaf66869b7b9f85f71b1aa5e9a1b4c40710f33 (diff)
client-to-server connection
Diffstat (limited to 'src/core/application.cc')
-rw-r--r--src/core/application.cc42
1 files changed, 9 insertions, 33 deletions
diff --git a/src/core/application.cc b/src/core/application.cc
index 9c7620a..a95bd22 100644
--- a/src/core/application.cc
+++ b/src/core/application.cc
@@ -18,6 +18,7 @@
#include "core/cvar.h"
#include "core/entity.h"
#include "core/func.h"
+#include "core/gameconnection.h"
#include "core/gameserver.h"
namespace core
@@ -211,47 +212,30 @@ void Application::connect(std::string const &host)
return;
}
-
if (application_game) {
delete application_game;
application_game = 0;
}
if (host.size()) {
- /*
- // connect to remote core
- core::GameInterface::gameinterface_instance = 0;
- std::string remotehost(host);
- size_t found = remotehost.find(':');
- unsigned int port = 8042;
- if (found != std::string::npos) {
- std::istringstream str(remotehost.substr(found+1));
- if (str >> port) {
- remotehost.erase(found, std::string::npos);
- } else {
- con_print << "Invalid hostname '" << remotehost << "'\n";
- return;
- }
- }
- netconnection.connect(remotehost, port);
+ application_game = new GameConnection(host);
- if (netconnection.connected()) {
- con_print << "Connected.\n";
+ if (application_game->running()) {
+ con_print << "Connected to '" << host << "'\n";
} else {
- netconnection.disconnect();
- con_warn << "Could not connect to '" << host << "'\n";
+ delete application_game;
+ application_game = 0;
+ con_warn << "Could not connect to '" << host << "'!\n";
}
- */
- con_warn << "Can not connect to remote core.... yet!\n";
} else {
application_game = new GameServer();
if (application_game->running()) {
- con_print << "Connected.\n";
+ con_print << "Connected to local game.\n";
} else {
delete application_game;
application_game = 0;
- con_warn << "Could not connect.\n";
+ con_warn << "Could not connect to local game!\n";
}
}
}
@@ -264,14 +248,6 @@ void Application::disconnect()
application_game = 0;
con_print << "Disconnected.\n";
}
-
- /*
- if (netconnection.connected()) {
- netconnection.disconnect();
- con_print << "Disconnected.\n";
- return;
- }
- */
}
void Application::frame(float seconds)