summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tileweb.h
diff options
context:
space:
mode:
authorFlorian Diebold <flodiebold@gmail.com>2012-08-06 21:23:45 +0200
committerFlorian Diebold <flodiebold@gmail.com>2012-11-23 21:28:19 +0100
commita0a7e10f134f679b1617787a29a8dfa1811d8be1 (patch)
tree151baa3bbb14f373de45f4e9c1a488ee3bf8caf2 /crawl-ref/source/tileweb.h
parente000f41b8842cce11f3057116ed5430a1e216dc9 (diff)
downloadcrawl-ref-a0a7e10f134f679b1617787a29a8dfa1811d8be1.tar.gz
crawl-ref-a0a7e10f134f679b1617787a29a8dfa1811d8be1.zip
Send player stats to the webtiles client.
Not yet used on the client side.
Diffstat (limited to 'crawl-ref/source/tileweb.h')
-rw-r--r--crawl-ref/source/tileweb.h53
1 files changed, 52 insertions, 1 deletions
diff --git a/crawl-ref/source/tileweb.h b/crawl-ref/source/tileweb.h
index b49a2ad143..61eeef8a3d 100644
--- a/crawl-ref/source/tileweb.h
+++ b/crawl-ref/source/tileweb.h
@@ -7,6 +7,7 @@
#define TILEWEB_H
#include "externs.h"
+#include "status.h"
#include "tileweb-text.h"
#include "tiledoll.h"
#include "viewgeom.h"
@@ -31,6 +32,41 @@ enum WebtilesUIState
UI_VIEW_MAP,
};
+struct player_info
+{
+ std::string name;
+ std::string job_title;
+ bool wizard;
+ std::string species;
+ std::string god;
+ bool under_penance;
+ uint8_t piety_rank;
+
+ int hp, hp_max, real_hp_max;
+ int mp, mp_max;
+
+ int armour_class;
+ int evasion;
+ int shield_class;
+
+ int8_t strength, strength_max;
+ int8_t intel, intel_max;
+ int8_t dex, dex_max;
+
+ int experience_level;
+ int8_t exp_progress;
+ int gold;
+ int zot_points;
+ int elapsed_time;
+ int lives, deaths;
+
+ std::string place;
+ int depth;
+ coord_def position;
+
+ std::vector<status_info> status;
+};
+
class TilesFramework
{
public:
@@ -221,6 +257,8 @@ protected:
dolls_data last_player_doll;
+ player_info m_current_player_info;
+
void _send_version();
void _send_everything();
@@ -234,7 +272,20 @@ protected:
void _send_monster(const coord_def &gc, const monster_info* m,
map<uint32_t, coord_def>& new_monster_locs,
bool force_full);
- void _send_player();
+ void _send_player(bool force_full = false);
+
+ void _update_string(bool force, std::string& current,
+ const std::string& next,
+ const std::string& name);
+ template<class T> void _update_int(bool force, T& current, T next,
+ const std::string& name)
+ {
+ if (force || (current != next))
+ {
+ json_write_int(name, next);
+ current = next;
+ }
+ }
};
// Main interface for tiles functions