diff options
Diffstat (limited to 'src/core/application.cc')
-rw-r--r-- | src/core/application.cc | 42 |
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) |