… | |
… | |
243 | |
243 | |
244 | // now bless the object _once_ |
244 | // now bless the object _once_ |
245 | return sv_bless (newRV_inc ((SV *)obj->self), stash); |
245 | return sv_bless (newRV_inc ((SV *)obj->self), stash); |
246 | } |
246 | } |
247 | else |
247 | else |
|
|
248 | { |
248 | return newRV_inc ((SV *)obj->self); |
249 | SV *sv = newRV_inc ((SV *)obj->self); |
|
|
250 | |
|
|
251 | if (Gv_AMG (stash)) // handle overload correctly, as the perl core does not |
|
|
252 | SvAMAGIC_on (sv); |
|
|
253 | |
|
|
254 | return sv; |
|
|
255 | } |
249 | } |
256 | } |
250 | |
257 | |
251 | static void |
258 | static void |
252 | clearSVptr (SV *sv) |
259 | clearSVptr (SV *sv) |
253 | { |
260 | { |
… | |
… | |
488 | if (!ext->cb) |
495 | if (!ext->cb) |
489 | ext->cb = newAV (); |
496 | ext->cb = newAV (); |
490 | |
497 | |
491 | return newRV_inc ((SV *)ext->cb); |
498 | return newRV_inc ((SV *)ext->cb); |
492 | } |
499 | } |
493 | |
|
|
494 | #if 0 |
|
|
495 | void attachable::clear () |
|
|
496 | { |
|
|
497 | if (self) |
|
|
498 | { |
|
|
499 | // disconnect Perl from C, to avoid crashes |
|
|
500 | sv_unmagic (SvRV ((SV *)self), PERL_MAGIC_ext); |
|
|
501 | |
|
|
502 | // clear the perl hash, might or might not be a good idea |
|
|
503 | hv_clear ((HV *)SvRV ((SV *)self)); |
|
|
504 | |
|
|
505 | SvREFCNT_dec (self); |
|
|
506 | self = 0; |
|
|
507 | } |
|
|
508 | |
|
|
509 | if (cb) |
|
|
510 | { |
|
|
511 | SvREFCNT_dec (cb); |
|
|
512 | cb = 0; |
|
|
513 | } |
|
|
514 | |
|
|
515 | attach = 0; |
|
|
516 | } |
|
|
517 | #endif |
|
|
518 | |
500 | |
519 | ///////////////////////////////////////////////////////////////////////////// |
501 | ///////////////////////////////////////////////////////////////////////////// |
520 | |
502 | |
521 | extern "C" int cfperl_initPlugin (const char *iversion, f_plug_api gethooksptr) |
503 | extern "C" int cfperl_initPlugin (const char *iversion, f_plug_api gethooksptr) |
522 | { |
504 | { |
… | |
… | |
1265 | const_iv (FLAG_ACTIVATE_ON_RELEASE) |
1247 | const_iv (FLAG_ACTIVATE_ON_RELEASE) |
1266 | const_iv (FLAG_IS_WATER) |
1248 | const_iv (FLAG_IS_WATER) |
1267 | const_iv (FLAG_CONTENT_ON_GEN) |
1249 | const_iv (FLAG_CONTENT_ON_GEN) |
1268 | const_iv (FLAG_IS_A_TEMPLATE) |
1250 | const_iv (FLAG_IS_A_TEMPLATE) |
1269 | const_iv (FLAG_IS_BUILDABLE) |
1251 | const_iv (FLAG_IS_BUILDABLE) |
|
|
1252 | const_iv (FLAG_DESTROY_ON_DEATH) |
|
|
1253 | const_iv (FLAG_NO_SAVE) |
1270 | |
1254 | |
1271 | const_iv (NDI_BLACK) |
1255 | const_iv (NDI_BLACK) |
1272 | const_iv (NDI_WHITE) |
1256 | const_iv (NDI_WHITE) |
1273 | const_iv (NDI_NAVY) |
1257 | const_iv (NDI_NAVY) |
1274 | const_iv (NDI_RED) |
1258 | const_iv (NDI_RED) |
… | |
… | |
1568 | |
1552 | |
1569 | NV floor (NV x) |
1553 | NV floor (NV x) |
1570 | |
1554 | |
1571 | NV ceil (NV x) |
1555 | NV ceil (NV x) |
1572 | |
1556 | |
|
|
1557 | NV rndm (...) |
|
|
1558 | CODE: |
|
|
1559 | switch (items) |
|
|
1560 | { |
|
|
1561 | case 0: RETVAL = rndm (); break; |
|
|
1562 | case 1: RETVAL = rndm (SvUV (ST (0))); break; |
|
|
1563 | case 2: RETVAL = rndm (SvIV (ST (0)), SvIV (ST (1))); break; |
|
|
1564 | default: croak ("cf::rndm requires none, one or two parameters."); break; |
|
|
1565 | } |
|
|
1566 | OUTPUT: |
|
|
1567 | RETVAL |
|
|
1568 | |
1573 | void server_tick () |
1569 | void server_tick () |
1574 | CODE: |
1570 | CODE: |
1575 | runtime = SvNVx (sv_runtime); |
1571 | runtime = SvNVx (sv_runtime); |
1576 | server_tick (); |
1572 | server_tick (); |
1577 | |
1573 | |
… | |
… | |
1623 | } |
1619 | } |
1624 | OUTPUT: RETVAL |
1620 | OUTPUT: RETVAL |
1625 | |
1621 | |
1626 | void abort () |
1622 | void abort () |
1627 | |
1623 | |
|
|
1624 | void fork_abort (char *cause = "cf::fork_abort") |
|
|
1625 | |
1628 | void cleanup (const char *cause, bool make_core = false) |
1626 | void cleanup (const char *cause, bool make_core = false) |
1629 | |
1627 | |
1630 | void emergency_save () |
1628 | void emergency_save () |
1631 | |
1629 | |
1632 | void _exit (int status = 0) |
1630 | void _exit (int status = 0) |
… | |
… | |
1856 | |
1854 | |
1857 | void drop (object *who, object *op) |
1855 | void drop (object *who, object *op) |
1858 | |
1856 | |
1859 | void pick_up (object *who, object *op) |
1857 | void pick_up (object *who, object *op) |
1860 | |
1858 | |
1861 | object *cf_object_insert_object (object *op, object *container) |
|
|
1862 | |
|
|
1863 | object *cf_object_insert_in_ob (object *ob, object *where) |
|
|
1864 | |
|
|
1865 | int cf_object_teleport (object *op, maptile *map, int x, int y) |
1859 | int cf_object_teleport (object *op, maptile *map, int x, int y) |
1866 | |
1860 | |
1867 | void update_object (object *op, int action) |
1861 | void update_object (object *op, int action) |
1868 | |
1862 | |
1869 | object *cf_create_object_by_name (const char *name) |
1863 | object *cf_create_object_by_name (const char *name) |
… | |
… | |
1987 | |
1981 | |
1988 | void esrv_update_item (object *op, int what, object *item) |
1982 | void esrv_update_item (object *op, int what, object *item) |
1989 | C_ARGS: what, op, item |
1983 | C_ARGS: what, op, item |
1990 | |
1984 | |
1991 | void clear_los (object *op) |
1985 | void clear_los (object *op) |
1992 | |
|
|
1993 | int command_teleport (object *op, char *params) |
|
|
1994 | |
1986 | |
1995 | int command_summon (object *op, char *params) |
1987 | int command_summon (object *op, char *params) |
1996 | |
1988 | |
1997 | int command_arrest (object *op, char *params) |
1989 | int command_arrest (object *op, char *params) |
1998 | |
1990 | |
… | |
… | |
2141 | |
2133 | |
2142 | object* cf_map_present_arch_by_name (maptile *map, const char* str, int nx, int ny) |
2134 | object* cf_map_present_arch_by_name (maptile *map, const char* str, int nx, int ny) |
2143 | C_ARGS: str, map, nx, ny |
2135 | C_ARGS: str, map, nx, ny |
2144 | |
2136 | |
2145 | void |
2137 | void |
2146 | cf_map_normalise (maptile *map, int x, int y) |
2138 | get_map_flags (maptile *map, int x, int y) |
2147 | PPCODE: |
2139 | PPCODE: |
2148 | { |
2140 | { |
2149 | maptile *nmap = 0; |
2141 | maptile *nmap = 0; |
2150 | I16 nx = 0, ny = 0; |
2142 | I16 nx = 0, ny = 0; |
2151 | int flags = get_map_flags (map, &nmap, x, y, &nx, &ny); |
2143 | int flags = get_map_flags (map, &nmap, x, y, &nx, &ny); |
… | |
… | |
2213 | CODE: |
2205 | CODE: |
2214 | RETVAL = get_name_of_region_for_map (m); |
2206 | RETVAL = get_name_of_region_for_map (m); |
2215 | OUTPUT: RETVAL |
2207 | OUTPUT: RETVAL |
2216 | |
2208 | |
2217 | # worst xs function of my life |
2209 | # worst xs function of my life |
2218 | maptile * |
2210 | bool |
2219 | _create_random_map (\ |
2211 | _create_random_map (\ |
2220 | char *path,\ |
2212 | maptile *self,\ |
2221 | char *wallstyle,\ |
2213 | char *wallstyle,\ |
2222 | char *wall_name,\ |
2214 | char *wall_name,\ |
2223 | char *floorstyle,\ |
2215 | char *floorstyle,\ |
2224 | char *monsterstyle,\ |
2216 | char *monsterstyle,\ |
2225 | char *treasurestyle,\ |
2217 | char *treasurestyle,\ |
… | |
… | |
2295 | rmp.treasureoptions = treasureoptions; |
2287 | rmp.treasureoptions = treasureoptions; |
2296 | rmp.symmetry_used = symmetry_used; |
2288 | rmp.symmetry_used = symmetry_used; |
2297 | rmp.region = region; |
2289 | rmp.region = region; |
2298 | rmp.custom = custom; |
2290 | rmp.custom = custom; |
2299 | |
2291 | |
2300 | RETVAL = generate_random_map (path, &rmp); |
2292 | RETVAL = self->generate_random_map (&rmp); |
2301 | } |
2293 | } |
2302 | OUTPUT: |
2294 | OUTPUT: |
2303 | RETVAL |
2295 | RETVAL |
2304 | |
2296 | |
2305 | MODULE = cf PACKAGE = cf::arch |
2297 | MODULE = cf PACKAGE = cf::arch |