diff options
author | Stijn Buys <ingar@osirion.org> | 2008-02-16 12:22:33 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-02-16 12:22:33 +0000 |
commit | d6ee7ec642cc6b3097c8d321a1a00630e24027d1 (patch) | |
tree | 35f56e5168cc3e12724898b9efb81b4b2938f575 /src/core/core.cc | |
parent | 715d0c3952a3a1d59b64074e472d0a9a3b414351 (diff) |
initial client-to-server connection
Diffstat (limited to 'src/core/core.cc')
-rw-r--r-- | src/core/core.cc | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/src/core/core.cc b/src/core/core.cc index e7aecaf..b1083a8 100644 --- a/src/core/core.cc +++ b/src/core/core.cc @@ -4,7 +4,12 @@ the terms of the GNU General Public License version 2. */ +#include <iostream> +#include <sstream> + #include "core/core.h" +#include "core/netclient.h" + namespace core { @@ -19,15 +24,35 @@ Application *application() return Application::instance(); } -bool connected() + +void net_broadcast(std::ostringstream &osstream, int ignoreplayer) { - return (GameInterface::instance() && GameInterface::instance()->connected); + if (!application()->netserver) + return; + + application()->netserver->broadcast(osstream, ignoreplayer); } -float time() +void net_send(Player &player, std::ostringstream &osstream) { - return Application::instance()->current_time; + if (!application()->netserver) + return; + + NetClient *client = application()->netserver->find_client(player); + if (client) + application()->netserver->send(client, osstream); } + +void net_send(Player &player, std::string message) +{ + if (!application()->netserver) + return; + + NetClient *client = application()->netserver->find_client(player); + if (client) + application()->netserver->send(client, message); } + +} |