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-12-25 12:13:56 +0000
committerStijn Buys <ingar@osirion.org>2008-12-25 12:13:56 +0000
commitbfa10f9990a8a045b03474d11af75984c12a856a (patch)
tree87ff30329be78b8012d545b097b669b746ab0fc0 /src/core/player.h
parent164e3c5b1cd9e6d6f7ca26964df4c54394eb1c84 (diff)
Improved list_zone, list_ships
Ship price and cargo size
Diffstat (limited to 'src/core/player.h')
-rw-r--r--src/core/player.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/core/player.h b/src/core/player.h
index 620f086..ecb9ea3 100644
--- a/src/core/player.h
+++ b/src/core/player.h
@@ -35,13 +35,13 @@ public:
/*----- inspectors ------------------------------------------------ */
/// id of the player
- inline int id() const { return player_id; }
+ inline const int id() const { return player_id; }
/// name of the player
- inline std::string const &name() const { return player_name; }
+ inline const std::string & name() const { return player_name; }
/// dirty flag
- inline bool dirty() const { return player_dirty; }
+ inline const bool dirty() const { return player_dirty; }
/// the entity the Player is currently controling
inline EntityControlable *control() const { return player_control; }
@@ -57,16 +57,16 @@ public:
/// set the zone the player is currently in
void set_zone(Zone *zone);
- inline bool zonechange() const { return player_zonechange; }
+ inline const bool zonechange() const { return player_zonechange; }
/// player primary color
- inline math::Color const & color() const { return player_color; }
+ inline const math::Color & color() const { return player_color; }
/// player secondary color
- inline math::Color const & color_second() const { return player_color_second; }
+ inline const math::Color & color_second() const { return player_color_second; }
/// player has been muted by admin or console
- inline bool mute() const { return player_mute; }
+ inline const bool mute() const { return player_mute; }
inline const std::string &rconpassword() const { return player_rconpassword; }
@@ -76,6 +76,12 @@ public:
/// view
inline Entity *view() { return player_view; }
+ /// credits
+ inline long credits() const { return player_credits; }
+
+ /// returns true of the player has enough credits to pay amount
+ inline bool has_credits(unsigned amount) const { return (player_credits >= amount); }
+
/*----- messages -------------------------------------------------- */
void send(const std::string name);
@@ -120,8 +126,13 @@ public:
void set_view(Entity *view);
+ void set_credits(long amount);
+
+ void add_credits(long amount);
+
inline void set_dirty() { player_dirty = true; }
+
/* -- should actually not be public --*/
/// dirty state
@@ -159,7 +170,7 @@ private:
// the zone the player is currently in
Zone *player_zone;
- float player_credits;
+ long player_credits;
std::string player_rconpassword;
};