1 | /*****************************************************************************/ |
|
|
2 | /* CrossFire, A Multiplayer game for the X Window System */ |
|
|
3 | /*****************************************************************************/ |
|
|
4 | |
|
|
5 | /* |
1 | /* |
6 | * This code is placed under the GNU General Public Licence (GPL) |
2 | * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. |
7 | * |
3 | * |
|
|
4 | * Copyright (©) 2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team |
8 | * Copyright (C) 2001-2005 by Chachkoff Yann |
5 | * Copyright (©) 2001-2005,2007 by Chachkoff Yann |
9 | * Copyright (C) 2006,2007 by Marc Lehmann <cf@schmorp.de> |
6 | * Copyright (©) 2006,2007 by Marc Lehmann <cf@schmorp.de> |
10 | * |
7 | * |
11 | * This program is free software; you can redistribute it and/or modify |
8 | * Crossfire TRT is free software: you can redistribute it and/or modify |
12 | * 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 |
13 | * the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation, either version 3 of the License, or |
14 | * (at your option) any later version. |
11 | * (at your option) any later version. |
15 | * |
12 | * |
16 | * This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 | * GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
20 | * |
17 | * |
21 | * You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the GNU General Public License |
22 | * along with this program; if not, write to the Free Software |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
23 | * Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20 | * |
|
|
21 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
24 | */ |
22 | */ |
|
|
23 | |
|
|
24 | #include "autoconf.h" |
25 | |
25 | |
26 | #define PLUGIN_NAME "perl" |
26 | #define PLUGIN_NAME "perl" |
27 | #define PLUGIN_VERSION "cfperl 0.5" |
27 | #define PLUGIN_VERSION "cfperl 0.5" |
28 | |
28 | |
29 | #define CEDES_PER_TICK 5 |
29 | #define CEDES_PER_TICK 5 |
|
|
30 | |
|
|
31 | #if HAVE_EXECINFO_H |
|
|
32 | # include <execinfo.h> |
|
|
33 | #endif |
30 | |
34 | |
31 | #include <plugin_common.h> |
35 | #include <plugin_common.h> |
32 | #include <sounds.h> |
36 | #include <sounds.h> |
33 | #include <cstdarg> |
37 | #include <cstdarg> |
34 | #include <sproto.h> |
38 | #include <sproto.h> |
… | |
… | |
49 | #include "CoroAPI.h" |
53 | #include "CoroAPI.h" |
50 | #include "perlxsi.c" |
54 | #include "perlxsi.c" |
51 | |
55 | |
52 | extern sint64 *levels; // the experience table |
56 | extern sint64 *levels; // the experience table |
53 | |
57 | |
54 | typedef object object_ornull; |
58 | typedef object_thawer &object_thawer_ref; |
55 | typedef maptile maptile_ornull; |
59 | typedef object_freezer &object_freezer_ref; |
56 | |
|
|
57 | typedef char *octet_string; |
|
|
58 | typedef char *utf8_string; |
|
|
59 | typedef const char *const_octet_string; |
|
|
60 | typedef const char *const_utf8_string; |
|
|
61 | |
60 | |
62 | typedef std::string std__string; |
61 | typedef std::string std__string; |
63 | |
62 | |
64 | #if IVSIZE >= 8 |
63 | #if IVSIZE >= 8 |
65 | typedef IV val64; |
64 | typedef IV val64; |
… | |
… | |
70 | # define newSVval64 newSVnv |
69 | # define newSVval64 newSVnv |
71 | # define SvVAL64 SvNV |
70 | # define SvVAL64 SvNV |
72 | #endif |
71 | #endif |
73 | |
72 | |
74 | static f_plug_api gethook = cfapi_get_hooks; |
73 | static f_plug_api gethook = cfapi_get_hooks; |
75 | static f_plug_api object_set_property = cfapi_object_set_property; |
|
|
76 | static f_plug_api object_insert = cfapi_object_insert; |
74 | static f_plug_api object_insert = cfapi_object_insert; |
77 | |
75 | |
78 | static PerlInterpreter *perl; |
76 | static PerlInterpreter *perl; |
79 | |
77 | |
80 | double runtime; |
78 | tstamp NOW, runtime; |
81 | |
79 | |
82 | global gbl_ev; |
80 | global gbl_ev; |
83 | static AV *cb_global, *cb_attachable, *cb_object, *cb_player, *cb_client, *cb_type, *cb_map; |
81 | static AV *cb_global, *cb_attachable, *cb_object, *cb_player, *cb_client, *cb_type, *cb_map; |
84 | static SV *sv_runtime, *sv_next_tick; |
82 | static SV *sv_runtime, *sv_next_tick; |
|
|
83 | |
|
|
84 | bitset<NUM_EVENT_TYPES> ev_want_event; |
|
|
85 | bitset<NUM_TYPES> ev_want_type; |
85 | |
86 | |
86 | static HV |
87 | static HV |
87 | *stash_cf, |
88 | *stash_cf, |
88 | *stash_cf_object_wrap, |
89 | *stash_cf_object_wrap, |
89 | *stash_cf_object_player_wrap, |
90 | *stash_cf_object_player_wrap, |
… | |
… | |
93 | *stash_cf_arch_wrap, |
94 | *stash_cf_arch_wrap, |
94 | *stash_cf_party_wrap, |
95 | *stash_cf_party_wrap, |
95 | *stash_cf_region_wrap, |
96 | *stash_cf_region_wrap, |
96 | *stash_cf_living_wrap; |
97 | *stash_cf_living_wrap; |
97 | |
98 | |
|
|
99 | static inline SV * |
|
|
100 | newSVpv_utf8 (const char *s) |
|
|
101 | { |
|
|
102 | SV *sv = newSVpv (s, 0); |
|
|
103 | SvUTF8_on (sv); |
|
|
104 | return sv; |
|
|
105 | } |
|
|
106 | |
|
|
107 | static inline SV * |
|
|
108 | newSVpvn_utf8 (const char *s, STRLEN l) |
|
|
109 | { |
|
|
110 | SV *sv = newSVpvn (s, l); |
|
|
111 | SvUTF8_on (sv); |
|
|
112 | return sv; |
|
|
113 | } |
|
|
114 | |
98 | // helper cast function, returns super class * or 0 |
115 | // helper cast function, returns super class * or 0 |
99 | template<class super> |
116 | template<class super> |
100 | static super * |
117 | static super * |
101 | is_a (attachable *at) |
118 | is_a (attachable *at) |
102 | { |
119 | { |
… | |
… | |
161 | } |
178 | } |
162 | |
179 | |
163 | void |
180 | void |
164 | attachable::do_destroy () |
181 | attachable::do_destroy () |
165 | { |
182 | { |
166 | invoke (EVENT_ATTACHABLE_DESTROY, DT_END); |
183 | INVOKE_ATTACHABLE (DESTROY, this); |
167 | |
184 | |
168 | if (cb) |
185 | if (cb) |
169 | { |
186 | { |
170 | SvREFCNT_dec (cb); |
187 | SvREFCNT_dec (cb); |
171 | cb = 0; |
188 | cb = 0; |
… | |
… | |
180 | if (destroyed ()) |
197 | if (destroyed ()) |
181 | return; |
198 | return; |
182 | |
199 | |
183 | flags |= F_DESTROYED; |
200 | flags |= F_DESTROYED; |
184 | do_destroy (); |
201 | do_destroy (); |
|
|
202 | sever_self (); |
185 | } |
203 | } |
186 | |
204 | |
187 | void |
205 | void |
188 | attachable::check_mortals () |
206 | attachable::check_mortals () |
189 | { |
207 | { |
… | |
… | |
193 | { |
211 | { |
194 | if (i >= mortals.size ()) |
212 | if (i >= mortals.size ()) |
195 | { |
213 | { |
196 | i = 0; |
214 | i = 0; |
197 | |
215 | |
198 | if (mortals.size () > 1000) |
216 | if (mortals.size () >= 512) |
|
|
217 | { |
|
|
218 | static int last_mortalcount; |
|
|
219 | if (mortals.size () != last_mortalcount) |
|
|
220 | { |
|
|
221 | last_mortalcount = mortals.size (); |
199 | LOG (llevInfo, "mortal queue size (%d) exceeds 1000.\n", (int)mortals.size ()); |
222 | LOG (llevInfo, "%d mortals.\n", (int)mortals.size ()); |
|
|
223 | |
|
|
224 | if (0) |
|
|
225 | { |
|
|
226 | for (int j = 0; j < mortals.size (); ++j)//D |
|
|
227 | fprintf (stderr, "%d:%s %p ", j, &((object *)mortals[j])->name, mortals[j]);//D |
|
|
228 | fprintf (stderr, "\n");//D |
|
|
229 | } |
|
|
230 | } |
|
|
231 | } |
200 | |
232 | |
201 | break; |
233 | break; |
202 | } |
234 | } |
203 | |
235 | |
204 | attachable *obj = mortals [i]; |
236 | attachable *obj = mortals [i]; |
… | |
… | |
209 | LOG (llevError, "check_mortals: object '%s' still has self\n", typeid (obj).name ()); |
241 | LOG (llevError, "check_mortals: object '%s' still has self\n", typeid (obj).name ()); |
210 | obj->sever_self (); |
242 | obj->sever_self (); |
211 | } |
243 | } |
212 | #endif |
244 | #endif |
213 | |
245 | |
214 | if (obj->refcnt_cnt ()) |
246 | if (obj->refcnt) |
215 | { |
247 | { |
216 | ++i; // further delay freeing |
248 | ++i; // further delay freeing |
217 | |
249 | |
218 | if (!(i & 0x3ff)) |
250 | if (!(i & 0x3ff)) |
219 | break; |
251 | break; |
… | |
… | |
225 | delete obj; |
257 | delete obj; |
226 | } |
258 | } |
227 | } |
259 | } |
228 | } |
260 | } |
229 | |
261 | |
|
|
262 | void |
|
|
263 | attachable::set_key (const char *key, const char *value, bool is_utf8) |
|
|
264 | { |
|
|
265 | if (!self) |
|
|
266 | self = newHV (); |
|
|
267 | |
|
|
268 | if (value) |
|
|
269 | hv_store (self, key, strlen (key), is_utf8 ? newSVpv_utf8 (value) : newSVpv (value, 0), 0); |
|
|
270 | else |
|
|
271 | hv_delete (self, key, strlen (key), G_DISCARD); |
|
|
272 | } |
|
|
273 | |
230 | attachable & |
274 | attachable & |
231 | attachable::operator =(const attachable &src) |
275 | attachable::operator =(const attachable &src) |
232 | { |
276 | { |
233 | //if (self || cb) |
277 | //if (self || cb) |
234 | //INVOKE_OBJECT (CLONE, this, ARG_OBJECT (dst)); |
278 | //INVOKE_OBJECT (CLONE, this, ARG_OBJECT (dst)); |
235 | |
279 | |
236 | attach = src.attach; |
280 | attach = src.attach; |
237 | return *this; |
281 | return *this; |
|
|
282 | } |
|
|
283 | |
|
|
284 | template<typename T> |
|
|
285 | static bool |
|
|
286 | find_backref (void *ptr, T *obj) |
|
|
287 | { |
|
|
288 | char *s = (char *)obj; |
|
|
289 | while (s < (char *)obj + sizeof (T)) |
|
|
290 | { |
|
|
291 | if (ptr == *(void **)s) |
|
|
292 | return true; |
|
|
293 | |
|
|
294 | s += sizeof (void *); // assume natural alignment |
|
|
295 | } |
|
|
296 | |
|
|
297 | return false; |
|
|
298 | } |
|
|
299 | |
|
|
300 | // for debugging, find "live" objects containing this ptr |
|
|
301 | void |
|
|
302 | find_backref (void *ptr) |
|
|
303 | { |
|
|
304 | for_all_objects (op) |
|
|
305 | if (find_backref (ptr, op)) |
|
|
306 | fprintf (stderr, "O %p %d:'%s'\n", op, op->count, &op->name); |
|
|
307 | |
|
|
308 | for_all_players (pl) |
|
|
309 | if (find_backref (ptr, pl)) |
|
|
310 | fprintf (stderr, "P %p\n", pl); |
|
|
311 | |
|
|
312 | for_all_clients (ns) |
|
|
313 | if (find_backref (ptr, ns)) |
|
|
314 | fprintf (stderr, "C %p\n", ns); |
|
|
315 | |
238 | } |
316 | } |
239 | |
317 | |
240 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
318 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
241 | |
319 | |
242 | static SV * |
320 | static SV * |
… | |
… | |
275 | { |
353 | { |
276 | if (!obj) |
354 | if (!obj) |
277 | return &PL_sv_undef; |
355 | return &PL_sv_undef; |
278 | |
356 | |
279 | if (!obj->self) |
357 | if (!obj->self) |
|
|
358 | obj->self = newHV (); |
|
|
359 | |
|
|
360 | if (!SvOBJECT (obj->self)) |
280 | { |
361 | { |
281 | obj->self = newHV (); |
|
|
282 | sv_magicext ((SV *)obj->self, 0, PERL_MAGIC_ext, &attachable::vtbl, (char *)obj, 0); |
362 | sv_magicext ((SV *)obj->self, 0, PERL_MAGIC_ext, &attachable::vtbl, (char *)obj, 0); |
283 | |
363 | |
284 | // now bless the object _once_ |
364 | // now bless the object _once_ |
|
|
365 | //TODO: create a class registry with c++ type<=>perl name<=>stash and use it here and elsewhere |
285 | return sv_bless (newRV_inc ((SV *)obj->self), stash); |
366 | return sv_bless (newRV_inc ((SV *)obj->self), stash); |
286 | } |
367 | } |
287 | else |
368 | else |
288 | { |
369 | { |
289 | SV *sv = newRV_inc ((SV *)obj->self); |
370 | SV *sv = newRV_inc ((SV *)obj->self); |
… | |
… | |
326 | return SvPTR (sv, klass); |
407 | return SvPTR (sv, klass); |
327 | else |
408 | else |
328 | return 0; |
409 | return 0; |
329 | } |
410 | } |
330 | |
411 | |
331 | inline SV *to_sv (const shstr & v) { return v ? newSVpvn ((const char *)v, v.length ()) : &PL_sv_undef; } |
412 | inline SV *to_sv (const shstr & v) { return v ? newSVpvn_utf8 ((const char *)v, v.length ()) : &PL_sv_undef; } |
332 | inline SV *to_sv (const char * v) { return newSVpv (v, 0); } |
413 | inline SV *to_sv (const char * v) { return v ? newSVpv (v, 0) : &PL_sv_undef; } |
333 | inline SV *to_sv (bool v) { return newSViv (v); } |
414 | inline SV *to_sv (bool v) { return newSViv (v); } |
334 | inline SV *to_sv ( signed char v) { return newSViv (v); } |
415 | inline SV *to_sv ( signed char v) { return newSViv (v); } |
335 | inline SV *to_sv (unsigned char v) { return newSViv (v); } |
416 | inline SV *to_sv (unsigned char v) { return newSViv (v); } |
336 | inline SV *to_sv ( signed short v) { return newSViv (v); } |
417 | inline SV *to_sv ( signed short v) { return newSViv (v); } |
337 | inline SV *to_sv (unsigned short v) { return newSVuv (v); } |
418 | inline SV *to_sv (unsigned short v) { return newSVuv (v); } |
… | |
… | |
346 | inline SV *to_sv (client * v) { return newSVattachable (v, stash_cf_client_wrap); } |
427 | inline SV *to_sv (client * v) { return newSVattachable (v, stash_cf_client_wrap); } |
347 | inline SV *to_sv (player * v) { return newSVattachable (v, stash_cf_player_wrap); } |
428 | inline SV *to_sv (player * v) { return newSVattachable (v, stash_cf_player_wrap); } |
348 | inline SV *to_sv (object * v) { return newSVattachable (v, v && v->type == PLAYER ? stash_cf_object_player_wrap : stash_cf_object_wrap); } |
429 | inline SV *to_sv (object * v) { return newSVattachable (v, v && v->type == PLAYER ? stash_cf_object_player_wrap : stash_cf_object_wrap); } |
349 | inline SV *to_sv (maptile * v) { return newSVattachable (v, stash_cf_map_wrap); } |
430 | inline SV *to_sv (maptile * v) { return newSVattachable (v, stash_cf_map_wrap); } |
350 | inline SV *to_sv (archetype * v) { return newSVattachable (v, stash_cf_arch_wrap); } |
431 | inline SV *to_sv (archetype * v) { return newSVattachable (v, stash_cf_arch_wrap); } |
|
|
432 | inline SV *to_sv (region * v) { return newSVattachable (v, stash_cf_region_wrap); } |
351 | inline SV *to_sv (partylist * v) { return newSVptr (v, stash_cf_party_wrap); } |
433 | inline SV *to_sv (partylist * v) { return newSVptr (v, stash_cf_party_wrap); } |
352 | inline SV *to_sv (region * v) { return newSVptr (v, stash_cf_region_wrap); } |
|
|
353 | inline SV *to_sv (living * v) { return newSVptr (v, stash_cf_living_wrap); } |
434 | inline SV *to_sv (living * v) { return newSVptr (v, stash_cf_living_wrap); } |
354 | |
435 | |
355 | inline SV *to_sv (object & v) { return to_sv (&v); } |
436 | inline SV *to_sv (object & v) { return to_sv (&v); } |
356 | inline SV *to_sv (living & v) { return to_sv (&v); } |
437 | inline SV *to_sv (living & v) { return to_sv (&v); } |
357 | |
438 | |
… | |
… | |
363 | char buf[128]; |
444 | char buf[128]; |
364 | snprintf (buf, 128, "<1.%" PRIx64 ">", v.seq); |
445 | snprintf (buf, 128, "<1.%" PRIx64 ">", v.seq); |
365 | return newSVpv (buf, 0); |
446 | return newSVpv (buf, 0); |
366 | } |
447 | } |
367 | |
448 | |
368 | inline void sv_to (SV *sv, shstr &v) { v = SvOK (sv) ? SvPV_nolen (sv) : 0; } |
449 | inline void sv_to (SV *sv, shstr &v) { v = SvOK (sv) ? SvPVutf8_nolen (sv) : 0; } |
369 | inline void sv_to (SV *sv, char * &v) { free (v); v = SvOK (sv) ? strdup (SvPV_nolen (sv)) : 0; } |
450 | inline void sv_to (SV *sv, char * &v) { free (v); v = SvOK (sv) ? strdup (SvPV_nolen (sv)) : 0; } |
370 | inline void sv_to (SV *sv, bool &v) { v = SvIV (sv); } |
451 | inline void sv_to (SV *sv, bool &v) { v = SvIV (sv); } |
371 | inline void sv_to (SV *sv, signed char &v) { v = SvIV (sv); } |
452 | inline void sv_to (SV *sv, signed char &v) { v = SvIV (sv); } |
372 | inline void sv_to (SV *sv, unsigned char &v) { v = SvIV (sv); } |
453 | inline void sv_to (SV *sv, unsigned char &v) { v = SvIV (sv); } |
373 | inline void sv_to (SV *sv, signed short &v) { v = SvIV (sv); } |
454 | inline void sv_to (SV *sv, signed short &v) { v = SvIV (sv); } |
374 | inline void sv_to (SV *sv, unsigned short &v) { v = SvIV (sv); } |
455 | inline void sv_to (SV *sv, unsigned short &v) { v = SvIV (sv); } |
375 | inline void sv_to (SV *sv, signed int &v) { v = SvIV (sv); } |
456 | inline void sv_to (SV *sv, signed int &v) { v = SvIV (sv); } |
376 | inline void sv_to (SV *sv, unsigned int &v) { v = SvUV (sv); } |
457 | inline void sv_to (SV *sv, unsigned int &v) { v = SvUV (sv); } |
377 | inline void sv_to (SV *sv, signed long &v) { v = SvIV (sv); } |
458 | inline void sv_to (SV *sv, signed long &v) { v = SvIV (sv); } |
378 | inline void sv_to (SV *sv, unsigned long &v) { v = SvUV (sv); } |
459 | inline void sv_to (SV *sv, unsigned long &v) { v = SvUV (sv); } |
379 | inline void sv_to (SV *sv, signed long long &v) { v = ( signed long long)SvVAL64 (sv); } |
460 | inline void sv_to (SV *sv, signed long long &v) { v = ( signed long long)SvVAL64 (sv); } |
380 | inline void sv_to (SV *sv, unsigned long long &v) { v = (unsigned long long)SvVAL64 (sv); } |
461 | inline void sv_to (SV *sv, unsigned long long &v) { v = (unsigned long long)SvVAL64 (sv); } |
381 | inline void sv_to (SV *sv, float &v) { v = SvNV (sv); } |
462 | inline void sv_to (SV *sv, float &v) { v = SvNV (sv); } |
382 | inline void sv_to (SV *sv, double &v) { v = SvNV (sv); } |
463 | inline void sv_to (SV *sv, double &v) { v = SvNV (sv); } |
383 | inline void sv_to (SV *sv, client * &v) { v = (client *)(attachable *)SvPTR_ornull (sv, "cf::client"); } |
464 | inline void sv_to (SV *sv, client * &v) { v = (client *)(attachable *)SvPTR_ornull (sv, "cf::client"); } |
384 | inline void sv_to (SV *sv, player * &v) { v = (player *)(attachable *)SvPTR_ornull (sv, "cf::player"); } |
465 | inline void sv_to (SV *sv, player * &v) { v = (player *)(attachable *)SvPTR_ornull (sv, "cf::player"); } |
385 | inline void sv_to (SV *sv, object * &v) { v = (object *)(attachable *)SvPTR_ornull (sv, "cf::object"); } |
466 | inline void sv_to (SV *sv, object * &v) { v = (object *)(attachable *)SvPTR_ornull (sv, "cf::object"); } |
386 | inline void sv_to (SV *sv, archetype * &v) { v = (archetype *)(attachable *)SvPTR_ornull (sv, "cf::arch"); } |
467 | inline void sv_to (SV *sv, archetype * &v) { v = (archetype *)(attachable *)SvPTR_ornull (sv, "cf::arch"); } |
387 | inline void sv_to (SV *sv, maptile * &v) { v = (maptile *)(attachable *)SvPTR_ornull (sv, "cf::map"); } |
468 | inline void sv_to (SV *sv, maptile * &v) { v = (maptile *)(attachable *)SvPTR_ornull (sv, "cf::map"); } |
|
|
469 | inline void sv_to (SV *sv, region * &v) { v = (region *)(attachable *)SvPTR_ornull (sv, "cf::region"); } |
388 | inline void sv_to (SV *sv, attachable * &v) { v = (attachable *)SvPTR_ornull (sv, "cf::attachable"); } |
470 | inline void sv_to (SV *sv, attachable * &v) { v = (attachable *)SvPTR_ornull (sv, "cf::attachable"); } |
389 | inline void sv_to (SV *sv, partylist * &v) { v = (partylist *)SvPTR_ornull (sv, "cf::party"); } |
471 | inline void sv_to (SV *sv, partylist * &v) { v = (partylist *)SvPTR_ornull (sv, "cf::party"); } |
390 | inline void sv_to (SV *sv, region * &v) { v = (region *)SvPTR_ornull (sv, "cf::region"); } |
|
|
391 | inline void sv_to (SV *sv, living * &v) { v = (living *)SvPTR_ornull (sv, "cf::living"); } |
472 | inline void sv_to (SV *sv, living * &v) { v = (living *)SvPTR_ornull (sv, "cf::living"); } |
|
|
473 | inline void sv_to (SV *sv, object_freezer * &v) { v = (object_freezer *)SvPTR_ornull (sv, "cf::object::freezer"); } |
|
|
474 | inline void sv_to (SV *sv, object_thawer * &v) { v = (object_thawer *)SvPTR_ornull (sv, "cf::object::thawer" ); } |
392 | |
475 | |
393 | //inline void sv_to (SV *sv, faceinfo * &v) { v = &faces [face_find (SvPV_nolen (sv), 0)]; } |
476 | //inline void sv_to (SV *sv, faceinfo * &v) { v = &faces [face_find (SvPV_nolen (sv), 0)]; } |
394 | inline void sv_to (SV *sv, treasurelist * &v) { v = treasurelist::find (SvPV_nolen (sv)); } |
477 | inline void sv_to (SV *sv, treasurelist * &v) { v = treasurelist::find (SvPV_nolen (sv)); } |
395 | |
478 | |
396 | template<class T> |
479 | template<class T> |
397 | inline void sv_to (SV *sv, refptr<T> &v) { T *tmp; sv_to (sv, tmp); v = tmp; } |
480 | inline void sv_to (SV *sv, refptr<T> &v) { T *tmp; sv_to (sv, tmp); v = tmp; } |
398 | |
481 | |
399 | template<int N> |
482 | template<int N> |
400 | inline void sv_to (SV *sv, char (&v)[N]) { assign (v, SvPV_nolen (sv)); } |
483 | inline void sv_to (SV *sv, char (&v)[N]) { assign (v, SvPV_nolen (sv)); } |
401 | |
484 | |
402 | inline void sv_to (SV *sv, rangetype &v) { v = (rangetype) SvIV (sv); } |
|
|
403 | inline void sv_to (SV *sv, bowtype_t &v) { v = (bowtype_t) SvIV (sv); } |
485 | inline void sv_to (SV *sv, bowtype_t &v) { v = (bowtype_t) SvIV (sv); } |
404 | inline void sv_to (SV *sv, petmode_t &v) { v = (petmode_t) SvIV (sv); } |
486 | inline void sv_to (SV *sv, petmode_t &v) { v = (petmode_t) SvIV (sv); } |
405 | inline void sv_to (SV *sv, usekeytype &v) { v = (usekeytype) SvIV (sv); } |
487 | inline void sv_to (SV *sv, usekeytype &v) { v = (usekeytype) SvIV (sv); } |
406 | inline void sv_to (SV *sv, unapplymode &v) { v = (unapplymode) SvIV (sv); } |
488 | inline void sv_to (SV *sv, unapplymode &v) { v = (unapplymode) SvIV (sv); } |
407 | |
489 | |
408 | inline void sv_to (SV *sv, std::string &v) |
490 | inline void sv_to (SV *sv, std::string &v) |
409 | { |
491 | { |
410 | STRLEN len; |
492 | STRLEN len; |
411 | char *data = SvPVbyte (sv, len); |
493 | char *data = SvPVbyte (sv, len); |
412 | v.assign (data, len); |
494 | v.assign (data, len); |
413 | } |
495 | } |
414 | |
496 | |
415 | inline void sv_to (SV *sv, UUID &v) |
497 | inline void sv_to (SV *sv, UUID &v) |
416 | { |
498 | { |
417 | unsigned int version; |
499 | unsigned int version; |
418 | |
500 | |
419 | if (2 != sscanf (SvPV_nolen (sv), "<%d.%" SCNx64 ">", &version, &v.seq) || 1 != version) |
501 | if (2 != sscanf (SvPV_nolen (sv), "<%d.%" SCNx64 ">", &version, &v.seq) || 1 != version) |
420 | croak ("unparsable uuid: %s", SvPV_nolen (sv)); |
502 | croak ("unparsable uuid: %s", SvPV_nolen (sv)); |
… | |
… | |
610 | perl_construct (perl); |
692 | perl_construct (perl); |
611 | |
693 | |
612 | PL_exit_flags |= PERL_EXIT_DESTRUCT_END; |
694 | PL_exit_flags |= PERL_EXIT_DESTRUCT_END; |
613 | |
695 | |
614 | const char *argv[] = { |
696 | const char *argv[] = { |
615 | "", |
697 | settings.argv [0], |
616 | "-e" |
698 | "-e" |
617 | "use Event; use Coro;" // required for bootstrap |
699 | "use Event; use Coro;" // required for bootstrap |
618 | "cf->bootstrap;" // required for datadir :*> |
700 | "cf->bootstrap;" // required for datadir :*> |
619 | "unshift @INC, cf::datadir ();" |
701 | "unshift @INC, cf::datadir ();" |
620 | "require cf;" |
702 | "require cf;" |
… | |
… | |
648 | void |
730 | void |
649 | attachable::instantiate () |
731 | attachable::instantiate () |
650 | { |
732 | { |
651 | if (attach) |
733 | if (attach) |
652 | { |
734 | { |
653 | invoke (EVENT_ATTACHABLE_INSTANTIATE, ARG_STRING (attach), DT_END); |
735 | INVOKE_ATTACHABLE (INSTANTIATE, this, ARG_STRING (attach)); |
654 | attach = 0; |
736 | attach = 0; |
655 | } |
737 | } |
656 | } |
738 | } |
657 | |
739 | |
658 | void |
740 | void |
659 | attachable::reattach () |
741 | attachable::reattach () |
660 | { |
742 | { |
661 | optimise (); |
743 | optimise (); |
662 | //TODO: check for _attachment's, very important for restarts |
744 | //TODO: check for _attachment's, very important for restarts |
663 | invoke (EVENT_ATTACHABLE_REATTACH, DT_END); |
745 | INVOKE_ATTACHABLE (REATTACH, this); |
664 | } |
746 | } |
665 | |
747 | |
666 | static event_klass klass_of[NUM_EVENT_TYPES] = { |
748 | static event_klass klass_of[NUM_EVENT_TYPES] = { |
667 | # define def(type,name) KLASS_ ## type, |
749 | # define def(type,name) KLASS_ ## type, |
668 | # include "eventinc.h" |
750 | # include "eventinc.h" |
… | |
… | |
711 | } |
793 | } |
712 | |
794 | |
713 | void |
795 | void |
714 | global::gather_callbacks (AV *&callbacks, event_type event) const |
796 | global::gather_callbacks (AV *&callbacks, event_type event) const |
715 | { |
797 | { |
716 | ::gather_callbacks (callbacks, cb_object, event); |
798 | ::gather_callbacks (callbacks, cb_global, event); |
717 | } |
799 | } |
718 | |
800 | |
719 | void |
801 | void |
720 | object::gather_callbacks (AV *&callbacks, event_type event) const |
802 | object::gather_callbacks (AV *&callbacks, event_type event) const |
721 | { |
803 | { |
722 | if (subtype && type + subtype * NUM_SUBTYPES <= AvFILLp (cb_type)) |
804 | if (subtype && type + subtype * NUM_TYPES <= AvFILLp (cb_type)) |
723 | { |
805 | { |
724 | SV *registry = AvARRAY (cb_type)[type + subtype * NUM_SUBTYPES]; |
806 | SV *registry = AvARRAY (cb_type)[type + subtype * NUM_TYPES]; |
725 | |
807 | |
726 | if (registry && SvROK (registry) && SvTYPE (SvRV (registry)) == SVt_PVAV) |
808 | if (registry && SvROK (registry) && SvTYPE (SvRV (registry)) == SVt_PVAV) |
727 | ::gather_callbacks (callbacks, (AV *)SvRV (registry), event); |
809 | ::gather_callbacks (callbacks, (AV *)SvRV (registry), event); |
728 | } |
810 | } |
729 | |
811 | |
… | |
… | |
765 | { |
847 | { |
766 | attachable::gather_callbacks (callbacks, event); |
848 | attachable::gather_callbacks (callbacks, event); |
767 | ::gather_callbacks (callbacks, cb_map, event); |
849 | ::gather_callbacks (callbacks, cb_map, event); |
768 | } |
850 | } |
769 | |
851 | |
|
|
852 | void |
|
|
853 | _recalc_want (bitset<NUM_EVENT_TYPES> &set, AV *registry) |
|
|
854 | { |
|
|
855 | for (int event = 0; event <= AvFILLp (registry); ++event) |
|
|
856 | { |
|
|
857 | SV *cbs_ = AvARRAY (registry)[event]; |
|
|
858 | |
|
|
859 | // element must be list of callback entries |
|
|
860 | if (cbs_ && SvROK (cbs_) && SvTYPE (SvRV (cbs_)) == SVt_PVAV) |
|
|
861 | { |
|
|
862 | AV *cbs = (AV *)SvRV (cbs_); |
|
|
863 | |
|
|
864 | // no callback entries, no callbacks to call |
|
|
865 | if (AvFILLp (cbs) >= 0) |
|
|
866 | set.set (event); |
|
|
867 | } |
|
|
868 | } |
|
|
869 | } |
|
|
870 | |
|
|
871 | // very slow and inefficient way to recalculate the global want bitsets |
|
|
872 | void |
|
|
873 | _recalc_want () |
|
|
874 | { |
|
|
875 | ev_want_event.reset (); |
|
|
876 | |
|
|
877 | _recalc_want (ev_want_event, cb_global); |
|
|
878 | _recalc_want (ev_want_event, cb_attachable); |
|
|
879 | _recalc_want (ev_want_event, cb_object); |
|
|
880 | _recalc_want (ev_want_event, cb_client); |
|
|
881 | _recalc_want (ev_want_event, cb_player); |
|
|
882 | _recalc_want (ev_want_event, cb_map); |
|
|
883 | |
|
|
884 | ev_want_type.reset (); |
|
|
885 | |
|
|
886 | for (int type = 0; type <= AvFILLp (cb_type); ++type) |
|
|
887 | { |
|
|
888 | SV *cbs_ = AvARRAY (cb_type)[type]; |
|
|
889 | |
|
|
890 | // element must be list of callback entries |
|
|
891 | if (cbs_ && SvROK (cbs_) && SvTYPE (SvRV (cbs_)) == SVt_PVAV) |
|
|
892 | { |
|
|
893 | AV *cbs = (AV *)SvRV (cbs_); |
|
|
894 | |
|
|
895 | // no callback entries, no callbacks to call |
|
|
896 | if (AvFILLp (cbs) >= 0) |
|
|
897 | ev_want_type.set (type % NUM_TYPES); |
|
|
898 | } |
|
|
899 | } |
|
|
900 | } |
|
|
901 | |
770 | bool |
902 | bool |
771 | attachable::invoke (event_type event, ...) |
903 | attachable::invoke (event_type event, ...) |
772 | { |
904 | { |
773 | data_type dt; |
905 | data_type dt; |
774 | va_list ap; |
|
|
775 | |
|
|
776 | va_start (ap, event); |
|
|
777 | |
906 | |
778 | // callback call ordering should be: |
907 | // callback call ordering should be: |
779 | // 1. per-object callback |
908 | // 1. per-object callback |
780 | // 2. per-class object |
909 | // 2. per-class object |
781 | // 3. per-type callback |
910 | // 3. per-type callback |
… | |
… | |
785 | gather_callbacks (callbacks, event); |
914 | gather_callbacks (callbacks, event); |
786 | |
915 | |
787 | // short-circuit processing if no callbacks found/defined |
916 | // short-circuit processing if no callbacks found/defined |
788 | if (!callbacks) |
917 | if (!callbacks) |
789 | return 0; |
918 | return 0; |
|
|
919 | |
|
|
920 | va_list ap; |
|
|
921 | va_start (ap, event); |
790 | |
922 | |
791 | CALL_BEGIN (3); |
923 | CALL_BEGIN (3); |
792 | CALL_ARG_SV (newSViv (event)); // only used for debugging nowadays |
924 | CALL_ARG_SV (newSViv (event)); // only used for debugging nowadays |
793 | CALL_ARG_SV (newRV_noinc ((SV *)callbacks)); |
925 | CALL_ARG_SV (newRV_noinc ((SV *)callbacks)); |
794 | |
926 | |
… | |
… | |
829 | } |
961 | } |
830 | |
962 | |
831 | SV * |
963 | SV * |
832 | cfperl_result (int idx) |
964 | cfperl_result (int idx) |
833 | { |
965 | { |
834 | AV *av = get_av ("cfperl::invoke_results", 0); |
966 | AV *av = get_av ("cf::INVOKE_RESULTS", 0); |
835 | if (!av) |
967 | if (!av) |
836 | return &PL_sv_undef; |
968 | return &PL_sv_undef; |
837 | |
969 | |
838 | SV **sv = av_fetch (av, idx, 0); |
970 | SV **sv = av_fetch (av, idx, 0); |
839 | if (!sv) |
971 | if (!sv) |
… | |
… | |
853 | { |
985 | { |
854 | return SvNV (cfperl_result (idx)); |
986 | return SvNV (cfperl_result (idx)); |
855 | } |
987 | } |
856 | |
988 | |
857 | ///////////////////////////////////////////////////////////////////////////// |
989 | ///////////////////////////////////////////////////////////////////////////// |
|
|
990 | // various c++ => perl glue functions |
858 | |
991 | |
859 | void |
992 | void |
860 | cfperl_emergency_save () |
993 | cfperl_emergency_save () |
861 | { |
994 | { |
862 | CALL_BEGIN (0); |
995 | CALL_BEGIN (0); |
… | |
… | |
871 | CALL_ARG (make_core); |
1004 | CALL_ARG (make_core); |
872 | CALL_CALL ("cf::post_cleanup", G_VOID); |
1005 | CALL_CALL ("cf::post_cleanup", G_VOID); |
873 | CALL_END; |
1006 | CALL_END; |
874 | } |
1007 | } |
875 | |
1008 | |
|
|
1009 | void |
|
|
1010 | cfperl_make_book (object *book, int level) |
|
|
1011 | { |
|
|
1012 | CALL_BEGIN (2); |
|
|
1013 | CALL_ARG (book); |
|
|
1014 | CALL_ARG (level); |
|
|
1015 | CALL_CALL ("ext::books::make_book", G_VOID); |
|
|
1016 | CALL_END; |
|
|
1017 | } |
|
|
1018 | |
|
|
1019 | void |
|
|
1020 | cfperl_send_msg (client *ns, int color, const char *type, const char *msg) |
|
|
1021 | { |
|
|
1022 | CALL_BEGIN (4); |
|
|
1023 | CALL_ARG (ns); |
|
|
1024 | CALL_ARG (type); |
|
|
1025 | CALL_ARG_SV (newSVpv_utf8 (msg)); |
|
|
1026 | CALL_ARG (color); |
|
|
1027 | CALL_CALL ("cf::client::send_msg", G_VOID); |
|
|
1028 | CALL_END; |
|
|
1029 | } |
|
|
1030 | |
|
|
1031 | int |
|
|
1032 | cfperl_can_merge (object *ob1, object *ob2) |
|
|
1033 | { |
|
|
1034 | int can; |
|
|
1035 | |
|
|
1036 | CALL_BEGIN (2); |
|
|
1037 | CALL_ARG (ob1); |
|
|
1038 | CALL_ARG (ob2); |
|
|
1039 | CALL_CALL ("cf::_can_merge", G_SCALAR); |
|
|
1040 | can = count && SvTRUE (TOPs); |
|
|
1041 | CALL_END; |
|
|
1042 | |
|
|
1043 | return can; |
|
|
1044 | } |
|
|
1045 | |
|
|
1046 | player * |
|
|
1047 | player::find (const char *name) |
|
|
1048 | { |
|
|
1049 | CALL_BEGIN (1); |
|
|
1050 | CALL_ARG (name); |
|
|
1051 | CALL_CALL ("cf::player::find", G_SCALAR); |
|
|
1052 | |
|
|
1053 | player *retval; |
|
|
1054 | |
|
|
1055 | if (count) |
|
|
1056 | sv_to (POPs, retval); |
|
|
1057 | else |
|
|
1058 | retval = 0; |
|
|
1059 | |
|
|
1060 | CALL_END; |
|
|
1061 | |
|
|
1062 | return retval; |
|
|
1063 | } |
|
|
1064 | |
876 | maptile * |
1065 | maptile * |
877 | maptile::find_sync (const char *path, maptile *origin) |
1066 | maptile::find_sync (const char *path, maptile *origin) |
878 | { |
1067 | { |
879 | CALL_BEGIN (2); |
1068 | CALL_BEGIN (2); |
880 | CALL_ARG (path); |
1069 | CALL_ARG (path); |
… | |
… | |
892 | |
1081 | |
893 | return retval; |
1082 | return retval; |
894 | } |
1083 | } |
895 | |
1084 | |
896 | maptile * |
1085 | maptile * |
897 | maptile::find_async (const char *path, maptile *origin) |
1086 | maptile::find_async (const char *path, maptile *origin, bool load) |
898 | { |
1087 | { |
899 | CALL_BEGIN (2); |
1088 | CALL_BEGIN (3); |
900 | CALL_ARG (path); |
1089 | CALL_ARG (path); |
901 | CALL_ARG (origin); |
1090 | CALL_ARG (origin); |
|
|
1091 | CALL_ARG (load); |
902 | CALL_CALL ("cf::map::find_async", G_SCALAR); |
1092 | CALL_CALL ("cf::map::find_async", G_SCALAR); |
903 | |
1093 | |
904 | maptile *retval; |
1094 | maptile *retval; |
905 | |
1095 | |
906 | if (count) |
1096 | if (count) |
… | |
… | |
942 | CALL_ARG (exit); |
1132 | CALL_ARG (exit); |
943 | CALL_CALL ("cf::object::player::enter_exit", G_VOID); |
1133 | CALL_CALL ("cf::object::player::enter_exit", G_VOID); |
944 | CALL_END; |
1134 | CALL_END; |
945 | } |
1135 | } |
946 | |
1136 | |
|
|
1137 | const char * |
|
|
1138 | object::ref () const |
|
|
1139 | { |
|
|
1140 | if (type == PLAYER) |
|
|
1141 | return format ("player/<1.%llx>/%s", (unsigned long long)uuid.seq, &name); |
|
|
1142 | else |
|
|
1143 | return 0; |
|
|
1144 | } |
|
|
1145 | |
|
|
1146 | object * |
|
|
1147 | object::deref (const char *ref) |
|
|
1148 | { |
|
|
1149 | object *retval; |
|
|
1150 | |
|
|
1151 | CALL_BEGIN (1); |
|
|
1152 | CALL_ARG (ref); |
|
|
1153 | CALL_CALL ("cf::object::deref", G_SCALAR); |
|
|
1154 | |
|
|
1155 | if (count) |
|
|
1156 | sv_to (POPs, retval); |
|
|
1157 | else |
|
|
1158 | retval = 0; |
|
|
1159 | |
|
|
1160 | CALL_END; |
|
|
1161 | |
|
|
1162 | return retval; |
|
|
1163 | } |
|
|
1164 | |
|
|
1165 | void |
|
|
1166 | log_backtrace (const char *msg) |
|
|
1167 | { |
|
|
1168 | #if HAVE_BACKTRACE |
|
|
1169 | void *addr [20]; |
|
|
1170 | int size = backtrace (addr, 20); |
|
|
1171 | |
|
|
1172 | CALL_BEGIN (size); |
|
|
1173 | CALL_ARG (msg); |
|
|
1174 | for (int i = 0; i < size; ++i) |
|
|
1175 | CALL_ARG ((IV)addr [i]); |
|
|
1176 | CALL_CALL ("cf::_log_backtrace", G_VOID); |
|
|
1177 | CALL_END; |
|
|
1178 | #endif |
|
|
1179 | } |
|
|
1180 | |
947 | ///////////////////////////////////////////////////////////////////////////// |
1181 | ///////////////////////////////////////////////////////////////////////////// |
948 | |
1182 | |
949 | struct EventAPI *watcher_base::GEventAPI; |
1183 | struct EventAPI *watcher_base::GEventAPI; |
950 | struct CoroAPI *coroapi::GCoroAPI; |
1184 | struct CoroAPI *coroapi::GCoroAPI; |
951 | |
1185 | |
952 | int coroapi::cede_counter; |
1186 | int coroapi::cede_counter; |
953 | double (*coroapi::time)(); |
|
|
954 | double coroapi::next_cede; |
1187 | tstamp coroapi::next_cede; |
955 | |
1188 | |
956 | void coroapi::do_cede_to_tick () |
1189 | void coroapi::do_cede_to_tick () |
957 | { |
1190 | { |
958 | cede_counter = 0; |
1191 | cede_counter = 0; |
959 | |
1192 | |
… | |
… | |
1090 | |
1323 | |
1091 | _connect_to_perl (); |
1324 | _connect_to_perl (); |
1092 | |
1325 | |
1093 | newCONSTSUB (stash_cf, "VERSION", newSVpv (VERSION, sizeof (VERSION) - 1)); |
1326 | newCONSTSUB (stash_cf, "VERSION", newSVpv (VERSION, sizeof (VERSION) - 1)); |
1094 | |
1327 | |
1095 | { |
1328 | //{ |
1096 | require_pv ("Time::HiRes"); |
1329 | // require_pv ("Time::HiRes"); |
1097 | |
1330 | // |
1098 | SV **svp = hv_fetch (PL_modglobal, "Time::NVtime", 12, 0); |
1331 | // SV **svp = hv_fetch (PL_modglobal, "Time::NVtime", 12, 0); |
1099 | if (!svp) croak ("Time::HiRes is required"); |
1332 | // if (!svp) croak ("Time::HiRes is required"); |
1100 | if (!SvIOK(*svp)) croak ("Time::NVtime isn’t a function pointer"); |
1333 | // if (!SvIOK(*svp)) croak ("Time::NVtime isn’t a function pointer"); |
1101 | coroapi::time = INT2PTR (double(*)(), SvIV(*svp)); |
1334 | // coroapi::time = INT2PTR (double(*)(), SvIV(*svp)); |
1102 | } |
1335 | //} |
1103 | |
1336 | |
1104 | static const struct { |
1337 | static const struct { |
1105 | const char *name; |
1338 | const char *name; |
1106 | IV iv; |
1339 | IV iv; |
1107 | } *civ, const_iv[] = { |
1340 | } *civ, const_iv[] = { |
1108 | # define const_iv(name) { # name, (IV)name }, |
1341 | # define const_iv(name) { # name, (IV)name }, |
1109 | const_iv (llevError) const_iv (llevInfo) const_iv (llevDebug) const_iv (llevMonster) |
1342 | const_iv (llevError) const_iv (llevInfo) const_iv (llevDebug) const_iv (llevMonster) |
|
|
1343 | const_iv (logBacktrace) |
1110 | |
1344 | |
1111 | const_iv (Map0Cmd) const_iv (Map1Cmd) const_iv (Map1aCmd) |
1345 | const_iv (Map0Cmd) const_iv (Map1Cmd) const_iv (Map1aCmd) |
1112 | |
1346 | |
1113 | const_iv (MAP_CLIENT_X) const_iv (MAP_CLIENT_Y) |
1347 | const_iv (MAP_CLIENT_X) const_iv (MAP_CLIENT_Y) |
1114 | |
1348 | |
1115 | const_iv (MAX_TIME) |
1349 | const_iv (MAX_TIME) |
|
|
1350 | |
|
|
1351 | const_iv (NUM_BODY_LOCATIONS) |
|
|
1352 | const_iv (body_range) const_iv (body_shield) const_iv (body_combat) |
|
|
1353 | const_iv (body_arm) const_iv (body_torso) const_iv (body_head) |
|
|
1354 | const_iv (body_neck) const_iv (body_skill) const_iv (body_finger) |
|
|
1355 | const_iv (body_shoulder) const_iv (body_foot) const_iv (body_hand) |
|
|
1356 | const_iv (body_wrist) const_iv (body_waist) |
1116 | |
1357 | |
1117 | const_iv (PLAYER) const_iv (TRANSPORT) const_iv (ROD) const_iv (TREASURE) |
1358 | const_iv (PLAYER) const_iv (TRANSPORT) const_iv (ROD) const_iv (TREASURE) |
1118 | const_iv (POTION) const_iv (FOOD) const_iv (POISON) const_iv (BOOK) |
1359 | const_iv (POTION) const_iv (FOOD) const_iv (POISON) const_iv (BOOK) |
1119 | const_iv (CLOCK) const_iv (ARROW) const_iv (BOW) const_iv (WEAPON) |
1360 | const_iv (CLOCK) const_iv (ARROW) const_iv (BOW) const_iv (WEAPON) |
1120 | const_iv (ARMOUR) const_iv (PEDESTAL) const_iv (ALTAR) const_iv (LOCKED_DOOR) |
1361 | const_iv (ARMOUR) const_iv (PEDESTAL) const_iv (ALTAR) const_iv (LOCKED_DOOR) |
… | |
… | |
1141 | const_iv (CONTAINER) const_iv (ARMOUR_IMPROVER) const_iv (WEAPON_IMPROVER) const_iv (SKILLSCROLL) |
1382 | const_iv (CONTAINER) const_iv (ARMOUR_IMPROVER) const_iv (WEAPON_IMPROVER) const_iv (SKILLSCROLL) |
1142 | const_iv (DEEP_SWAMP) const_iv (IDENTIFY_ALTAR) const_iv (MENU) const_iv (RUNE) |
1383 | const_iv (DEEP_SWAMP) const_iv (IDENTIFY_ALTAR) const_iv (MENU) const_iv (RUNE) |
1143 | const_iv (TRAP) const_iv (POWER_CRYSTAL) const_iv (CORPSE) const_iv (DISEASE) |
1384 | const_iv (TRAP) const_iv (POWER_CRYSTAL) const_iv (CORPSE) const_iv (DISEASE) |
1144 | const_iv (SYMPTOM) const_iv (BUILDER) const_iv (MATERIAL) const_iv (ITEM_TRANSFORMER) |
1385 | const_iv (SYMPTOM) const_iv (BUILDER) const_iv (MATERIAL) const_iv (ITEM_TRANSFORMER) |
1145 | |
1386 | |
1146 | const_iv (NUM_SUBTYPES) |
1387 | const_iv (NUM_TYPES) const_iv (NUM_SUBTYPES) |
1147 | |
1388 | |
1148 | const_iv (ST_BD_BUILD) const_iv (ST_BD_REMOVE) |
1389 | const_iv (ST_BD_BUILD) const_iv (ST_BD_REMOVE) |
1149 | const_iv (ST_MAT_FLOOR) const_iv (ST_MAT_WALL) const_iv (ST_MAT_ITEM) |
1390 | const_iv (ST_MAT_FLOOR) const_iv (ST_MAT_WALL) const_iv (ST_MAT_ITEM) |
1150 | |
1391 | |
1151 | const_iv (AT_PHYSICAL) const_iv (AT_MAGIC) const_iv (AT_FIRE) const_iv (AT_ELECTRICITY) |
1392 | const_iv (AT_PHYSICAL) const_iv (AT_MAGIC) const_iv (AT_FIRE) const_iv (AT_ELECTRICITY) |
… | |
… | |
1159 | const_iv (WEAP_HIT) const_iv (WEAP_SLASH) const_iv (WEAP_PIERCE) const_iv (WEAP_CLEAVE) |
1400 | const_iv (WEAP_HIT) const_iv (WEAP_SLASH) const_iv (WEAP_PIERCE) const_iv (WEAP_CLEAVE) |
1160 | const_iv (WEAP_SLICE) const_iv (WEAP_STAB) const_iv (WEAP_WHIP) const_iv (WEAP_CRUSH) |
1401 | const_iv (WEAP_SLICE) const_iv (WEAP_STAB) const_iv (WEAP_WHIP) const_iv (WEAP_CRUSH) |
1161 | const_iv (WEAP_BLUD) |
1402 | const_iv (WEAP_BLUD) |
1162 | |
1403 | |
1163 | const_iv (FLAG_ALIVE) const_iv (FLAG_WIZ) const_iv (FLAG_REMOVED) const_iv (FLAG_FREED) |
1404 | const_iv (FLAG_ALIVE) const_iv (FLAG_WIZ) const_iv (FLAG_REMOVED) const_iv (FLAG_FREED) |
1164 | const_iv (FLAG_WAS_WIZ) const_iv (FLAG_APPLIED) const_iv (FLAG_UNPAID) const_iv (FLAG_USE_SHIELD) |
1405 | const_iv (FLAG_APPLIED) const_iv (FLAG_UNPAID) const_iv (FLAG_USE_SHIELD) |
1165 | const_iv (FLAG_NO_PICK) const_iv (FLAG_ANIMATE) const_iv (FLAG_MONSTER) const_iv (FLAG_FRIENDLY) |
1406 | const_iv (FLAG_NO_PICK) const_iv (FLAG_ANIMATE) const_iv (FLAG_MONSTER) const_iv (FLAG_FRIENDLY) |
1166 | const_iv (FLAG_GENERATOR) const_iv (FLAG_IS_THROWN) const_iv (FLAG_AUTO_APPLY) const_iv (FLAG_PLAYER_SOLD) |
1407 | const_iv (FLAG_GENERATOR) const_iv (FLAG_IS_THROWN) const_iv (FLAG_AUTO_APPLY) const_iv (FLAG_PLAYER_SOLD) |
1167 | const_iv (FLAG_SEE_INVISIBLE) const_iv (FLAG_CAN_ROLL) const_iv (FLAG_OVERLAY_FLOOR) const_iv (FLAG_IS_TURNABLE) |
1408 | const_iv (FLAG_SEE_INVISIBLE) const_iv (FLAG_CAN_ROLL) const_iv (FLAG_OVERLAY_FLOOR) const_iv (FLAG_IS_TURNABLE) |
1168 | const_iv (FLAG_IS_USED_UP) const_iv (FLAG_IDENTIFIED) const_iv (FLAG_REFLECTING) const_iv (FLAG_CHANGING) |
1409 | const_iv (FLAG_IS_USED_UP) const_iv (FLAG_IDENTIFIED) const_iv (FLAG_REFLECTING) const_iv (FLAG_CHANGING) |
1169 | const_iv (FLAG_SPLITTING) const_iv (FLAG_HITBACK) const_iv (FLAG_STARTEQUIP) const_iv (FLAG_BLOCKSVIEW) |
1410 | const_iv (FLAG_SPLITTING) const_iv (FLAG_HITBACK) const_iv (FLAG_STARTEQUIP) const_iv (FLAG_BLOCKSVIEW) |
… | |
… | |
1181 | const_iv (FLAG_USE_ROD) const_iv (FLAG_USE_HORN) const_iv (FLAG_MAKE_INVIS) const_iv (FLAG_INV_LOCKED) |
1422 | const_iv (FLAG_USE_ROD) const_iv (FLAG_USE_HORN) const_iv (FLAG_MAKE_INVIS) const_iv (FLAG_INV_LOCKED) |
1182 | const_iv (FLAG_IS_WOODED) const_iv (FLAG_IS_HILLY) const_iv (FLAG_READY_SKILL) const_iv (FLAG_READY_WEAPON) |
1423 | const_iv (FLAG_IS_WOODED) const_iv (FLAG_IS_HILLY) const_iv (FLAG_READY_SKILL) const_iv (FLAG_READY_WEAPON) |
1183 | const_iv (FLAG_NO_SKILL_IDENT) const_iv (FLAG_BLIND) const_iv (FLAG_SEE_IN_DARK) const_iv (FLAG_IS_CAULDRON) |
1424 | const_iv (FLAG_NO_SKILL_IDENT) const_iv (FLAG_BLIND) const_iv (FLAG_SEE_IN_DARK) const_iv (FLAG_IS_CAULDRON) |
1184 | const_iv (FLAG_NO_STEAL) const_iv (FLAG_ONE_HIT) const_iv (FLAG_CLIENT_SENT) const_iv (FLAG_BERSERK) |
1425 | const_iv (FLAG_NO_STEAL) const_iv (FLAG_ONE_HIT) const_iv (FLAG_CLIENT_SENT) const_iv (FLAG_BERSERK) |
1185 | const_iv (FLAG_NEUTRAL) const_iv (FLAG_NO_ATTACK) const_iv (FLAG_NO_DAMAGE) const_iv (FLAG_OBJ_ORIGINAL) |
1426 | const_iv (FLAG_NEUTRAL) const_iv (FLAG_NO_ATTACK) const_iv (FLAG_NO_DAMAGE) const_iv (FLAG_OBJ_ORIGINAL) |
1186 | const_iv (FLAG_OBJ_SAVE_ON_OVL) const_iv (FLAG_ACTIVATE_ON_PUSH) const_iv (FLAG_ACTIVATE_ON_RELEASE) const_iv (FLAG_IS_WATER) |
1427 | const_iv (FLAG_ACTIVATE_ON_PUSH) const_iv (FLAG_ACTIVATE_ON_RELEASE) const_iv (FLAG_IS_WATER) |
1187 | const_iv (FLAG_CONTENT_ON_GEN) const_iv (FLAG_IS_A_TEMPLATE) const_iv (FLAG_IS_BUILDABLE) |
1428 | const_iv (FLAG_CONTENT_ON_GEN) const_iv (FLAG_IS_A_TEMPLATE) const_iv (FLAG_IS_BUILDABLE) |
1188 | const_iv (FLAG_DESTROY_ON_DEATH) const_iv (FLAG_NO_MAP_SAVE) |
1429 | const_iv (FLAG_DESTROY_ON_DEATH) const_iv (FLAG_NO_MAP_SAVE) |
1189 | |
1430 | |
1190 | const_iv (NDI_BLACK) const_iv (NDI_WHITE) const_iv (NDI_NAVY) const_iv (NDI_RED) |
1431 | const_iv (NDI_BLACK) const_iv (NDI_WHITE) const_iv (NDI_NAVY) const_iv (NDI_RED) |
1191 | const_iv (NDI_ORANGE) const_iv (NDI_BLUE) const_iv (NDI_DK_ORANGE) const_iv (NDI_GREEN) |
1432 | const_iv (NDI_ORANGE) const_iv (NDI_BLUE) const_iv (NDI_DK_ORANGE) const_iv (NDI_GREEN) |
1192 | const_iv (NDI_LT_GREEN) const_iv (NDI_GREY) const_iv (NDI_BROWN) const_iv (NDI_GOLD) |
1433 | const_iv (NDI_LT_GREEN) const_iv (NDI_GREY) const_iv (NDI_BROWN) const_iv (NDI_GOLD) |
1193 | const_iv (NDI_TAN) const_iv (NDI_MAX_COLOR) const_iv (NDI_COLOR_MASK) const_iv (NDI_UNIQUE) |
1434 | const_iv (NDI_TAN) const_iv (NDI_MAX_COLOR) const_iv (NDI_COLOR_MASK) const_iv (NDI_UNIQUE) |
|
|
1435 | const_iv (NDI_ALL) const_iv (NDI_DEF) const_iv (NDI_REPLY) const_iv (NDI_CLIENT_MASK) |
1194 | const_iv (NDI_ALL) |
1436 | const_iv (NDI_NOCREATE) |
1195 | |
1437 | |
1196 | const_iv (UPD_LOCATION) const_iv (UPD_FLAGS) const_iv (UPD_WEIGHT) const_iv (UPD_FACE) |
1438 | const_iv (UPD_LOCATION) const_iv (UPD_FLAGS) const_iv (UPD_WEIGHT) const_iv (UPD_FACE) |
1197 | const_iv (UPD_NAME) const_iv (UPD_ANIM) const_iv (UPD_ANIMSPEED) const_iv (UPD_NROF) |
1439 | const_iv (UPD_NAME) const_iv (UPD_ANIM) const_iv (UPD_ANIMSPEED) const_iv (UPD_NROF) |
1198 | |
1440 | |
1199 | const_iv (UPD_SP_MANA) const_iv (UPD_SP_GRACE) const_iv (UPD_SP_DAMAGE) |
1441 | const_iv (UPD_SP_MANA) const_iv (UPD_SP_GRACE) const_iv (UPD_SP_DAMAGE) |
|
|
1442 | |
|
|
1443 | const_iv (SP_RAISE_DEAD) |
|
|
1444 | const_iv (SP_RUNE) |
|
|
1445 | const_iv (SP_MAKE_MARK) |
|
|
1446 | const_iv (SP_BOLT) |
|
|
1447 | const_iv (SP_BULLET) |
|
|
1448 | const_iv (SP_EXPLOSION) |
|
|
1449 | const_iv (SP_CONE) |
|
|
1450 | const_iv (SP_BOMB) |
|
|
1451 | const_iv (SP_WONDER) |
|
|
1452 | const_iv (SP_SMITE) |
|
|
1453 | const_iv (SP_MAGIC_MISSILE) |
|
|
1454 | const_iv (SP_SUMMON_GOLEM) |
|
|
1455 | const_iv (SP_DIMENSION_DOOR) |
|
|
1456 | const_iv (SP_MAGIC_MAPPING) |
|
|
1457 | const_iv (SP_MAGIC_WALL) |
|
|
1458 | const_iv (SP_DESTRUCTION) |
|
|
1459 | const_iv (SP_PERCEIVE_SELF) |
|
|
1460 | const_iv (SP_WORD_OF_RECALL) |
|
|
1461 | const_iv (SP_INVISIBLE) |
|
|
1462 | const_iv (SP_PROBE) |
|
|
1463 | const_iv (SP_HEALING) |
|
|
1464 | const_iv (SP_CREATE_FOOD) |
|
|
1465 | const_iv (SP_EARTH_TO_DUST) |
|
|
1466 | const_iv (SP_CHANGE_ABILITY) |
|
|
1467 | const_iv (SP_BLESS) |
|
|
1468 | const_iv (SP_CURSE) |
|
|
1469 | const_iv (SP_SUMMON_MONSTER) |
|
|
1470 | const_iv (SP_CHARGING) |
|
|
1471 | const_iv (SP_POLYMORPH) |
|
|
1472 | const_iv (SP_ALCHEMY) |
|
|
1473 | const_iv (SP_REMOVE_CURSE) |
|
|
1474 | const_iv (SP_IDENTIFY) |
|
|
1475 | const_iv (SP_DETECTION) |
|
|
1476 | const_iv (SP_MOOD_CHANGE) |
|
|
1477 | const_iv (SP_MOVING_BALL) |
|
|
1478 | const_iv (SP_SWARM) |
|
|
1479 | const_iv (SP_CHANGE_MANA) |
|
|
1480 | const_iv (SP_DISPEL_RUNE) |
|
|
1481 | const_iv (SP_CREATE_MISSILE) |
|
|
1482 | const_iv (SP_CONSECRATE) |
|
|
1483 | const_iv (SP_ANIMATE_WEAPON) |
|
|
1484 | const_iv (SP_LIGHT) |
|
|
1485 | const_iv (SP_CHANGE_MAP_LIGHT) |
|
|
1486 | const_iv (SP_FAERY_FIRE) |
|
|
1487 | const_iv (SP_CAUSE_DISEASE) |
|
|
1488 | const_iv (SP_AURA) |
|
|
1489 | const_iv (SP_TOWN_PORTAL) |
|
|
1490 | const_iv (SP_PARTY_SPELL) |
1200 | |
1491 | |
1201 | const_iv (F_APPLIED) const_iv (F_LOCATION) const_iv (F_UNPAID) const_iv (F_MAGIC) |
1492 | const_iv (F_APPLIED) const_iv (F_LOCATION) const_iv (F_UNPAID) const_iv (F_MAGIC) |
1202 | const_iv (F_CURSED) const_iv (F_DAMNED) const_iv (F_OPEN) const_iv (F_NOPICK) |
1493 | const_iv (F_CURSED) const_iv (F_DAMNED) const_iv (F_OPEN) const_iv (F_NOPICK) |
1203 | const_iv (F_LOCKED) |
1494 | const_iv (F_LOCKED) |
1204 | |
1495 | |
… | |
… | |
1277 | const_iv (SYMMETRY_Y) const_iv (SYMMETRY_XY) |
1568 | const_iv (SYMMETRY_Y) const_iv (SYMMETRY_XY) |
1278 | |
1569 | |
1279 | const_iv (GT_ENVIRONMENT) const_iv (GT_INVISIBLE) const_iv (GT_STARTEQUIP) |
1570 | const_iv (GT_ENVIRONMENT) const_iv (GT_INVISIBLE) const_iv (GT_STARTEQUIP) |
1280 | const_iv (GT_APPLY) const_iv (GT_ONLY_GOOD) const_iv (GT_UPDATE_INV) |
1571 | const_iv (GT_APPLY) const_iv (GT_ONLY_GOOD) const_iv (GT_UPDATE_INV) |
1281 | const_iv (GT_MINIMAL) |
1572 | const_iv (GT_MINIMAL) |
|
|
1573 | |
|
|
1574 | const_iv (FT_FACE) const_iv (FT_MUSIC) const_iv (FT_SOUND) |
|
|
1575 | const_iv (FT_RSRC) const_iv (FT_NUM) |
1282 | }; |
1576 | }; |
1283 | |
1577 | |
1284 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
1578 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
1285 | newCONSTSUB (stash_cf, (char *)civ->name, newSViv (civ->iv)); |
1579 | newCONSTSUB (stash_cf, (char *)civ->name, newSViv (civ->iv)); |
1286 | |
1580 | |
… | |
… | |
1307 | } |
1601 | } |
1308 | } |
1602 | } |
1309 | |
1603 | |
1310 | void _connect_to_perl () |
1604 | void _connect_to_perl () |
1311 | |
1605 | |
|
|
1606 | void _recalc_want () |
|
|
1607 | |
1312 | void _global_reattach () |
1608 | void _global_reattach () |
1313 | CODE: |
1609 | CODE: |
1314 | { |
1610 | { |
1315 | // reattach to all attachable objects in the game. |
1611 | // reattach to all attachable objects in the game. |
1316 | for_all_clients (ns) |
1612 | for_all_clients (ns) |
1317 | ns->reattach (); |
1613 | ns->reattach (); |
1318 | |
1614 | |
1319 | for_all_objects (op) |
1615 | for_all_objects (op) |
1320 | op->reattach (); |
1616 | op->reattach (); |
1321 | } |
1617 | } |
1322 | |
|
|
1323 | void _post_tick () |
|
|
1324 | CODE: |
|
|
1325 | coroapi::next_cede = SvNV (sv_next_tick) - TICK * (1. - 1. / CEDES_PER_TICK); |
|
|
1326 | |
1618 | |
1327 | # support function for map-world.ext |
1619 | # support function for map-world.ext |
1328 | void _quantise (SV *data_sv, SV *plt_sv) |
1620 | void _quantise (SV *data_sv, SV *plt_sv) |
1329 | CODE: |
1621 | CODE: |
1330 | { |
1622 | { |
… | |
… | |
1363 | len -= 3; |
1655 | len -= 3; |
1364 | } |
1656 | } |
1365 | |
1657 | |
1366 | SvCUR_set (data_sv, dst - SvPVX (data_sv)); |
1658 | SvCUR_set (data_sv, dst - SvPVX (data_sv)); |
1367 | } |
1659 | } |
|
|
1660 | |
|
|
1661 | void _post_tick () |
|
|
1662 | CODE: |
|
|
1663 | coroapi::next_cede = SvNV (sv_next_tick) - TICK * (1. - 1. / CEDES_PER_TICK); |
|
|
1664 | |
|
|
1665 | NV till_cede () |
|
|
1666 | CODE: |
|
|
1667 | RETVAL = coroapi::next_cede - now (); |
|
|
1668 | OUTPUT: |
|
|
1669 | RETVAL |
|
|
1670 | |
|
|
1671 | NV till_tick () |
|
|
1672 | CODE: |
|
|
1673 | RETVAL = SvNV (sv_next_tick) - now (); |
|
|
1674 | OUTPUT: |
|
|
1675 | RETVAL |
1368 | |
1676 | |
1369 | NV floor (NV x) |
1677 | NV floor (NV x) |
1370 | |
1678 | |
1371 | NV ceil (NV x) |
1679 | NV ceil (NV x) |
1372 | |
1680 | |
… | |
… | |
1380 | default: croak ("cf::rndm requires none, one or two parameters."); break; |
1688 | default: croak ("cf::rndm requires none, one or two parameters."); break; |
1381 | } |
1689 | } |
1382 | OUTPUT: |
1690 | OUTPUT: |
1383 | RETVAL |
1691 | RETVAL |
1384 | |
1692 | |
|
|
1693 | NV clamp (NV value, NV min_value, NV max_value) |
|
|
1694 | CODE: |
|
|
1695 | RETVAL = clamp (value, min_value, max_value); |
|
|
1696 | OUTPUT: |
|
|
1697 | RETVAL |
|
|
1698 | |
|
|
1699 | NV lerp (NV value, NV min_in, NV max_in, NV min_out, NV max_out) |
|
|
1700 | CODE: |
|
|
1701 | RETVAL = lerp (value, min_in, max_in, min_out, max_out); |
|
|
1702 | OUTPUT: |
|
|
1703 | RETVAL |
|
|
1704 | |
|
|
1705 | void cede_to_tick () |
|
|
1706 | CODE: |
|
|
1707 | coroapi::cede_to_tick (); |
|
|
1708 | |
1385 | void server_tick () |
1709 | void server_tick () |
1386 | CODE: |
1710 | CODE: |
|
|
1711 | NOW = now (); |
1387 | runtime = SvNVx (sv_runtime); |
1712 | runtime = SvNVx (sv_runtime); |
1388 | server_tick (); |
1713 | server_tick (); |
1389 | |
1714 | |
1390 | void |
1715 | void |
|
|
1716 | log_backtrace (utf8_string msg) |
|
|
1717 | |
|
|
1718 | void |
1391 | LOG (int level, utf8_string msg) |
1719 | LOG (int flags, utf8_string msg) |
1392 | PROTOTYPE: $$ |
1720 | PROTOTYPE: $$ |
1393 | C_ARGS: (LogLevel)level, "%s", msg |
1721 | C_ARGS: flags, "%s", msg |
1394 | |
1722 | |
1395 | octet_string path_combine (octet_string base, octet_string path) |
1723 | octet_string path_combine (octet_string base, octet_string path) |
1396 | PROTOTYPE: $$ |
1724 | PROTOTYPE: $$ |
1397 | |
1725 | |
1398 | octet_string path_combine_and_normalize (octet_string base, octet_string path) |
1726 | octet_string path_combine_and_normalize (octet_string base, octet_string path) |
1399 | PROTOTYPE: $$ |
1727 | PROTOTYPE: $$ |
1400 | |
|
|
1401 | const_octet_string |
|
|
1402 | get_maps_directory (octet_string path) |
|
|
1403 | PROTOTYPE: $ |
|
|
1404 | ALIAS: maps_directory = 0 |
|
|
1405 | CODE: |
|
|
1406 | RETVAL = create_pathname (path); |
|
|
1407 | OUTPUT: RETVAL |
|
|
1408 | |
1728 | |
1409 | void |
1729 | void |
1410 | sub_generation_inc () |
1730 | sub_generation_inc () |
1411 | CODE: |
1731 | CODE: |
1412 | PL_sub_generation++; |
1732 | PL_sub_generation++; |
… | |
… | |
1435 | } |
1755 | } |
1436 | OUTPUT: RETVAL |
1756 | OUTPUT: RETVAL |
1437 | |
1757 | |
1438 | void abort () |
1758 | void abort () |
1439 | |
1759 | |
|
|
1760 | void reset_signals () |
|
|
1761 | |
1440 | void fork_abort (octet_string cause = "cf::fork_abort") |
1762 | void fork_abort (octet_string cause = "cf::fork_abort") |
1441 | |
1763 | |
1442 | void cleanup (octet_string cause, bool make_core = false) |
1764 | void cleanup (octet_string cause, bool make_core = false) |
1443 | |
1765 | |
1444 | void emergency_save () |
1766 | void emergency_save () |
… | |
… | |
1532 | #object *mortals (U32 index) |
1854 | #object *mortals (U32 index) |
1533 | # CODE: |
1855 | # CODE: |
1534 | # RETVAL = index < attachable::mortals.size () ? attachable::mortals [index] : 0; |
1856 | # RETVAL = index < attachable::mortals.size () ? attachable::mortals [index] : 0; |
1535 | # OUTPUT: RETVAL |
1857 | # OUTPUT: RETVAL |
1536 | |
1858 | |
1537 | INCLUDE: $PERL $srcdir/genacc attachable ../include/cfperl.h | |
1859 | INCLUDE: $PERL $srcdir/genacc attachable ../include/util.h ../include/cfperl.h | |
1538 | |
1860 | |
1539 | MODULE = cf PACKAGE = cf::global |
1861 | MODULE = cf PACKAGE = cf::global |
1540 | |
1862 | |
1541 | int invoke (SV *klass, int event, ...) |
1863 | int invoke (SV *klass, int event, ...) |
1542 | CODE: |
1864 | CODE: |
… | |
… | |
1578 | object *actives (U32 index) |
1900 | object *actives (U32 index) |
1579 | CODE: |
1901 | CODE: |
1580 | RETVAL = index < actives.size () ? actives [index] : 0; |
1902 | RETVAL = index < actives.size () ? actives [index] : 0; |
1581 | OUTPUT: RETVAL |
1903 | OUTPUT: RETVAL |
1582 | |
1904 | |
|
|
1905 | const char *slot_use_name (U32 slot) |
|
|
1906 | ALIAS: |
|
|
1907 | slot_nonuse_name = 1 |
|
|
1908 | CODE: |
|
|
1909 | { |
|
|
1910 | if (slot >= NUM_BODY_LOCATIONS) |
|
|
1911 | croak ("body slot index out of range"); |
|
|
1912 | |
|
|
1913 | switch (ix) |
|
|
1914 | { |
|
|
1915 | case 0: RETVAL = body_locations[slot].use_name; break; |
|
|
1916 | case 1: RETVAL = body_locations[slot].nonuse_name; break; |
|
|
1917 | } |
|
|
1918 | } |
|
|
1919 | OUTPUT: |
|
|
1920 | RETVAL |
|
|
1921 | |
1583 | # missing properties |
1922 | # missing properties |
1584 | |
1923 | |
1585 | object *head (object *op) |
1924 | object *head (object *op) |
1586 | PROTOTYPE: $ |
1925 | PROTOTYPE: $ |
1587 | CODE: |
1926 | CODE: |
1588 | RETVAL = op->head_ (); |
1927 | RETVAL = op->head_ (); |
1589 | OUTPUT: RETVAL |
|
|
1590 | |
|
|
1591 | int is_head (object *op) |
|
|
1592 | PROTOTYPE: $ |
|
|
1593 | CODE: |
|
|
1594 | RETVAL = op->head_ () == op; |
|
|
1595 | OUTPUT: RETVAL |
1928 | OUTPUT: RETVAL |
1596 | |
1929 | |
1597 | void |
1930 | void |
1598 | inv (object *obj) |
1931 | inv (object *obj) |
1599 | PROTOTYPE: $ |
1932 | PROTOTYPE: $ |
… | |
… | |
1612 | int |
1945 | int |
1613 | num_animations (object *op) |
1946 | num_animations (object *op) |
1614 | CODE: |
1947 | CODE: |
1615 | RETVAL = NUM_ANIMATIONS (op); |
1948 | RETVAL = NUM_ANIMATIONS (op); |
1616 | OUTPUT: RETVAL |
1949 | OUTPUT: RETVAL |
|
|
1950 | |
|
|
1951 | int slot_info (object *op, UV slot, int value = 0) |
|
|
1952 | ALIAS: |
|
|
1953 | slot_used = 1 |
|
|
1954 | CODE: |
|
|
1955 | { |
|
|
1956 | if (slot >= NUM_BODY_LOCATIONS) |
|
|
1957 | croak ("body slot index out of range"); |
|
|
1958 | |
|
|
1959 | RETVAL = ix ? op->slot[slot].used : op->slot[slot].info; |
|
|
1960 | |
|
|
1961 | if (items > 2) |
|
|
1962 | if (ix) |
|
|
1963 | op->slot[slot].used = value; |
|
|
1964 | else |
|
|
1965 | op->slot[slot].info = value; |
|
|
1966 | } |
|
|
1967 | OUTPUT: |
|
|
1968 | RETVAL |
1617 | |
1969 | |
1618 | object *find_best_object_match (object *op, utf8_string match) |
1970 | object *find_best_object_match (object *op, utf8_string match) |
1619 | |
1971 | |
1620 | object *find_marked_object (object *op) |
1972 | object *find_marked_object (object *op) |
1621 | |
1973 | |
… | |
… | |
1726 | |
2078 | |
1727 | void add_button_link (object *button, maptile *map, int connected); |
2079 | void add_button_link (object *button, maptile *map, int connected); |
1728 | |
2080 | |
1729 | void remove_button_link (object *op); |
2081 | void remove_button_link (object *op); |
1730 | |
2082 | |
|
|
2083 | void handle_apply_yield (object *op); |
|
|
2084 | |
1731 | |
2085 | |
1732 | MODULE = cf PACKAGE = cf::object PREFIX = cf_ |
2086 | MODULE = cf PACKAGE = cf::object PREFIX = cf_ |
1733 | |
2087 | |
1734 | object *cf_insert_ob_in_ob (object *ob, object *where) |
2088 | object *cf_insert_ob_in_ob (object *ob, object *where) |
1735 | |
2089 | |
… | |
… | |
1737 | # dumb kludgy misdesigned plug-in api slowly gets on my nerves. |
2091 | # dumb kludgy misdesigned plug-in api slowly gets on my nerves. |
1738 | |
2092 | |
1739 | object *new (utf8_string archetype = 0) |
2093 | object *new (utf8_string archetype = 0) |
1740 | PROTOTYPE: ;$ |
2094 | PROTOTYPE: ;$ |
1741 | CODE: |
2095 | CODE: |
1742 | RETVAL = archetype ? get_archetype (archetype) : cf_create_object (); |
2096 | RETVAL = archetype ? get_archetype (archetype) : object::create (); |
1743 | OUTPUT: |
2097 | OUTPUT: |
1744 | RETVAL |
2098 | RETVAL |
1745 | |
2099 | |
|
|
2100 | object *find_object (U32 tag) |
|
|
2101 | |
|
|
2102 | # TODO: nuke |
1746 | object *insert_ob_in_map_at (object *ob, maptile *where, object_ornull *orig, int flag, int x, int y) |
2103 | object *insert_ob_in_map_at (object *ob, maptile *where, object_ornull *orig, int flag, int x, int y) |
1747 | PROTOTYPE: $$$$$$ |
2104 | PROTOTYPE: $$$$$$ |
1748 | CODE: |
2105 | CODE: |
1749 | { |
2106 | { |
1750 | int unused_type; |
2107 | int unused_type; |
1751 | RETVAL = (object *)object_insert (&unused_type, ob, 0, where, orig, flag, x, y); |
2108 | RETVAL = (object *)object_insert (&unused_type, ob, 0, where, orig, flag, x, y); |
1752 | } |
2109 | } |
1753 | |
|
|
1754 | player *contr (object *op) |
|
|
1755 | CODE: |
|
|
1756 | RETVAL = op->contr; |
|
|
1757 | OUTPUT: RETVAL |
|
|
1758 | |
2110 | |
1759 | const_utf8_string get_ob_key_value (object *op, utf8_string key) |
2111 | const_utf8_string get_ob_key_value (object *op, utf8_string key) |
1760 | |
2112 | |
1761 | bool set_ob_key_value (object *op, utf8_string key, utf8_string value = 0, int add_key = 1) |
2113 | bool set_ob_key_value (object *op, utf8_string key, utf8_string value = 0, int add_key = 1) |
1762 | |
2114 | |
… | |
… | |
1803 | |
2155 | |
1804 | void message (object *op, utf8_string txt, int flags = NDI_ORANGE | NDI_UNIQUE) |
2156 | void message (object *op, utf8_string txt, int flags = NDI_ORANGE | NDI_UNIQUE) |
1805 | CODE: |
2157 | CODE: |
1806 | new_draw_info (flags, 0, op, txt); |
2158 | new_draw_info (flags, 0, op, txt); |
1807 | |
2159 | |
1808 | object *cf_player_send_inventory (object *op) |
|
|
1809 | |
|
|
1810 | octet_string cf_player_get_ip (object *op) |
|
|
1811 | ALIAS: ip = 0 |
|
|
1812 | |
|
|
1813 | object *cf_player_get_marked_item (object *op) |
|
|
1814 | ALIAS: marked_item = 0 |
|
|
1815 | |
|
|
1816 | void cf_player_set_marked_item (object *op, object *ob) |
|
|
1817 | |
|
|
1818 | partylist *cf_player_get_party (object *op) |
|
|
1819 | ALIAS: party = 0 |
|
|
1820 | |
|
|
1821 | void cf_player_set_party (object *op, partylist *party) |
|
|
1822 | |
|
|
1823 | void kill_player (object *op) |
2160 | void kill_player (object *op) |
1824 | |
2161 | |
1825 | void esrv_update_item (object *op, int what, object *item) |
2162 | void esrv_update_item (object *op, int what, object *item) |
1826 | C_ARGS: what, op, item |
2163 | C_ARGS: what, op, item |
1827 | |
|
|
1828 | void clear_los (object *op) |
|
|
1829 | |
2164 | |
1830 | int command_summon (object *op, utf8_string params) |
2165 | int command_summon (object *op, utf8_string params) |
1831 | |
2166 | |
1832 | int command_arrest (object *op, utf8_string params) |
2167 | int command_arrest (object *op, utf8_string params) |
1833 | |
2168 | |
… | |
… | |
1852 | pl->ob->stats.hp = pl->ob->stats.maxhp; |
2187 | pl->ob->stats.hp = pl->ob->stats.maxhp; |
1853 | pl->ob->stats.sp = pl->ob->stats.maxsp; |
2188 | pl->ob->stats.sp = pl->ob->stats.maxsp; |
1854 | pl->ob->stats.grace = pl->ob->stats.maxgrace; |
2189 | pl->ob->stats.grace = pl->ob->stats.maxgrace; |
1855 | pl->orig_stats = pl->ob->stats; |
2190 | pl->orig_stats = pl->ob->stats; |
1856 | |
2191 | |
|
|
2192 | void clear_los (player *pl) |
|
|
2193 | |
1857 | void cf_player_move (player *pl, int dir) |
2194 | void cf_player_move (player *pl, int dir) |
1858 | |
|
|
1859 | void play_sound_player_only (player *pl, int soundnum, int x = 0, int y = 0); |
|
|
1860 | |
2195 | |
1861 | bool |
2196 | bool |
1862 | cell_visible (player *pl, int dx, int dy) |
2197 | cell_visible (player *pl, int dx, int dy) |
1863 | CODE: |
2198 | CODE: |
1864 | RETVAL = FABS (dx) <= pl->ns->mapx / 2 && FABS (dy) <= pl->ns->mapy / 2 |
2199 | RETVAL = FABS (dx) <= pl->ns->mapx / 2 && FABS (dy) <= pl->ns->mapy / 2 |
… | |
… | |
1970 | if (SV **elem = av_fetch ((AV *)palette, idx [offs], 0)) |
2305 | if (SV **elem = av_fetch ((AV *)palette, idx [offs], 0)) |
1971 | { |
2306 | { |
1972 | object *ob = get_archetype (SvPVutf8_nolen (*elem)); |
2307 | object *ob = get_archetype (SvPVutf8_nolen (*elem)); |
1973 | ob->flag [FLAG_NO_MAP_SAVE] = true; |
2308 | ob->flag [FLAG_NO_MAP_SAVE] = true; |
1974 | THIS->insert (ob, x, y, 0, INS_ABOVE_FLOOR_ONLY); |
2309 | THIS->insert (ob, x, y, 0, INS_ABOVE_FLOOR_ONLY); |
|
|
2310 | |
|
|
2311 | if (ob->randomitems) |
|
|
2312 | { |
|
|
2313 | if (!ob->above) |
|
|
2314 | { |
|
|
2315 | ob->create_treasure (ob->randomitems); |
|
|
2316 | |
|
|
2317 | for (object *op = ob->above; op; op = op->above) |
|
|
2318 | op->flag [FLAG_NO_MAP_SAVE] = true; |
|
|
2319 | } |
|
|
2320 | |
|
|
2321 | ob->randomitems = 0; |
|
|
2322 | } |
1975 | } |
2323 | } |
1976 | } |
2324 | } |
1977 | } |
2325 | } |
1978 | |
2326 | |
1979 | skip_space: ; |
2327 | skip_space: ; |
… | |
… | |
1990 | palette = SvRV (palette); |
2338 | palette = SvRV (palette); |
1991 | |
2339 | |
1992 | STRLEN idxlen; |
2340 | STRLEN idxlen; |
1993 | const uint8_t *idx = (const uint8_t *)SvPVbyte (data, idxlen); |
2341 | const uint8_t *idx = (const uint8_t *)SvPVbyte (data, idxlen); |
1994 | |
2342 | |
1995 | region **regionmap = (region **)malloc ( |
2343 | region_ptr *regionmap = new region_ptr [av_len ((AV *)palette) + 1]; |
1996 | (av_len ((AV *)palette) + 1) * sizeof (region *)); |
|
|
1997 | uint8_t *regions = salloc<uint8_t> (THIS->size ()); |
2344 | uint8_t *regions = salloc<uint8_t> (THIS->size ()); |
1998 | |
2345 | |
1999 | for (int i = av_len ((AV *)palette) + 1; i--; ) |
2346 | for (int i = av_len ((AV *)palette) + 1; i--; ) |
2000 | regionmap [i] = region::find ( |
2347 | regionmap [i] = region::find (SvPVutf8_nolen (*av_fetch ((AV *)palette, i, 1))); |
2001 | SvPVutf8_nolen (*av_fetch ((AV *)palette, i, 1))); |
|
|
2002 | |
2348 | |
2003 | for (int y = 0; y < THIS->height; ++y) |
2349 | for (int y = 0; y < THIS->height; ++y) |
2004 | memcpy (regions + y * THIS->width, idx + offset + y * stride, THIS->width); |
2350 | memcpy (regions + y * THIS->width, idx + offset + y * stride, THIS->width); |
2005 | |
2351 | |
2006 | sfree (THIS->regions, THIS->size ()); |
2352 | sfree (THIS->regions, THIS->size ()); |
2007 | free (THIS->regionmap); |
2353 | delete [] THIS->regionmap; |
2008 | |
2354 | |
2009 | THIS->regions = regions; |
2355 | THIS->regions = regions; |
2010 | THIS->regionmap = regionmap; |
2356 | THIS->regionmap = regionmap; |
2011 | } |
2357 | } |
2012 | |
2358 | |
… | |
… | |
2032 | } |
2378 | } |
2033 | } |
2379 | } |
2034 | |
2380 | |
2035 | op->destroy (); |
2381 | op->destroy (); |
2036 | } |
2382 | } |
2037 | |
|
|
2038 | void play_sound_map (maptile *map, int x, int y, int sound_num) |
|
|
2039 | |
2383 | |
2040 | int out_of_map (maptile *map, int x, int y) |
2384 | int out_of_map (maptile *map, int x, int y) |
2041 | |
2385 | |
2042 | void |
2386 | void |
2043 | trigger (maptile *map, long connection, bool state = true) |
2387 | trigger (maptile *map, long connection, bool state = true) |
… | |
… | |
2199 | rmp.decoroptions = decoroptions; |
2543 | rmp.decoroptions = decoroptions; |
2200 | rmp.orientation = orientation; |
2544 | rmp.orientation = orientation; |
2201 | rmp.origin_y = origin_y; |
2545 | rmp.origin_y = origin_y; |
2202 | rmp.origin_x = origin_x; |
2546 | rmp.origin_x = origin_x; |
2203 | rmp.random_seed = random_seed; |
2547 | rmp.random_seed = random_seed; |
2204 | rmp.total_map_hp = total_map_hp; |
2548 | rmp.total_map_hp = (uint64_t) total_map_hp; |
2205 | rmp.map_layout_style = map_layout_style; |
2549 | rmp.map_layout_style = map_layout_style; |
2206 | rmp.treasureoptions = treasureoptions; |
2550 | rmp.treasureoptions = treasureoptions; |
2207 | rmp.symmetry_used = symmetry_used; |
2551 | rmp.symmetry_used = symmetry_used; |
2208 | rmp.region = region; |
2552 | rmp.region = region; |
2209 | rmp.custom = custom; |
2553 | rmp.custom = custom; |
… | |
… | |
2213 | OUTPUT: |
2557 | OUTPUT: |
2214 | RETVAL |
2558 | RETVAL |
2215 | |
2559 | |
2216 | MODULE = cf PACKAGE = cf::arch |
2560 | MODULE = cf PACKAGE = cf::arch |
2217 | |
2561 | |
2218 | archetype *find (utf8_string name) |
2562 | int archetypes_size () |
2219 | CODE: |
2563 | CODE: |
2220 | RETVAL = archetype::find (name); |
2564 | RETVAL = archetypes.size (); |
2221 | OUTPUT: |
2565 | OUTPUT: RETVAL |
2222 | RETVAL |
|
|
2223 | |
2566 | |
2224 | archetype *first() |
2567 | archetype *archetypes (U32 index) |
2225 | PROTOTYPE: |
2568 | CODE: |
2226 | CODE: |
2569 | RETVAL = index < archetypes.size () ? archetypes [index] : 0; |
2227 | RETVAL = first_archetype; |
2570 | OUTPUT: RETVAL |
|
|
2571 | |
|
|
2572 | object *instantiate (archetype *arch) |
|
|
2573 | CODE: |
|
|
2574 | RETVAL = arch_to_object (arch); |
|
|
2575 | OUTPUT: |
2228 | OUTPUT: RETVAL |
2576 | RETVAL |
2229 | |
2577 | |
2230 | INCLUDE: $PERL $srcdir/genacc archetype ../include/object.h | |
2578 | INCLUDE: $PERL $srcdir/genacc archetype ../include/object.h | |
2231 | |
2579 | |
2232 | MODULE = cf PACKAGE = cf::party |
2580 | MODULE = cf PACKAGE = cf::party |
2233 | |
2581 | |
… | |
… | |
2304 | STRLEN len; |
2652 | STRLEN len; |
2305 | char *buf = SvPVbyte (packet, len); |
2653 | char *buf = SvPVbyte (packet, len); |
2306 | |
2654 | |
2307 | THIS->send_packet (buf, len); |
2655 | THIS->send_packet (buf, len); |
2308 | } |
2656 | } |
|
|
2657 | |
|
|
2658 | faceidx |
|
|
2659 | client::need_face (utf8_string name, int pri = 0) |
|
|
2660 | CODE: |
|
|
2661 | RETVAL = face_find (name, 0); |
|
|
2662 | if (RETVAL) |
|
|
2663 | { |
|
|
2664 | THIS->send_face (RETVAL, pri); |
|
|
2665 | THIS->flush_fx (); |
|
|
2666 | } |
|
|
2667 | OUTPUT: |
|
|
2668 | RETVAL |
|
|
2669 | |
|
|
2670 | int |
|
|
2671 | client::fx_want (int idx, int value = -1) |
|
|
2672 | CODE: |
|
|
2673 | if (0 < idx && idx < FT_NUM) |
|
|
2674 | { |
|
|
2675 | RETVAL = THIS->fx_want [idx]; |
|
|
2676 | if (items > 2) |
|
|
2677 | THIS->fx_want [idx] = value; |
|
|
2678 | } |
|
|
2679 | else |
|
|
2680 | RETVAL = 0; |
|
|
2681 | OUTPUT: |
|
|
2682 | RETVAL |
|
|
2683 | |
|
|
2684 | MODULE = cf PACKAGE = cf::sound PREFIX = sound_ |
|
|
2685 | |
|
|
2686 | faceidx sound_find (utf8_string name) |
|
|
2687 | |
|
|
2688 | void sound_set (utf8_string str, faceidx face) |
|
|
2689 | |
|
|
2690 | # dire hack |
|
|
2691 | void old_sound_index (int idx, faceidx face) |
|
|
2692 | CODE: |
|
|
2693 | extern faceidx old_sound_index [SOUND_CAST_SPELL_0]; |
|
|
2694 | old_sound_index [idx] = face; |
2309 | |
2695 | |
2310 | MODULE = cf PACKAGE = cf::face PREFIX = face_ |
2696 | MODULE = cf PACKAGE = cf::face PREFIX = face_ |
2311 | |
2697 | |
2312 | #INCLUDE: $PERL $srcdir/genacc faceset ../include/face.h | |
2698 | #INCLUDE: $PERL $srcdir/genacc faceset ../include/face.h | |
2313 | |
2699 | |
… | |
… | |
2329 | if (!strcmp (name, BLANK_FACE_NAME)) blank_face = RETVAL; |
2715 | if (!strcmp (name, BLANK_FACE_NAME)) blank_face = RETVAL; |
2330 | if (!strcmp (name, EMPTY_FACE_NAME)) empty_face = RETVAL; |
2716 | if (!strcmp (name, EMPTY_FACE_NAME)) empty_face = RETVAL; |
2331 | } |
2717 | } |
2332 | OUTPUT: RETVAL |
2718 | OUTPUT: RETVAL |
2333 | |
2719 | |
2334 | void set (faceidx idx, int visibility, int magicmap) |
2720 | void set_type (faceidx idx, int value) |
2335 | CODE: |
2721 | ALIAS: |
2336 | faceinfo *f = face_info (idx); |
2722 | set_type = 0 |
2337 | assert (f); |
2723 | set_visibility = 1 |
2338 | f->visibility = visibility; |
2724 | set_magicmap = 2 |
2339 | f->magicmap = magicmap; |
2725 | set_smooth = 3 |
2340 | |
2726 | set_smoothlevel = 4 |
2341 | void set_smooth (faceidx idx, faceidx smooth, int smoothlevel) |
|
|
2342 | CODE: |
2727 | CODE: |
2343 | faceinfo *f = face_info (idx); assert (f); |
2728 | faceinfo *f = face_info (idx); assert (f); |
2344 | f->smooth = smooth; |
2729 | switch (ix) |
2345 | f->smoothlevel = smoothlevel; |
2730 | { |
|
|
2731 | case 0: f->type = value; break; |
|
|
2732 | case 1: f->visibility = value; break; |
|
|
2733 | case 2: f->magicmap = value; break; |
|
|
2734 | case 3: f->smooth = value; break; |
|
|
2735 | case 4: f->smoothlevel = value; break; |
|
|
2736 | } |
2346 | |
2737 | |
2347 | void set_data (faceidx idx, int faceset, SV *data, SV *chksum) |
2738 | void set_data (faceidx idx, int faceset, SV *data, SV *chksum) |
2348 | CODE: |
2739 | CODE: |
2349 | { |
2740 | { |
2350 | facedata *d = face_data (idx, faceset); |
2741 | faceinfo *f = face_info (idx); assert (f); |
2351 | assert (d); |
2742 | facedata *d = &(faceset ? f->data64 : f->data32); |
2352 | sv_to (data, d->data); |
2743 | sv_to (data, d->data); |
2353 | STRLEN clen; |
2744 | STRLEN clen; |
2354 | char *cdata = SvPVbyte (chksum, clen); |
2745 | char *cdata = SvPVbyte (chksum, clen); |
2355 | clen = min (CHKSUM_SIZE, clen); |
2746 | clen = min (CHKSUM_SIZE, clen); |
2356 | |
2747 | |
… | |
… | |
2366 | ns->force_newmap = true; |
2757 | ns->force_newmap = true; |
2367 | } |
2758 | } |
2368 | } |
2759 | } |
2369 | } |
2760 | } |
2370 | |
2761 | |
|
|
2762 | int get_data_size (faceidx idx, int faceset = 0) |
|
|
2763 | CODE: |
|
|
2764 | facedata *d = face_data (idx, faceset); assert (d); |
|
|
2765 | RETVAL = d->data.size (); |
|
|
2766 | OUTPUT: |
|
|
2767 | RETVAL |
|
|
2768 | |
|
|
2769 | SV *get_chksum (faceidx idx, int faceset = 0) |
|
|
2770 | CODE: |
|
|
2771 | facedata *d = face_data (idx, faceset); assert (d); |
|
|
2772 | RETVAL = newSVpvn ((char *)d->chksum, CHKSUM_SIZE); |
|
|
2773 | OUTPUT: |
|
|
2774 | RETVAL |
|
|
2775 | |
2371 | void invalidate (faceidx idx) |
2776 | void invalidate (faceidx idx) |
2372 | CODE: |
2777 | CODE: |
2373 | for_all_clients (ns) |
2778 | for_all_clients (ns) |
2374 | { |
2779 | { |
2375 | ns->faces_sent [idx] = false; |
2780 | ns->faces_sent [idx] = false; |
… | |
… | |
2418 | void invalidate_all () |
2823 | void invalidate_all () |
2419 | CODE: |
2824 | CODE: |
2420 | for_all_clients (ns) |
2825 | for_all_clients (ns) |
2421 | ns->anims_sent.reset (); |
2826 | ns->anims_sent.reset (); |
2422 | |
2827 | |
|
|
2828 | MODULE = cf PACKAGE = cf::object::freezer |
|
|
2829 | |
|
|
2830 | INCLUDE: $PERL $srcdir/genacc object_freezer ../include/cfperl.h | |
|
|
2831 | |
|
|
2832 | SV * |
|
|
2833 | new (char *klass) |
|
|
2834 | CODE: |
|
|
2835 | RETVAL = newSVptr (new object_freezer, gv_stashpv ("cf::object::freezer", 1)); |
|
|
2836 | OUTPUT: RETVAL |
|
|
2837 | |
|
|
2838 | void |
|
|
2839 | DESTROY (SV *sv) |
|
|
2840 | CODE: |
|
|
2841 | object_freezer *self; |
|
|
2842 | sv_to (sv, self); |
|
|
2843 | delete self; |
|
|
2844 | |
|
|
2845 | MODULE = cf PACKAGE = cf::object::thawer |
|
|
2846 | |
|
|
2847 | INCLUDE: $PERL $srcdir/genacc object_thawer ../include/cfperl.h | |
|
|
2848 | |
|
|
2849 | SV * |
|
|
2850 | new_from_file (char *klass, octet_string path) |
|
|
2851 | CODE: |
|
|
2852 | object_thawer *f = new object_thawer (path); |
|
|
2853 | if (!*f) |
|
|
2854 | { |
|
|
2855 | delete f; |
|
|
2856 | XSRETURN_UNDEF; |
|
|
2857 | } |
|
|
2858 | RETVAL = newSVptr (f, gv_stashpv ("cf::object::thawer", 1)); |
|
|
2859 | OUTPUT: RETVAL |
|
|
2860 | |
|
|
2861 | void |
|
|
2862 | DESTROY (SV *sv) |
|
|
2863 | CODE: |
|
|
2864 | object_thawer *self; |
|
|
2865 | sv_to (sv, self); |
|
|
2866 | delete self; |
|
|
2867 | |