diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/game.cc | 8 | ||||
-rw-r--r-- | src/game/ship.cc | 4 | ||||
-rw-r--r-- | src/game/ship.h | 2 |
3 files changed, 10 insertions, 4 deletions
diff --git a/src/game/game.cc b/src/game/game.cc index 311a696..a76d5e7 100644 --- a/src/game/game.cc +++ b/src/game/game.cc @@ -30,6 +30,8 @@ void func_join(core::Player *player, std::string const &args) std::string message(player->name()); message.append(" joins the game."); core::server()->broadcast(message); + + player->player_dirty = true; } /// a player joins the spectators @@ -44,9 +46,11 @@ void func_spectate(core::Player *player, std::string const &args) if (player->control) { // player has only ship for now - core::Entity::remove(player->control->id()); + player->control->die(); player->control = 0; } + + player->player_dirty = true; } /*----- Game ------------------------------------------------------ */ @@ -136,7 +140,7 @@ void Game::player_disconnect(core::Player *player) { if (player->control) { // player has only one ship for now - core::Entity::remove(player->control->id()); + player->control->die(); player->control = 0; } } diff --git a/src/game/ship.cc b/src/game/ship.cc index e6fcaeb..1bcdfbf 100644 --- a/src/game/ship.cc +++ b/src/game/ship.cc @@ -20,7 +20,7 @@ namespace game { Ship::Ship(core::Player *owner) : core::EntityControlable(owner, ship_enttype) { - // etnity properties + // entity properties entity_name = "ship: <" + owner->name() + "> Micron Vector"; entity_owner = owner; @@ -62,6 +62,8 @@ void Ship::frame(float seconds) // location TODO avoid sin/cos calculations entity_location.x += cosf(entity_direction * M_PI / 180) * entity_speed * seconds; entity_location.z -= sinf(entity_direction * M_PI / 180) * entity_speed * seconds; + + entity_dirty = true; } } // namespace game diff --git a/src/game/ship.h b/src/game/ship.h index 2897d6c..1d0fdd4 100644 --- a/src/game/ship.h +++ b/src/game/ship.h @@ -21,7 +21,7 @@ public: ~Ship(); /// update the ship state - void frame(float seconds); + virtual void frame(float seconds); /* -- Ship SPECS --*/ /// acceleration |