Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/gameconnection.cc')
-rw-r--r--src/core/gameconnection.cc19
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();
}