ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/cfperl.xs
(Generate patch)

Comparing deliantra/server/server/cfperl.xs (file contents):
Revision 1.136 by root, Wed Jan 10 19:52:43 2007 UTC vs.
Revision 1.144 by root, Fri Jan 19 15:55:27 2007 UTC

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
251static void 258static void
252clearSVptr (SV *sv) 259clearSVptr (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
495void 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
521extern "C" int cfperl_initPlugin (const char *iversion, f_plug_api gethooksptr) 503extern "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
1569NV floor (NV x) 1553NV floor (NV x)
1570 1554
1571NV ceil (NV x) 1555NV ceil (NV x)
1572 1556
1557NV 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
1573void server_tick () 1569void 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
1626void abort () 1622void abort ()
1627 1623
1624void fork_abort (char *cause = "cf::fork_abort")
1625
1628void cleanup (const char *cause, bool make_core = false) 1626void cleanup (const char *cause, bool make_core = false)
1629 1627
1630void emergency_save () 1628void emergency_save ()
1631 1629
1632void _exit (int status = 0) 1630void _exit (int status = 0)
1856 1854
1857void drop (object *who, object *op) 1855void drop (object *who, object *op)
1858 1856
1859void pick_up (object *who, object *op) 1857void pick_up (object *who, object *op)
1860 1858
1861object *cf_object_insert_object (object *op, object *container)
1862
1863object *cf_object_insert_in_ob (object *ob, object *where)
1864
1865int cf_object_teleport (object *op, maptile *map, int x, int y) 1859int cf_object_teleport (object *op, maptile *map, int x, int y)
1866 1860
1867void update_object (object *op, int action) 1861void update_object (object *op, int action)
1868 1862
1869object *cf_create_object_by_name (const char *name) 1863object *cf_create_object_by_name (const char *name)
1987 1981
1988void esrv_update_item (object *op, int what, object *item) 1982void esrv_update_item (object *op, int what, object *item)
1989 C_ARGS: what, op, item 1983 C_ARGS: what, op, item
1990 1984
1991void clear_los (object *op) 1985void clear_los (object *op)
1992
1993int command_teleport (object *op, char *params)
1994 1986
1995int command_summon (object *op, char *params) 1987int command_summon (object *op, char *params)
1996 1988
1997int command_arrest (object *op, char *params) 1989int command_arrest (object *op, char *params)
1998 1990
2141 2133
2142object* cf_map_present_arch_by_name (maptile *map, const char* str, int nx, int ny) 2134object* 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
2145void 2137void
2146cf_map_normalise (maptile *map, int x, int y) 2138get_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
2218maptile * 2210bool
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,\
2250 int random_seed,\ 2242 int random_seed,\
2251 val64 total_map_hp,\ 2243 val64 total_map_hp,\
2252 int map_layout_style,\ 2244 int map_layout_style,\
2253 int treasureoptions,\ 2245 int treasureoptions,\
2254 int symmetry_used,\ 2246 int symmetry_used,\
2255 region *region\ 2247 region *region,\
2248 char *custom\
2256) 2249)
2257 CODE: 2250 CODE:
2258{ 2251{
2259 random_map_params rmp; 2252 random_map_params rmp;
2260 2253
2292 rmp.total_map_hp = total_map_hp; 2285 rmp.total_map_hp = total_map_hp;
2293 rmp.map_layout_style = map_layout_style; 2286 rmp.map_layout_style = map_layout_style;
2294 rmp.treasureoptions = treasureoptions; 2287 rmp.treasureoptions = treasureoptions;
2295 rmp.symmetry_used = symmetry_used; 2288 rmp.symmetry_used = symmetry_used;
2296 rmp.region = region; 2289 rmp.region = region;
2290 rmp.custom = custom;
2297 2291
2298 RETVAL = generate_random_map (path, &rmp); 2292 RETVAL = self->generate_random_map (&rmp);
2299} 2293}
2300 OUTPUT: 2294 OUTPUT:
2301 RETVAL 2295 RETVAL
2302 2296
2303MODULE = cf PACKAGE = cf::arch 2297MODULE = cf PACKAGE = cf::arch

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines