Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2012-11-25 21:26:52 +0000
committerStijn Buys <ingar@osirion.org>2012-11-25 21:26:52 +0000
commitc7ce266051705c68f3440bcc5a83833536b2b7ca (patch)
tree7c47b5d8e2e40c7b7777a71aa98fb6c4b057fc07 /src/core
parentd932627a498f8315d348c48e809779e8215563c4 (diff)
Receive network entity create messages for projectiles.
Diffstat (limited to 'src/core')
-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) {