diff options
author | Stijn Buys <ingar@osirion.org> | 2008-07-29 19:36:51 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-07-29 19:36:51 +0000 |
commit | ceedc716cb0fe1e0360d2dd9e37a67ff726c4f0b (patch) | |
tree | c09228a09ea78a735c13d371659420fb3e51e754 /src/core/entity.cc | |
parent | 8b356bcd3cab06db7a47f464bffef7a1b62f2d30 (diff) |
first attempt at auto-leveling
Diffstat (limited to 'src/core/entity.cc')
-rw-r--r-- | src/core/entity.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc index 20e34ee..d23959f 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -322,6 +322,7 @@ EntityControlable::EntityControlable(Player *owner, unsigned int flags) : EntityDynamic(flags) { entity_thrust = 0; + entity_autolevel = false; target_direction = 0.0f; target_thrust = 0.0f; @@ -338,6 +339,14 @@ EntityControlable::EntityControlable(std::istream & is) : { unsigned int o; + entity_thrust = 0; + entity_autolevel = false; + + target_direction = 0.0f; + target_thrust = 0.0f; + target_pitch = 0.0f; + target_roll = 0.0f; + is >> entity_thrust; is >> o; @@ -366,6 +375,7 @@ void EntityControlable::serialize_client_update(std::ostream & os) const os << " " << target_pitch; os << " " << target_thrust; os << " " << target_roll; + os << " " << (autolevel() ? 1 : 0); } @@ -376,6 +386,13 @@ void EntityControlable::receive_client_update(std::istream &is) is >> target_pitch; is >> target_thrust; is >> target_roll; + + unsigned int b = 0; + is >> b; + if (b) + entity_autolevel = true; + else + entity_autolevel = true; } void EntityControlable::serialize_server_update(std::ostream & os) const @@ -409,6 +426,13 @@ void EntityControlable::set_thrust(float thrust) } } +void EntityControlable::set_autolevel(bool autolevel) +{ + if (entity_autolevel != autolevel) { + entity_autolevel = autolevel; + entity_dirty = true; + } +} void EntityControlable::set_direction(float direction) { if ((flags() & Static) == Static) |