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.98 by root, Wed Nov 11 04:45:22 2009 UTC vs.
Revision 1.106 by root, Thu Apr 15 00:36:51 2010 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 11 * option) any later version.
19 * and the GNU General Public License along with this program. If not, see 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>. 20 * <http://www.gnu.org/licenses/>.
21 * 21 *
22 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
23 */ 23 */
24
24#ifndef PLAYER_H_ 25#ifndef PLAYER_H_
25#define PLAYER_H_ 26#define PLAYER_H_
26 27
27//+GPL 28//+GPL
28 29
72 73
73/* not really the player, but tied pretty closely */ 74/* not really the player, but tied pretty closely */
74INTERFACE_CLASS (partylist) 75INTERFACE_CLASS (partylist)
75struct partylist 76struct partylist
76{ 77{
77 char *ACC (RW, partyleader); 78 utf8_string ACC (RW, partyleader);
78 char ACC (RW, passwd)[9]; 79 char ACC (RW, passwd)[9];
79 partylist *ACC (RW, next); 80 partylist *ACC (RW, next);
80 char *ACC (RW, partyname); 81 utf8_string ACC (RW, partyname);
81 82
82 struct party_kill 83 struct party_kill
83 { 84 {
84 char killer[MAX_NAME + 1], dead[MAX_NAME + 1]; 85 char killer[MAX_NAME + 1], dead[MAX_NAME + 1];
85 sint64 exp; 86 sint64 exp;
130 bool ACC (RW, dirty); // set if player is dirty (not reliable yet!) 131 bool ACC (RW, dirty); // set if player is dirty (not reliable yet!)
131 132
132 float ACC (RW, weapon_sp); /* Penalties to speed when fighting w speed >ws/10 */ 133 float ACC (RW, weapon_sp); /* Penalties to speed when fighting w speed >ws/10 */
133 float ACC (RW, weapon_sp_left); // same as speed_left, but for attacks 134 float ACC (RW, weapon_sp_left); // same as speed_left, but for attacks
134 living ACC (RO, orig_stats); /* Permanent real stats of player */ 135 living ACC (RO, orig_stats); /* Permanent real stats of player */
135 object_ptr last_skill_ob[NUM_SKILLS]; /* the exp object */ 136 object_ptr last_skill_ob[CS_NUM_SKILLS]; /* the exp object */
136 object_ptr ACC (RW, last_used); /* Pointer to object last picked or applied */ 137 object_ptr ACC (RW, last_used); /* Pointer to object last picked or applied */
137 138
138 object_ptr ACC (RW, combat_ob); // which weapon/bow/skill to use for direct attacks 139 object_ptr ACC (RW, combat_ob); // which weapon/bow/skill to use for direct attacks
139 object_ptr ACC (RW, ranged_ob); // which skill/item/spell to use for ranged attacks 140 object_ptr ACC (RW, ranged_ob); // which skill/item/spell to use for ranged attacks
140 object_ptr ACC (RW, golem); // the currently controlled golem 141 object_ptr ACC (RW, golem); // the currently controlled golem
154 sint8 ACC (RW, levsp[11]); /* Same for sp */ 155 sint8 ACC (RW, levsp[11]); /* Same for sp */
155 sint8 ACC (RW, levgrace[11]); /* And same for grace */ 156 sint8 ACC (RW, levgrace[11]); /* And same for grace */
156 157
157 object_ptr ACC (RW, killer); /* Who last tried to kill this player (this object is usually destroyed) */ 158 object_ptr ACC (RW, killer); /* Who last tried to kill this player (this object is usually destroyed) */
158 159
160 float speed_left_save; // spee doptimisation, see process_players[12]
159 char write_buf[MAX_BUF]; /* Holds arbitrary input from client */ /* should go */ 161 char write_buf[MAX_BUF]; /* Holds arbitrary input from client */ /* should go */
160 char ACC (RW, password)[16]; /* 2 (seed) + 11 (crypted) + 1 (EOS) + 2 (safety) = 16 */ 162 char ACC (RW, password)[16]; /* 2 (seed) + 11 (crypted) + 1 (EOS) + 2 (safety) = 16 */
161 163
162 partylist *ACC (RW, party); /* Party this player is part of */ 164 partylist *ACC (RW, party); /* Party this player is part of */
163 partylist *ACC (RW, party_to_join); /* used when player wants to join a party */ 165 partylist *ACC (RW, party_to_join); /* used when player wants to join a party */
164 /* but we will have to get password first */ 166 /* but we will have to get password first */
188 { 190 {
189 if (delayed_update) 191 if (delayed_update)
190 ob->update_stats (); 192 ob->update_stats ();
191 } 193 }
192 194
195#if 0
196 enum {
197 SA_SPELLS = 1<<0,
198 SA_EXP = 1<<1,
199 };
200
201 uint8 ACxC (RW, stat_update_flags);
202
203 void need_stat_update (int flags)
204 {
205 stat_update_flags |= flags;
206 }
207#endif
208
193 // return the los value for the given coordinate 209 // return the los value for the given coordinate
194 MTH sint8 blocked_los (int dx, int dy) const 210 MTH sint8 blocked_los (int dx, int dy) const
195 { 211 {
196 dx += LOS_X0; 212 dx += LOS_X0;
197 dy += LOS_Y0; 213 dy += LOS_Y0;
210 MTH void clear_los (sint8 value = LOS_BLOCKED); 226 MTH void clear_los (sint8 value = LOS_BLOCKED);
211 MTH void update_los (); 227 MTH void update_los ();
212 228
213 shstr ACC (RW, invis_race); /* What race invisible to? */ 229 shstr ACC (RW, invis_race); /* What race invisible to? */
214 230
215 MTH const char *killer_name () const; // makes a string out of ->killer 231 MTH const_utf8_string killer_name () const; // makes a string out of ->killer
216 232
217 MTH static player *create (); 233 MTH static player *create ();
218 static player *find (const_utf8_string name); 234 static player *find (const_utf8_string name);
219 235
220 static player *load_pl (object_thawer &thawer); 236 static player *load_pl (object_thawer &thawer);
222 238
223 MTH void link_skills (); 239 MTH void link_skills ();
224 MTH object *find_skill (shstr_cmp name) const; 240 MTH object *find_skill (shstr_cmp name) const;
225 241
226 bool save_pl (object_freezer &freezer); 242 bool save_pl (object_freezer &freezer);
227 MTH bool save_pl (const char *path); 243 MTH bool save_pl (const_octet_string path);
228 244
229 void do_destroy (); 245 void do_destroy ();
230 void gather_callbacks (AV *&callbacks, event_type event) const; 246 void gather_callbacks (AV *&callbacks, event_type event) const;
231 247
232 MTH dynbuf_text *expand_cfpod (const char *cfpod) const; 248 MTH dynbuf_text *expand_cfpod (const_utf8_string cfpod) const;
233 249
234 MTH void touch () { dirty = true; } // need to touch when logged out and changed 250 MTH void touch () { dirty = true; } // need to touch when logged out and changed
235 251
236 MTH void play_sound (faceidx sound, int dx = 0, int dy = 0) const 252 MTH void play_sound (faceidx sound, int dx = 0, int dy = 0) const
237 { 253 {
253 MTH void chargen_race_next (); 269 MTH void chargen_race_next ();
254 270
255 MTH void set_observe (object_ornull *ob); 271 MTH void set_observe (object_ornull *ob);
256 MTH void set_viewpoint (object_ornull *ob); 272 MTH void set_viewpoint (object_ornull *ob);
257 273
258 void send_msg (int color, const char *type, const char *msg) 274 void send_msg (int color, const_utf8_string type, const_utf8_string msg)
259 { 275 {
260 ns->send_msg (color, type, msg); 276 ns->send_msg (color, type, msg);
261 } 277 }
262 278
263 // a prominent box that can easily be escaped away or so 279 // a prominent box that can easily be escaped away or so
264 // should be used for informative output such as who, maps etc. 280 // should be used for informative output such as who, maps etc.
265 // will stay on-screen 281 // will stay on-screen
266 MTH void infobox (const char *title, const char *msg, int color = NDI_BLACK); 282 MTH void infobox (const_utf8_string title, const_utf8_string msg, int color = NDI_BLACK);
267 283
268 // a prominent msg that signifies some important event, 284 // a prominent msg that signifies some important event,
269 // an improvement potion effect potion. should not be long. 285 // an improvement potion effect potion. should not be long.
270 // might time out after a while 286 // might time out after a while
271 MTH void statusmsg (const char *msg, int color = NDI_BLACK); 287 MTH void statusmsg (const_utf8_string msg, int color = NDI_BLACK);
272 288
273 // a prominent box that signifies some error such as a failed 289 // a prominent box that signifies some error such as a failed
274 // improvement potion. should not be long. 290 // improvement potion. should not be long.
275 MTH void failmsg (const char *msg, int color = NDI_RED); 291 MTH void failmsg (const_utf8_string msg, int color = NDI_RED);
292 MTH void failmsgf (const_utf8_string format, ...); // always NDI_RED
276 293
277 MTH void update_spells () const 294 MTH void update_spells () const
278 { 295 {
279 if (ns) 296 if (ns)
280 ns->update_spells = true; 297 ns->update_spells = true;
298#define for_all_players_on_map(var,mapp) \ 315#define for_all_players_on_map(var,mapp) \
299 for_all_players(var) \ 316 for_all_players(var) \
300 if ((var)->ob->map == (mapp)) 317 if ((var)->ob->map == (mapp))
301 318
302inline void 319inline void
303object::statusmsg (const char *msg, int color) 320object::statusmsg (const_utf8_string msg, int color)
304{ 321{
305 if (expect_true (contr)) contr->statusmsg (msg, color); 322 if (expect_true (contr)) contr->statusmsg (msg, color);
306} 323}
307 324
308inline void 325inline void
309object::failmsg (const char *msg, int color) 326object::failmsg (const_utf8_string msg, int color)
310{ 327{
311 if (expect_true (contr)) contr->failmsg (msg, color); 328 if (expect_true (contr)) contr->failmsg (msg, color);
312} 329}
313 330
314#endif 331#endif
332

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines