diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/application.cc | 15 | ||||
-rw-r--r-- | src/core/application.h | 12 | ||||
-rw-r--r-- | src/core/gameinterface.cc | 1 | ||||
-rw-r--r-- | src/core/gameserver.cc | 6 | ||||
-rw-r--r-- | src/core/netconnection.cc | 5 | ||||
-rw-r--r-- | src/core/netserver.cc | 5 |
6 files changed, 21 insertions, 23 deletions
diff --git a/src/core/application.cc b/src/core/application.cc index 3b30962..db4f338 100644 --- a/src/core/application.cc +++ b/src/core/application.cc @@ -371,7 +371,6 @@ void Application::disconnect() notify_disconnect(); delete application_game; application_game = 0; - notify_zoneclear(0); con_print << "^BDisconnected.\n"; } } @@ -524,13 +523,7 @@ void Application::notify_sound(const char *name) // Dedicated servers don't need sounds } -void Application::notify_remove_sound(size_t source) -{ - // the default implementation does nothing. - // Dedicated servers don't need sounds -} - -void Application::notify_zoneclear(Zone *zone) +void Application::notify_zonechange() { // the default implementation does nothing. // The client uses this to clear old zones @@ -547,4 +540,10 @@ void Application::notify_connect() { } +void Application::notify_remove_sound(size_t source) +{ + // the default implementation does nothing. + // Dedicated servers don't need sounds +} + } diff --git a/src/core/application.h b/src/core/application.h index 9ac82f7..e55c37f 100644 --- a/src/core/application.h +++ b/src/core/application.h @@ -69,18 +69,18 @@ public: /// text notifications from the core to the application virtual void notify_message(Message::Channel const channel, std::string const message); - /// remove sound source notification - virtual void notify_remove_sound(size_t source); - - /// zone clear notification - virtual void notify_zoneclear(Zone *zone); - /// connect notification virtual void notify_connect(); /// disconnect notification virtual void notify_disconnect(); + /// zone change notification + virtual void notify_zonechange(); + + /// remove sound source notification + virtual void notify_remove_sound(size_t source); + /*----- static --------------------------------------------------- */ /// a pointer to the current application instance diff --git a/src/core/gameinterface.cc b/src/core/gameinterface.cc index 1ea3b55..74acced 100644 --- a/src/core/gameinterface.cc +++ b/src/core/gameinterface.cc @@ -82,7 +82,6 @@ void GameInterface::clear() // remove all zones for (Zone::Registry::iterator it = Zone::registry().begin(); it != Zone::registry().end(); it++) { Zone *zone = (*it).second; - application()->notify_zoneclear(zone); delete zone; } Zone::registry().clear(); diff --git a/src/core/gameserver.cc b/src/core/gameserver.cc index b6767ad..46c3624 100644 --- a/src/core/gameserver.cc +++ b/src/core/gameserver.cc @@ -622,7 +622,6 @@ void GameServer::frame(float seconds) if (server_network) { // send network updates server_network->frame(server_time, server_previoustime); - } // mark all entities as updated @@ -639,6 +638,11 @@ void GameServer::frame(float seconds) } } + if (localplayer()->zonechange()) { + application()->notify_zonechange(); + localplayer()->player_zonechange = false; + } + if (!Cvar::sv_dedicated->value()) { update_clientstate(0); } diff --git a/src/core/netconnection.cc b/src/core/netconnection.cc index 9268447..ae1118f 100644 --- a/src/core/netconnection.cc +++ b/src/core/netconnection.cc @@ -557,7 +557,7 @@ void NetConnection::parse_incoming_message(const std::string & message) if (connection()->localplayer()->zonechange() && oldzone && (oldzone != connection()->localplayer()->zone())) { // notify the applciation to clear none-core zone assets (textures etc) - application()->notify_zoneclear(oldzone); + application()->notify_zonechange(); // delete all entities in the old zone for (Entity::Registry::iterator it=Entity::registry().begin(); it != Entity::registry().end(); ) { @@ -573,7 +573,8 @@ void NetConnection::parse_incoming_message(const std::string & message) oldzone->content().clear(); } } else { - // FIXME find player + // find player + // FIXME player might be localplayer() Player *player = 0; for (GameInterface::Players::iterator it = game()->players().begin(); it != game()->players().end() && !player; it++) { if( (*it)->id() == player_id) { diff --git a/src/core/netserver.cc b/src/core/netserver.cc index e1bd41a..95b047a 100644 --- a/src/core/netserver.cc +++ b/src/core/netserver.cc @@ -364,10 +364,6 @@ void NetServer::client_frame(NetClient *client, float timestamp, float previoust void NetServer::frame(float timestamp, float previoustimestamp) { /* FIXME - This code has to be rewritten to send per-player updates. - Players should only receive updates from their current zone - Fix zonechange events - Only entities within visual range should send updates (1024 game units?) Fix reliable messages It would be nice if players with the highest ping got their updates first @@ -390,7 +386,6 @@ void NetServer::frame(float timestamp, float previoustimestamp) client->player()->player_dirty = false; client->player()->player_zonechange = false; } - client->transmit(fd()); } } |