From d94b36ae1953bc0d94df6ea1d3bde2f3f94e376b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 28 Mar 2009 02:04:53 -0400 Subject: Move arena and world down to Client --- sigencore/Client.cpp | 31 ++++++++++++++++++++++++++++++- sigencore/Client.h | 13 +++++++++++++ sigencore/Player.cpp | 16 ++-------------- sigencore/Player.h | 8 -------- 4 files changed, 45 insertions(+), 23 deletions(-) (limited to 'sigencore') diff --git a/sigencore/Client.cpp b/sigencore/Client.cpp index a176a335..5cbbca9b 100644 --- a/sigencore/Client.cpp +++ b/sigencore/Client.cpp @@ -23,7 +23,10 @@ using namespace Sigencore; Client::Client(GameWrapper* game, Config* parent) : Config(parent), - m_game(game) + m_game(game), + m_arena(NULL), + m_world(NULL), + m_canvas(NULL) { } @@ -31,6 +34,11 @@ Client::~Client() { } +Arena* Client::arena() +{ + return m_arena; +} + bool Client::enterArena(Arena* arena) { m_arena = arena; @@ -41,3 +49,24 @@ void Client::exitArena() { m_arena = NULL; } + +Overworld* Client::world() +{ + return m_world; +} + +bool Client::enterWorld(Overworld* world) +{ + m_world = world; + return true; +} + +void Client::exitWorld() +{ + m_world = NULL; +} + +Canvas* Client::canvas() +{ + return m_canvas; +} diff --git a/sigencore/Client.h b/sigencore/Client.h index d33c4ce0..058037c4 100644 --- a/sigencore/Client.h +++ b/sigencore/Client.h @@ -33,12 +33,22 @@ class GameWrapper; namespace Sigencore { class Arena; +class Canvas; +class Overworld; class SIGENCORE_EXPORT Client : public Sigscript::Config { Q_OBJECT public: + Q_SCRIPTABLE Arena* arena(); + + Q_SCRIPTABLE Overworld* world(); + + Q_SCRIPTABLE Canvas* canvas(); + public slots: + virtual bool enterWorld(Overworld* world); + virtual void exitWorld(); virtual bool enterArena(Arena* arena); virtual void exitArena(); @@ -48,6 +58,9 @@ class SIGENCORE_EXPORT Client : public Sigscript::Config Sigscript::GameWrapper* m_game; Arena* m_arena; + Overworld* m_world; + Canvas* m_canvas; + Client* m_client; }; } diff --git a/sigencore/Player.cpp b/sigencore/Player.cpp index 85787936..ebd9c7b4 100644 --- a/sigencore/Player.cpp +++ b/sigencore/Player.cpp @@ -32,8 +32,6 @@ using namespace Sigencore; Player::Player(GameWrapper* game, Config* parent) : Client(game, parent), - m_world(NULL), - m_arena(NULL), m_team(new Team(game, this)), m_money(0) { @@ -43,24 +41,14 @@ Player::~Player() { } -Overworld* Player::world() const -{ - return m_world; -} - bool Player::enterWorld(Overworld* world) { - // TODO + return Client::enterWorld(world); } void Player::exitWorld() { - // TODO -} - -Arena* Player::arena() const -{ - return m_arena; + Client::exitWorld(); } bool Player::enterArena(Arena* arena) diff --git a/sigencore/Player.h b/sigencore/Player.h index 9e8de7ab..3ae9de78 100644 --- a/sigencore/Player.h +++ b/sigencore/Player.h @@ -34,8 +34,6 @@ class ItemWrapper; namespace Sigencore { -class Arena; -class Overworld; class Team; class SIGENCORE_EXPORT Player : public Client @@ -46,10 +44,6 @@ class SIGENCORE_EXPORT Player : public Client Player(Sigscript::GameWrapper* game, Sigscript::Config* parent); virtual ~Player(); - Q_SCRIPTABLE Overworld* world() const; - - Q_SCRIPTABLE Arena* arena() const; - Q_SCRIPTABLE Team* team() const; Q_SCRIPTABLE TeamMember* findMember(const QUuid& id) const; Q_SCRIPTABLE QList active() const; @@ -83,8 +77,6 @@ class SIGENCORE_EXPORT Player : public Client void moneyChanged(const int money); protected: - Overworld* m_world; - Arena* m_arena; Team* m_team; QList m_active; QMap m_items; -- cgit