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 */ |
74 | INTERFACE_CLASS (partylist) |
75 | INTERFACE_CLASS (partylist) |
75 | struct partylist |
76 | struct 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; |
… | |
… | |
189 | { |
190 | { |
190 | if (delayed_update) |
191 | if (delayed_update) |
191 | ob->update_stats (); |
192 | ob->update_stats (); |
192 | } |
193 | } |
193 | |
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 | |
194 | // return the los value for the given coordinate |
209 | // return the los value for the given coordinate |
195 | MTH sint8 blocked_los (int dx, int dy) const |
210 | MTH sint8 blocked_los (int dx, int dy) const |
196 | { |
211 | { |
197 | dx += LOS_X0; |
212 | dx += LOS_X0; |
198 | dy += LOS_Y0; |
213 | dy += LOS_Y0; |
… | |
… | |
211 | MTH void clear_los (sint8 value = LOS_BLOCKED); |
226 | MTH void clear_los (sint8 value = LOS_BLOCKED); |
212 | MTH void update_los (); |
227 | MTH void update_los (); |
213 | |
228 | |
214 | shstr ACC (RW, invis_race); /* What race invisible to? */ |
229 | shstr ACC (RW, invis_race); /* What race invisible to? */ |
215 | |
230 | |
216 | 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 |
217 | |
232 | |
218 | MTH static player *create (); |
233 | MTH static player *create (); |
219 | static player *find (const_utf8_string name); |
234 | static player *find (const_utf8_string name); |
220 | |
235 | |
221 | static player *load_pl (object_thawer &thawer); |
236 | static player *load_pl (object_thawer &thawer); |
… | |
… | |
223 | |
238 | |
224 | MTH void link_skills (); |
239 | MTH void link_skills (); |
225 | MTH object *find_skill (shstr_cmp name) const; |
240 | MTH object *find_skill (shstr_cmp name) const; |
226 | |
241 | |
227 | bool save_pl (object_freezer &freezer); |
242 | bool save_pl (object_freezer &freezer); |
228 | MTH bool save_pl (const char *path); |
243 | MTH bool save_pl (const_octet_string path); |
229 | |
244 | |
230 | void do_destroy (); |
245 | void do_destroy (); |
231 | void gather_callbacks (AV *&callbacks, event_type event) const; |
246 | void gather_callbacks (AV *&callbacks, event_type event) const; |
232 | |
247 | |
233 | MTH dynbuf_text *expand_cfpod (const char *cfpod) const; |
248 | MTH dynbuf_text *expand_cfpod (const_utf8_string cfpod) const; |
234 | |
249 | |
235 | 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 |
236 | |
251 | |
237 | 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 |
238 | { |
253 | { |
… | |
… | |
254 | MTH void chargen_race_next (); |
269 | MTH void chargen_race_next (); |
255 | |
270 | |
256 | MTH void set_observe (object_ornull *ob); |
271 | MTH void set_observe (object_ornull *ob); |
257 | MTH void set_viewpoint (object_ornull *ob); |
272 | MTH void set_viewpoint (object_ornull *ob); |
258 | |
273 | |
259 | 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) |
260 | { |
275 | { |
261 | ns->send_msg (color, type, msg); |
276 | ns->send_msg (color, type, msg); |
262 | } |
277 | } |
263 | |
278 | |
264 | // a prominent box that can easily be escaped away or so |
279 | // a prominent box that can easily be escaped away or so |
265 | // should be used for informative output such as who, maps etc. |
280 | // should be used for informative output such as who, maps etc. |
266 | // will stay on-screen |
281 | // will stay on-screen |
267 | 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); |
268 | |
283 | |
269 | // a prominent msg that signifies some important event, |
284 | // a prominent msg that signifies some important event, |
270 | // an improvement potion effect potion. should not be long. |
285 | // an improvement potion effect potion. should not be long. |
271 | // might time out after a while |
286 | // might time out after a while |
272 | MTH void statusmsg (const char *msg, int color = NDI_BLACK); |
287 | MTH void statusmsg (const_utf8_string msg, int color = NDI_BLACK); |
273 | |
288 | |
274 | // a prominent box that signifies some error such as a failed |
289 | // a prominent box that signifies some error such as a failed |
275 | // improvement potion. should not be long. |
290 | // improvement potion. should not be long. |
276 | MTH void failmsg (const char *msg, int color = NDI_RED); |
291 | MTH void failmsg (const_utf8_string msg, int color = NDI_RED); |
277 | |
292 | |
278 | MTH void update_spells () const |
293 | MTH void update_spells () const |
279 | { |
294 | { |
280 | if (ns) |
295 | if (ns) |
281 | ns->update_spells = true; |
296 | ns->update_spells = true; |
… | |
… | |
299 | #define for_all_players_on_map(var,mapp) \ |
314 | #define for_all_players_on_map(var,mapp) \ |
300 | for_all_players(var) \ |
315 | for_all_players(var) \ |
301 | if ((var)->ob->map == (mapp)) |
316 | if ((var)->ob->map == (mapp)) |
302 | |
317 | |
303 | inline void |
318 | inline void |
304 | object::statusmsg (const char *msg, int color) |
319 | object::statusmsg (const_utf8_string msg, int color) |
305 | { |
320 | { |
306 | if (expect_true (contr)) contr->statusmsg (msg, color); |
321 | if (expect_true (contr)) contr->statusmsg (msg, color); |
307 | } |
322 | } |
308 | |
323 | |
309 | inline void |
324 | inline void |
310 | object::failmsg (const char *msg, int color) |
325 | object::failmsg (const_utf8_string msg, int color) |
311 | { |
326 | { |
312 | if (expect_true (contr)) contr->failmsg (msg, color); |
327 | if (expect_true (contr)) contr->failmsg (msg, color); |
313 | } |
328 | } |
314 | |
329 | |
315 | #endif |
330 | #endif |
|
|
331 | |