diff options
author | Stijn Buys <ingar@osirion.org> | 2008-02-21 21:01:17 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-02-21 21:01:17 +0000 |
commit | 71b6b902732bfc0c53033d58f91a6b1e70e8371f (patch) | |
tree | 0ff75879667ff985c9d69f8057727f6c805ad8b4 /src/core/gameconnection.cc | |
parent | 8aa04fc836116a58f8ffd1e0c3539b9ea8a94ddf (diff) |
more minor updates
Diffstat (limited to 'src/core/gameconnection.cc')
-rw-r--r-- | src/core/gameconnection.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/core/gameconnection.cc b/src/core/gameconnection.cc index eeb4692..07a27a6 100644 --- a/src/core/gameconnection.cc +++ b/src/core/gameconnection.cc @@ -93,22 +93,31 @@ void GameConnection::frame(float seconds) if (core::Cvar::sv_framerate->value()) { connection_frametime += seconds; f = 1.0f / core::Cvar::sv_framerate->value(); - if (connection_frametime < f) + if (connection_frametime < f) { + // run client prediction + std::map<unsigned int, Entity *>::iterator it; + for (it=Entity::registry.begin(); it != Entity::registry.end(); it++) { + Entity *entity = (*it).second; + if ((entity->type() == Entity::Controlable) || (entity->type() == Entity::Dynamic)) { + entity->frame(seconds); + } + } return; + } } else { connection_frametime = seconds; } connection_network->frame(connection_frametime); - if (localplayer()->control && localplayer()->control->dirty()) { + if (localcontrol() && localcontrol()->dirty()) { std::ostringstream netmsg; - netmsg << "cup " << localplayer()->control->id() << " "; - localplayer()->control->serialize_client_update(netmsg); + netmsg << "cup " << localcontrol()->id() << " "; + localcontrol()->serialize_client_update(netmsg); netmsg << "\n"; connection_network->send(netmsg.str()); - localplayer()->control->entity_dirty = false; + localcontrol()->entity_dirty = false; //con_debug << netmsg.str(); } |