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,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 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 |
… | |
… | |
72 | |
72 | |
73 | /* not really the player, but tied pretty closely */ |
73 | /* not really the player, but tied pretty closely */ |
74 | INTERFACE_CLASS (partylist) |
74 | INTERFACE_CLASS (partylist) |
75 | struct partylist |
75 | struct partylist |
76 | { |
76 | { |
77 | char *ACC (RW, partyleader); |
77 | utf8_string ACC (RW, partyleader); |
78 | char ACC (RW, passwd)[9]; |
78 | char ACC (RW, passwd)[9]; |
79 | partylist *ACC (RW, next); |
79 | partylist *ACC (RW, next); |
80 | char *ACC (RW, partyname); |
80 | utf8_string ACC (RW, partyname); |
81 | |
81 | |
82 | struct party_kill |
82 | struct party_kill |
83 | { |
83 | { |
84 | char killer[MAX_NAME + 1], dead[MAX_NAME + 1]; |
84 | char killer[MAX_NAME + 1], dead[MAX_NAME + 1]; |
85 | sint64 exp; |
85 | sint64 exp; |
… | |
… | |
154 | sint8 ACC (RW, levsp[11]); /* Same for sp */ |
154 | sint8 ACC (RW, levsp[11]); /* Same for sp */ |
155 | sint8 ACC (RW, levgrace[11]); /* And same for grace */ |
155 | sint8 ACC (RW, levgrace[11]); /* And same for grace */ |
156 | |
156 | |
157 | object_ptr ACC (RW, killer); /* Who last tried to kill this player (this object is usually destroyed) */ |
157 | object_ptr ACC (RW, killer); /* Who last tried to kill this player (this object is usually destroyed) */ |
158 | |
158 | |
|
|
159 | float speed_left_save; // spee doptimisation, see process_players[12] |
159 | char write_buf[MAX_BUF]; /* Holds arbitrary input from client */ /* should go */ |
160 | 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 */ |
161 | char ACC (RW, password)[16]; /* 2 (seed) + 11 (crypted) + 1 (EOS) + 2 (safety) = 16 */ |
161 | |
162 | |
162 | partylist *ACC (RW, party); /* Party this player is part of */ |
163 | 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 */ |
164 | partylist *ACC (RW, party_to_join); /* used when player wants to join a party */ |
164 | /* but we will have to get password first */ |
165 | /* but we will have to get password first */ |
165 | /* so we have to remember which party to */ |
166 | /* so we have to remember which party to */ |
166 | /* join */ |
167 | /* join */ |
167 | char ACC (RW, search_str)[MAX_BUF]; /* Item we are looking for */ |
168 | char ACC (RW, search_str)[256]; /* Item we are looking for */ |
168 | sint16 ACC (RW, encumbrance); /* How much our player is encumbered */ |
169 | sint16 ACC (RW, encumbrance); /* How much our player is encumbered */ |
169 | uint16 ACC (RW, outputs_sync); /* How often to print, no matter what */ |
170 | uint16 ACC (RW, outputs_sync); /* How often to print, no matter what */ |
170 | uint16 ACC (RW, outputs_count); /* Print if this count is exceeded */ |
171 | uint16 ACC (RW, outputs_count); /* Print if this count is exceeded */ |
171 | object_ptr ACC (RW, mark); /* marked object */ |
172 | object_ptr ACC (RW, mark); /* marked object */ |
172 | /* Special DM fields */ |
173 | /* Special DM fields */ |
… | |
… | |
176 | /* the player can see. For maps smaller than */ |
177 | /* the player can see. For maps smaller than */ |
177 | /* MAP_CLIENT_.., the center is used */ |
178 | /* MAP_CLIENT_.., the center is used */ |
178 | |
179 | |
179 | //-GPL |
180 | //-GPL |
180 | |
181 | |
|
|
182 | // stats updates are very costly, so delay them if at all possible |
|
|
183 | bool ACC (RW, delayed_update); |
|
|
184 | void queue_stats_update () |
|
|
185 | { |
|
|
186 | delayed_update = true; |
|
|
187 | } |
|
|
188 | void need_updated_stats () |
|
|
189 | { |
|
|
190 | if (delayed_update) |
|
|
191 | ob->update_stats (); |
|
|
192 | } |
|
|
193 | |
181 | // return the los value for the given coordinate |
194 | // return the los value for the given coordinate |
182 | MTH sint8 blocked_los (int dx, int dy) const |
195 | MTH sint8 blocked_los (int dx, int dy) const |
183 | { |
196 | { |
184 | dx += LOS_X0; |
197 | dx += LOS_X0; |
185 | dy += LOS_Y0; |
198 | dy += LOS_Y0; |
… | |
… | |
198 | MTH void clear_los (sint8 value = LOS_BLOCKED); |
211 | MTH void clear_los (sint8 value = LOS_BLOCKED); |
199 | MTH void update_los (); |
212 | MTH void update_los (); |
200 | |
213 | |
201 | shstr ACC (RW, invis_race); /* What race invisible to? */ |
214 | shstr ACC (RW, invis_race); /* What race invisible to? */ |
202 | |
215 | |
203 | MTH const char *killer_name () const; // makes a string out of ->killer |
216 | MTH const_utf8_string killer_name () const; // makes a string out of ->killer |
204 | |
217 | |
205 | MTH static player *create (); |
218 | MTH static player *create (); |
206 | static player *find (const_utf8_string name); |
219 | static player *find (const_utf8_string name); |
207 | |
220 | |
208 | static player *load_pl (object_thawer &thawer); |
221 | static player *load_pl (object_thawer &thawer); |
… | |
… | |
210 | |
223 | |
211 | MTH void link_skills (); |
224 | MTH void link_skills (); |
212 | MTH object *find_skill (shstr_cmp name) const; |
225 | MTH object *find_skill (shstr_cmp name) const; |
213 | |
226 | |
214 | bool save_pl (object_freezer &freezer); |
227 | bool save_pl (object_freezer &freezer); |
215 | MTH bool save_pl (const char *path); |
228 | MTH bool save_pl (const_octet_string path); |
216 | |
229 | |
217 | void do_destroy (); |
230 | void do_destroy (); |
218 | void gather_callbacks (AV *&callbacks, event_type event) const; |
231 | void gather_callbacks (AV *&callbacks, event_type event) const; |
219 | |
232 | |
220 | MTH dynbuf_text *expand_cfpod (const char *cfpod) const; |
233 | MTH dynbuf_text *expand_cfpod (const_utf8_string cfpod) const; |
221 | |
234 | |
222 | MTH void touch () { dirty = true; } // need to touch when logged out and changed |
235 | MTH void touch () { dirty = true; } // need to touch when logged out and changed |
223 | |
236 | |
224 | MTH void play_sound (faceidx sound, int dx = 0, int dy = 0) const |
237 | MTH void play_sound (faceidx sound, int dx = 0, int dy = 0) const |
225 | { |
238 | { |
… | |
… | |
241 | MTH void chargen_race_next (); |
254 | MTH void chargen_race_next (); |
242 | |
255 | |
243 | MTH void set_observe (object_ornull *ob); |
256 | MTH void set_observe (object_ornull *ob); |
244 | MTH void set_viewpoint (object_ornull *ob); |
257 | MTH void set_viewpoint (object_ornull *ob); |
245 | |
258 | |
246 | void send_msg (int color, const char *type, const char *msg) |
259 | void send_msg (int color, const_utf8_string type, const_utf8_string msg) |
247 | { |
260 | { |
248 | ns->send_msg (color, type, msg); |
261 | ns->send_msg (color, type, msg); |
249 | } |
262 | } |
250 | |
263 | |
251 | // a prominent box that can easily be escaped away or so |
264 | // a prominent box that can easily be escaped away or so |
252 | // should be used for informative output such as who, maps etc. |
265 | // should be used for informative output such as who, maps etc. |
253 | // will stay on-screen |
266 | // will stay on-screen |
254 | MTH void infobox (const char *title, const char *msg, int color = NDI_BLACK); |
267 | MTH void infobox (const_utf8_string title, const_utf8_string msg, int color = NDI_BLACK); |
255 | |
268 | |
256 | // a prominent msg that signifies some important event, |
269 | // a prominent msg that signifies some important event, |
257 | // an improvement potion effect potion. should not be long. |
270 | // an improvement potion effect potion. should not be long. |
258 | // might time out after a while |
271 | // might time out after a while |
259 | MTH void statusmsg (const char *msg, int color = NDI_BLACK); |
272 | MTH void statusmsg (const_utf8_string msg, int color = NDI_BLACK); |
260 | |
273 | |
261 | // a prominent box that signifies some error such as a failed |
274 | // a prominent box that signifies some error such as a failed |
262 | // improvement potion. should not be long. |
275 | // improvement potion. should not be long. |
263 | MTH void failmsg (const char *msg, int color = NDI_RED); |
276 | MTH void failmsg (const_utf8_string msg, int color = NDI_RED); |
264 | |
277 | |
265 | MTH void update_spells () const |
278 | MTH void update_spells () const |
266 | { |
279 | { |
267 | if (ns) |
280 | if (ns) |
268 | ns->update_spells = true; |
281 | ns->update_spells = true; |
… | |
… | |
286 | #define for_all_players_on_map(var,mapp) \ |
299 | #define for_all_players_on_map(var,mapp) \ |
287 | for_all_players(var) \ |
300 | for_all_players(var) \ |
288 | if ((var)->ob->map == (mapp)) |
301 | if ((var)->ob->map == (mapp)) |
289 | |
302 | |
290 | inline void |
303 | inline void |
291 | object::statusmsg (const char *msg, int color) |
304 | object::statusmsg (const_utf8_string msg, int color) |
292 | { |
305 | { |
293 | if (expect_true (contr)) contr->statusmsg (msg, color); |
306 | if (expect_true (contr)) contr->statusmsg (msg, color); |
294 | } |
307 | } |
295 | |
308 | |
296 | inline void |
309 | inline void |
297 | object::failmsg (const char *msg, int color) |
310 | object::failmsg (const_utf8_string msg, int color) |
298 | { |
311 | { |
299 | if (expect_true (contr)) contr->failmsg (msg, color); |
312 | if (expect_true (contr)) contr->failmsg (msg, color); |
300 | } |
313 | } |
301 | |
314 | |
302 | #endif |
315 | #endif |
|
|
316 | |