Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2013-11-09 15:22:44 +0000
committerStijn Buys <ingar@osirion.org>2013-11-09 15:22:44 +0000
commit977a9a68d2465818a331643399a9ecc998d0cbb3 (patch)
tree5e19904a95119ebc22cfffedcf4bd7b2094e4e31 /src/core/entity.cc
parentd0b6e591fbaf3db5fc9898e75913e57a3c32169a (diff)
Bumped network protocol to version 27,
send player reputation and stats from server to client, send entity faction to clients, improved list_entity.
Diffstat (limited to 'src/core/entity.cc')
-rw-r--r--src/core/entity.cc90
1 files changed, 86 insertions, 4 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc
index 4c4c35b..ff780a5 100644
--- a/src/core/entity.cc
+++ b/src/core/entity.cc
@@ -265,8 +265,33 @@ void Entity::print() const
// print header
print_header();
+ // type
+ con_print << " ^Ntype ^B";
+ switch (type()) {
+ case Default:
+ con_print << "entity";
+ break;
+
+ case Dynamic:
+ con_print << "dynamic";
+ break;
+
+ case Controlable:
+ con_print << "controlable";
+ break;
+
+ case Globe:
+ con_print << "globe";
+ break;
+
+ case Projectile:
+ con_print << "projectile";
+ }
+ con_print << std::endl;
+ con_print << " ^Nmodule type ^B" << moduletype() << std::endl;
+
// print entity flags
- con_print << " flags ^B";
+ con_print << " ^Nflags ^B";
if (has_flag(NonSolid)) {
con_print << " nonsolid";
}
@@ -277,17 +302,27 @@ void Entity::print() const
con_print << " dockable";
}
if (has_flag(ShowOnMap)) {
- con_print << " shwonmap";
+ con_print << " shownmap";
}
if (has_flag(KeepAlive)) {
con_print << " keepalive";
}
- con_print << std::endl;
+ con_print << std::endl;
+ if (inventory()) {
+ con_print << " ^Ninventory ^Byes" << std::endl;
+ }
+ if (faction()) {
+ con_print << " ^Nfaction ^B" << faction()->label();
+ }
}
void Entity::print_header() const
{
- con_print << " entity id ^B" << id() << " ^Nlabel ^B" << label() << " ^Nname ^B" << name() << std::endl;
+ con_print << " entity id ^B" << id() << " ^Nlabel ^B" << label() << " ^Nname ^B" << name();
+ if (!zone()) {
+ con_print << " ^Nzone ^B" << zone()->label();
+ }
+ con_print << std::endl;
}
void Entity::print_inventory() const
@@ -427,6 +462,7 @@ void Entity::serialize_server_create(std::ostream & os) const
<< "\"" <<label() << "\" "
<< "\"" << name() << "\" "
<< "\"" << (entity_model ? entity_model->name() : "") << "\" "
+ << (faction() ? faction()->id() : 0) << " "
<< (info() ? info()->id() : 0) << " "
<< (inventory() ? 1 : 0) << " ";
@@ -492,6 +528,15 @@ void Entity::receive_server_create(std::istream &is)
n += c;
set_modelname(n);
+ // read faction id
+ if(is >> o) {
+ entity_faction = Info::find(o);
+ if (o && !entity_faction)
+ entity_faction = new Info(o);
+ } else {
+ entity_faction = 0;
+ }
+
// read info id
if(is >> o) {
entity_info = Info::find(o);
@@ -749,6 +794,43 @@ EntityDynamic::~EntityDynamic()
delete entity_motionstate;
}
+void EntityDynamic::print() const
+{
+ Entity::print();
+
+ con_print << " ^Nstate ^B";
+ switch (state()) {
+ case Normal:
+ con_print << "normal";
+ break;
+
+ case ImpulseInitiate:
+ con_print << "impulseinitiate";
+ break;
+
+ case Impulse:
+ con_print << "impulse";
+ break;
+
+ case JumpInitiate:
+ con_print << "jumpinitiate";
+ break;
+
+ case Jump:
+ con_print << "jump";
+ break;
+
+ case Destroyed:
+ con_print << "destroyed";
+ break;
+
+ case NoPower:
+ con_print << "nopower";
+ break;
+ }
+ con_print << std::endl;
+
+}
void EntityDynamic::set_state(int state)
{
if (this->state() != state) {