Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/netconnection.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/core/netconnection.cc b/src/core/netconnection.cc
index ce8fc8c..959f52e 100644
--- a/src/core/netconnection.cc
+++ b/src/core/netconnection.cc
@@ -13,6 +13,7 @@
#include "core/application.h"
#include "core/entity.h"
#include "core/entityglobe.h"
+#include "core/entityprojectile.h"
#include "core/gameconnection.h"
#include "core/netconnection.h"
#include "core/player.h"
@@ -510,7 +511,7 @@ void NetConnection::parse_incoming_message(const std::string & message)
}
}
- if (!entity) {
+ if (!entity) {
switch (type) {
case Entity::Default:
entity = new Entity(msgstream);
@@ -524,6 +525,10 @@ void NetConnection::parse_incoming_message(const std::string & message)
case Entity::Globe:
entity = new EntityGlobe(msgstream);
break;
+ case Entity::Projectile:
+ entity = new EntityProjectile(msgstream);
+ static_cast<EntityProjectile *>(entity)->set_timestamp(application()->timestamp());
+ break;
default:
con_warn << "Received update for unknown entity type " << type << "!" << std::endl;
return;
@@ -579,6 +584,10 @@ void NetConnection::parse_incoming_message(const std::string & message)
case Entity::Globe:
entity = new EntityGlobe(msgstream);
break;
+ case Entity::Projectile:
+ entity = new EntityProjectile(msgstream);
+ static_cast<EntityProjectile *>(entity)->set_timestamp(application()->timestamp());
+ break;
default:
con_warn << "Received create for unknown entity type " << type << "!" << std::endl;
return;
@@ -596,10 +605,12 @@ void NetConnection::parse_incoming_message(const std::string & message)
if (msgstream >> id) {
//con_debug << "Received die entity id " << id << std::endl;
Entity *e = Entity::find(id);
- if (localcontrol() == e)
- localplayer()->set_control(0);
- if (e)
+ if (e) {
+ if (localcontrol() == e) {
+ localplayer()->set_control(0);
+ }
Entity::erase(id);
+ }
}
} else if (command.compare("msg") == 0) {