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>2008-02-13 00:40:59 +0000
committerStijn Buys <ingar@osirion.org>2008-02-13 00:40:59 +0000
commit1f95c377b2abfaa454b1f2298af10956d95ad941 (patch)
tree2715cf49a8de16921775eff0dc1ac0ceace145b2 /src/game/game.cc
parent468ab7f566ee493b8c7ff6a95763d99ed2ccc200 (diff)
split client from game module
Diffstat (limited to 'src/game/game.cc')
-rw-r--r--src/game/game.cc50
1 files changed, 36 insertions, 14 deletions
diff --git a/src/game/game.cc b/src/game/game.cc
index 51bb565..25f8926 100644
--- a/src/game/game.cc
+++ b/src/game/game.cc
@@ -4,20 +4,28 @@
the terms of the GNU General Public License version 2
*/
-// project headers
+#include <vector>
+
#include "game/game.h"
#include "game/sector.h"
#include "game/ship.h"
#include "game/star.h"
-#include "filesystem/filesystem.h"
+#include "core/entity.h"
#include "sys/sys.h"
-
-// C++ headers
-#include <vector>
+#include "math/mathlib.h"
+#include "filesystem/filesystem.h"
namespace game
{
+Game::Game()
+{
+}
+
+Game::~Game()
+{
+}
+
bool Game::init()
{
using math::Vector3f;
@@ -102,11 +110,6 @@ bool Game::init()
star->location = Vector3f(256.0f, 0.0f, 256.0f);
star->label = "star: Sabishi Hoshi";
-
- ship = new Ship();
- ship->location = Vector3f(0,0,0);
- ship->label = "ship: Micron Vector";
-
core::Entity *cube = new core::Entity(core::entity::Solid & core::entity::Static);
cube->core_shape = core::entity::Cube;
cube->core_color = Color(0.0f, 0.8f, 0.0f);
@@ -151,7 +154,7 @@ void Game::shutdown()
void Game::frame(float seconds)
{
- ship->update(seconds);
+
}
void Game::event_join(core::Player *player)
@@ -160,8 +163,27 @@ void Game::event_join(core::Player *player)
return;
ship = new Ship();
- ship->location = Vector3f(0,0,0);
- ship->label = "ship: Micron Vector";
+ ship->location = math::Vector3f(0,0,0);
+ ship->label = "ship: <"+player->name+"> Micron Vector";
+ ship->owner = player;
+
+ player->controled = ship;
+
+ con_print << player->name << " joins" << std::endl;
}
-}; // namespace game
+void Game::event_leave(core::Player *player)
+{
+ if (!player)
+ return;
+
+ con_print << player->name << " leaves" << std::endl;
+
+ if (player->controled) {
+ // player only has one ship for now
+ core::entity::remove(player->controled->id);
+ }
+}
+
+} // namespace game
+