1 #ifndef simpeople_h 2 #define simpeople_h 3 4 #include "simroadtraffic.h" 5 6 class pedestrian_desc_t; 7 8 /** 9 * Pedestrians also are road users. 10 * 11 * @author Hj. Malthaner 12 * @see road_user_t 13 */ 14 class pedestrian_t : public road_user_t 15 { 16 private: 17 static stringhashtable_tpl<const pedestrian_desc_t *> table; 18 19 private: 20 const pedestrian_desc_t *desc; 21 uint16 animation_steps; 22 23 uint16 steps_offset; 24 uint16 ped_offset; 25 bool on_left; 26 27 bool list_empty(); 28 29 protected: 30 void rdwr(loadsave_t *file) OVERRIDE; 31 32 void calc_image() OVERRIDE; 33 34 /** 35 * Creates pedestrian at position given by @p gr. 36 * Does not add pedestrian to the tile! 37 */ 38 pedestrian_t(grund_t *gr); 39 40 public: 41 pedestrian_t(loadsave_t *file); 42 43 virtual ~pedestrian_t(); 44 get_desc()45 const pedestrian_desc_t *get_desc() const { return desc; } 46 get_name()47 const char *get_name() const OVERRIDE {return "Fussgaenger";} get_typ()48 typ get_typ() const OVERRIDE { return pedestrian; } 49 50 void info(cbuffer_t & buf) const OVERRIDE; 51 52 sync_result sync_step(uint32 delta_t) OVERRIDE; 53 54 ///@ returns true if pedestrian walks on the left side of the road is_on_left()55 bool is_on_left() const { return on_left; } 56 57 void calc_disp_lane(); 58 59 void rotate90() OVERRIDE; 60 61 // overloaded to enable animations 62 image_id get_image() const OVERRIDE; 63 64 void get_screen_offset( int &xoff, int &yoff, const sint16 raster_width ) const OVERRIDE; 65 66 grund_t* hop_check() OVERRIDE; 67 void hop(grund_t* gr) OVERRIDE; 68 69 // class register functions 70 static bool register_desc(const pedestrian_desc_t *desc); 71 static bool successfully_loaded(); 72 73 static void generate_pedestrians_at(koord3d k, int &count); 74 75 static void build_timeline_list( karte_t *welt ); 76 }; 77 78 #endif 79