diff options
author | Stijn Buys <ingar@osirion.org> | 2009-01-11 16:51:21 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2009-01-11 16:51:21 +0000 |
commit | 01a803bec48b1377d2714bce819fb2544eeeb44b (patch) | |
tree | 915a70eb23ea4f15f0a1293b2bdf5e594a10578a /src/core | |
parent | 20e8e4c0fb1262a25c2491679da4587d264208a2 (diff) |
initial loader frame
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/application.cc | 13 | ||||
-rw-r--r-- | src/core/application.h | 3 | ||||
-rw-r--r-- | src/core/netconnection.cc | 6 |
3 files changed, 16 insertions, 6 deletions
diff --git a/src/core/application.cc b/src/core/application.cc index 1cba59a..be86dd6 100644 --- a/src/core/application.cc +++ b/src/core/application.cc @@ -270,20 +270,19 @@ void Application::connect(std::string const &host) } if (host.size()) { + notify_connect(); application_game = new GameConnection(host); if (!application_game->running()) { delete application_game; application_game = 0; - } else { - notify_connect(); } } else { + notify_connect(); application_game = new GameServer(); if (application_game->running()) { - con_print << "^BConnected to local game.\n"; - notify_connect(); + con_print << "^BConnected to local game.\n"; } else { delete application_game; application_game = 0; @@ -444,6 +443,12 @@ void Application::notify_message(const core::Message::Channel channel, const std con_print << message << std::endl; } +void Application::notify_loader(const std::string &message) +{ + // the default implementation does nothing. + // used by the client to udpate the loader screen +} + void Application::notify_sound(const char *name) { // the default implementation does nothing. diff --git a/src/core/application.h b/src/core/application.h index 45c316f..7e41869 100644 --- a/src/core/application.h +++ b/src/core/application.h @@ -72,6 +72,9 @@ public: /// text notifications from the core to the application virtual void notify_message(const core::Message::Channel channel, const std::string &message); + /// loading message notification + virtual void notify_loader(const std::string &message); + /// connect notification virtual void notify_connect(); diff --git a/src/core/netconnection.cc b/src/core/netconnection.cc index 790b037..eb9ad53 100644 --- a/src/core/netconnection.cc +++ b/src/core/netconnection.cc @@ -94,8 +94,10 @@ void NetConnection::connect(std::string const &to_host, int to_port) connection_state = Pending; game()->localplayer()->set_dirty(); - - con_print << "Connecting to " << inet_ntoa(*((struct in_addr *)serverhostent->h_addr)) << ":" << to_port << "..." << std::endl; + std::stringstream str; + str << "Connecting to " << inet_ntoa(*((struct in_addr *)serverhostent->h_addr)) << ":" << to_port << "..."; + con_print << str.str() << std::endl; + application()->notify_loader(str.str()); } void NetConnection::disconnect() |