ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/player.h
(Generate patch)

Comparing deliantra/server/include/player.h (file contents):
Revision 1.42 by pippijn, Sat Jan 6 14:42:30 2007 UTC vs.
Revision 1.43 by root, Sun Jan 7 02:39:14 2007 UTC

107 107
108 sint64 ACC (RW, total_exp); 108 sint64 ACC (RW, total_exp);
109 uint32 ACC (RW, kills); 109 uint32 ACC (RW, kills);
110}; 110};
111 111
112#define for_all_players(var) for (player *var = first_player; var; var = var->next)
113
114INTERFACE_CLASS (player) 112INTERFACE_CLASS (player)
115struct player : zero_initialised, attachable 113struct player : zero_initialised, attachable
116{ 114{
117 player *ACC (RW, next); /* Pointer to next player, NULL if this is last */
118 client_ptr ACC (RO, ns); /* Socket information for this player */ 115 client *ACC (RO, ns); /* Socket information for this player */
119 object_ptr ACC (RW, ob); /* The object representing the player */ 116 object *ACC (RW, ob); /* The object representing the player */
117 int ACC (RO, active);
118
120 rangetype ACC (RW, shoottype); /* Which range-attack is being used by player */ 119 rangetype ACC (RW, shoottype); /* Which range-attack is being used by player */
121 bowtype_t ACC (RW, bowtype); /* which firemode? */ 120 bowtype_t ACC (RW, bowtype); /* which firemode? */
122 petmode_t ACC (RW, petmode); /* which petmode? */ 121 petmode_t ACC (RW, petmode); /* which petmode? */
123 object_ptr ACC (RW, ranges[range_size]); /* object for each range. Set up in fix player. Note */ 122 object_ptr ACC (RW, ranges[range_size]); /* object for each range. Set up in fix player. Note */
124 /* That not all are used, it is just nice to map this 1:1 */ 123 /* That not all are used, it is just nice to map this 1:1 */
125 /* With the range names */ 124 /* With the range names */
126 usekeytype ACC (RW, usekeys); /* Method for finding keys for doors */ 125 usekeytype ACC (RW, usekeys); /* Method for finding keys for doors */
127 unapplymode ACC (RW, unapply); /* Method for auto unapply */ 126 unapplymode ACC (RW, unapply); /* Method for auto unapply */
128 uint32 ACC (RW, count); /* Any numbers typed before a command */ 127 uint32 ACC (RW, count); /* Any numbers typed before a command */
129 uint32 ACC (RW, mode); /* Mode of player for pickup. */ 128 uint32 ACC (RW, mode); /* Mode of player for pickup. */
130 129
136 sint16 ACC (RW, item_power); /* Total item power of objects equipped */ 135 sint16 ACC (RW, item_power); /* Total item power of objects equipped */
137 uint8 ACC (RW, listening); /* Which priority will be used in info_all */ 136 uint8 ACC (RW, listening); /* Which priority will be used in info_all */
138 sint8 ACC (RW, last_level); /* Last level we sent to client */ 137 sint8 ACC (RW, last_level); /* Last level we sent to client */
139 138
140 /* Try to put all the bitfields together - saves some small amount of memory */ 139 /* Try to put all the bitfields together - saves some small amount of memory */
141 bool ACC (RO, braced); /* Will not move if braced, only attack */ 140 bool ACC (RW, braced); /* Will not move if braced, only attack */
142 bool ACC (RO, tmp_invis); /* Will invis go away when we attack ? */ 141 bool ACC (RW, tmp_invis); /* Will invis go away when we attack ? */
143 bool ACC (RO, do_los); /* If true, need to call update_los() in draw(), and clear */ 142 bool ACC (RW, do_los); /* If true, need to call update_los() in draw(), and clear */
144 bool ACC (RO, fire_on); /* Player should fire object, not move */ 143 bool ACC (RW, fire_on); /* Player should fire object, not move */
145 bool ACC (RO, run_on); /* Player should keep moving in dir until run is off */ 144 bool ACC (RW, run_on); /* Player should keep moving in dir until run is off */
146 bool ACC (RO, has_hit); /* If set, weapon_sp instead of speed will count */ 145 bool ACC (RW, has_hit); /* If set, weapon_sp instead of speed will count */
147 bool ACC (RO, peaceful); /* If set, won't attack friendly creatures */ 146 bool ACC (RW, peaceful); /* If set, won't attack friendly creatures */
148 bool ACC (RO, hidden); /* If True, player (DM) is hidden from view */ 147 bool ACC (RW, hidden); /* If True, player (DM) is hidden from view */
149 bool ACC (RO, explore); /* if True, player is in explore mode */
150 148
151 object_ptr last_skill_ob[NUM_SKILLS]; /* the exp object */ 149 object_ptr last_skill_ob[NUM_SKILLS]; /* the exp object */
152 sint64 last_skill_exp[NUM_SKILLS]; /* shadow register. if != exp. obj update client */ 150 sint64 last_skill_exp[NUM_SKILLS]; /* shadow register. if != exp. obj update client */
153 151
154 float ACC (RW, weapon_sp); /* Penalties to speed when fighting w speed >ws/10 */ 152 float ACC (RW, weapon_sp); /* Penalties to speed when fighting w speed >ws/10 */
201 sint8 blocked_los[MAP_CLIENT_X][MAP_CLIENT_Y]; /* array showing what spaces */ 199 sint8 blocked_los[MAP_CLIENT_X][MAP_CLIENT_Y]; /* array showing what spaces */
202 /* the player can see. For maps smaller than */ 200 /* the player can see. For maps smaller than */
203 /* MAP_CLIENT_.., the upper left is used */ 201 /* MAP_CLIENT_.., the upper left is used */
204 202
205 shstr ACC (RW, invis_race); /* What race invisible to? */ 203 shstr ACC (RW, invis_race); /* What race invisible to? */
206 bool ACC (RW, enable_save);
207 Output_Buf outputs[NUM_OUTPUT_BUFS]; /* holds output strings to client */ 204 Output_Buf outputs[NUM_OUTPUT_BUFS]; /* holds output strings to client */
208 205
209 MTH static player *create (); 206 MTH static player *create ();
207
208 static player *load_pl (object_thawer &thawer);
210 MTH static player *load (const char *path); 209 MTH static player *load_pl (const char *path);
211 MTH void save (bool final = false); 210
211 bool save_pl (object_freezer &freezer);
212 MTH bool save_pl (const char *path);
213
212 void do_destroy (); 214 void do_destroy ();
213 void gather_callbacks (AV *&callbacks, event_type event) const; 215 void gather_callbacks (AV *&callbacks, event_type event) const;
214 216
215 MTH void connect (client *ns); 217 MTH void connect (client *ns);
216 MTH void disconnect (); 218 MTH void disconnect ();
219
220 MTH void activate ();
221 MTH void deactivate ();
217 222
218 // enters the initial map, after login or creation 223 // enters the initial map, after login or creation
219 MTH void enter_map (); 224 MTH void enter_map ();
220 225
221 ~player (); 226 ~player ();
223private: 228private:
224 void set_object (object *op); 229 void set_object (object *op);
225 player (); 230 player ();
226}; 231};
227 232
233typedef object_vector<player, &player::active> playervec;
234
235extern playervec players;
236
237#define for_all_players(var) \
238 for (int _i = 0; _i < players.size (); ++_i) \
239 declvar (player *, var, players [_i])
240

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines