Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-02-21 19:06:15 +0000
committerStijn Buys <ingar@osirion.org>2008-02-21 19:06:15 +0000
commit8aa04fc836116a58f8ffd1e0c3539b9ea8a94ddf (patch)
treebb933edb3919ed67d05b098a6b97a73f01746762 /src/game
parent41ad1e4c9e2a70d0a8811f4b035f0d3018045e61 (diff)
dedicated server, entity transfer
Diffstat (limited to 'src/game')
-rw-r--r--src/game/game.cc8
-rw-r--r--src/game/ship.cc4
-rw-r--r--src/game/ship.h2
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