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.41 by root, Thu Jan 4 00:08:07 2007 UTC vs.
Revision 1.43 by root, Sun Jan 7 02:39:14 2007 UTC

1/* 1/*
2 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
3 3
4 Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 5 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
5 Copyright (C) 1992 Frank Tore Johansen 6 Copyright (C) 1992 Frank Tore Johansen
6 7
7 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
106 107
107 sint64 ACC (RW, total_exp); 108 sint64 ACC (RW, total_exp);
108 uint32 ACC (RW, kills); 109 uint32 ACC (RW, kills);
109}; 110};
110 111
111#define for_all_players(var) for (player *var = first_player; var; var = var->next)
112
113INTERFACE_CLASS (player) 112INTERFACE_CLASS (player)
114struct player : zero_initialised, attachable 113struct player : zero_initialised, attachable
115{ 114{
116 player *ACC (RW, next); /* Pointer to next player, NULL if this is last */
117 client_ptr ACC (RO, ns); /* Socket information for this player */ 115 client *ACC (RO, ns); /* Socket information for this player */
118 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
119 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 */
120 bowtype_t ACC (RW, bowtype); /* which firemode? */ 120 bowtype_t ACC (RW, bowtype); /* which firemode? */
121 petmode_t ACC (RW, petmode); /* which petmode? */ 121 petmode_t ACC (RW, petmode); /* which petmode? */
122 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 */
123 /* 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 */
124 /* With the range names */ 124 /* With the range names */
125 usekeytype ACC (RW, usekeys); /* Method for finding keys for doors */ 125 usekeytype ACC (RW, usekeys); /* Method for finding keys for doors */
126 unapplymode ACC (RW, unapply); /* Method for auto unapply */ 126 unapplymode ACC (RW, unapply); /* Method for auto unapply */
127 uint32 ACC (RW, count); /* Any numbers typed before a command */ 127 uint32 ACC (RW, count); /* Any numbers typed before a command */
128 uint32 ACC (RW, mode); /* Mode of player for pickup. */ 128 uint32 ACC (RW, mode); /* Mode of player for pickup. */
129 129
135 sint16 ACC (RW, item_power); /* Total item power of objects equipped */ 135 sint16 ACC (RW, item_power); /* Total item power of objects equipped */
136 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 */
137 sint8 ACC (RW, last_level); /* Last level we sent to client */ 137 sint8 ACC (RW, last_level); /* Last level we sent to client */
138 138
139 /* 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 */
140 bool ACC (RO, braced); /* Will not move if braced, only attack */ 140 bool ACC (RW, braced); /* Will not move if braced, only attack */
141 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 ? */
142 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 */
143 bool ACC (RO, fire_on); /* Player should fire object, not move */ 143 bool ACC (RW, fire_on); /* Player should fire object, not move */
144 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 */
145 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 */
146 bool ACC (RO, peaceful); /* If set, won't attack friendly creatures */ 146 bool ACC (RW, peaceful); /* If set, won't attack friendly creatures */
147 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 */
148 bool ACC (RO, explore); /* if True, player is in explore mode */
149 148
150 object_ptr last_skill_ob[NUM_SKILLS]; /* the exp object */ 149 object_ptr last_skill_ob[NUM_SKILLS]; /* the exp object */
151 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 */
152 151
153 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 */
200 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 */
201 /* the player can see. For maps smaller than */ 200 /* the player can see. For maps smaller than */
202 /* MAP_CLIENT_.., the upper left is used */ 201 /* MAP_CLIENT_.., the upper left is used */
203 202
204 shstr ACC (RW, invis_race); /* What race invisible to? */ 203 shstr ACC (RW, invis_race); /* What race invisible to? */
205 bool ACC (RW, enable_save);
206 Output_Buf outputs[NUM_OUTPUT_BUFS]; /* holds output strings to client */ 204 Output_Buf outputs[NUM_OUTPUT_BUFS]; /* holds output strings to client */
207 205
208 MTH static player *create (); 206 MTH static player *create ();
207
208 static player *load_pl (object_thawer &thawer);
209 MTH static player *load (const char *path); 209 MTH static player *load_pl (const char *path);
210 MTH void save (bool final = false); 210
211 bool save_pl (object_freezer &freezer);
212 MTH bool save_pl (const char *path);
213
211 void do_destroy (); 214 void do_destroy ();
212 void gather_callbacks (AV *&callbacks, event_type event) const; 215 void gather_callbacks (AV *&callbacks, event_type event) const;
213 216
214 MTH void connect (client *ns); 217 MTH void connect (client *ns);
215 MTH void disconnect (); 218 MTH void disconnect ();
219
220 MTH void activate ();
221 MTH void deactivate ();
216 222
217 // enters the initial map, after login or creation 223 // enters the initial map, after login or creation
218 MTH void enter_map (); 224 MTH void enter_map ();
219 225
220 ~player (); 226 ~player ();
222private: 228private:
223 void set_object (object *op); 229 void set_object (object *op);
224 player (); 230 player ();
225}; 231};
226 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