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.390 by root, Sat Jul 3 01:12:45 2010 UTC vs.
Revision 1.397 by root, Tue Jan 25 22:39:54 2011 UTC

28 28
29#include <cstdarg> 29#include <cstdarg>
30#include <typeinfo> 30#include <typeinfo>
31 31
32#include "global.h" 32#include "global.h"
33#include "../random_maps/random_map.h" 33#include "rmg.h"
34#include "evthread.h" 34#include "evthread.h"
35#include "sproto.h" 35#include "sproto.h"
36 36
37#include <unistd.h> 37#include <unistd.h>
38#if _POSIX_MEMLOCK 38#if _POSIX_MEMLOCK
1459# include "attackinc.h" 1459# include "attackinc.h"
1460# undef def 1460# undef def
1461# define def(uc, flags) const_iv (SK_ ## uc) 1461# define def(uc, flags) const_iv (SK_ ## uc)
1462# include "skillinc.h" 1462# include "skillinc.h"
1463# undef def 1463# undef def
1464 1464# define def(name, use, nonuse) const_iv (body_ ## name)
1465 const_iv (Map0Cmd) const_iv (Map1Cmd) const_iv (Map1aCmd) 1465# include "slotinc.h"
1466# undef def
1466 1467
1467 const_iv (MAP_CLIENT_X) const_iv (MAP_CLIENT_Y) 1468 const_iv (MAP_CLIENT_X) const_iv (MAP_CLIENT_Y)
1468 1469
1469 const_iv (MAX_TIME) 1470 const_iv (MAX_TIME)
1470 const_iv (MAXSOCKBUF) 1471 const_iv (MAXSOCKBUF)
1775 1776
1776int mlockall (int flags = MCL_CURRENT | MCL_FUTURE) 1777int mlockall (int flags = MCL_CURRENT | MCL_FUTURE)
1777 INIT: 1778 INIT:
1778#if __GLIBC__ 1779#if __GLIBC__
1779 mallopt (M_TOP_PAD, 1024 * 1024); 1780 mallopt (M_TOP_PAD, 1024 * 1024);
1780 mallopt (M_MMAP_THRESHOLD, 1024 * 1024 * 128); 1781 mallopt (M_MMAP_THRESHOLD, 1024 * 1024);
1781 mallopt (M_MMAP_MAX, 0); // likely bug-workaround, also frees memory 1782 mallopt (M_MMAP_MAX, 0); // likely bug-workaround, also frees memory
1783 if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 10))
1782 mallopt (M_PERTURB, 0xee); // bug-workaround for linux glibc+mlockall+calloc 1784 mallopt (M_PERTURB, 0xee); // bug-workaround for linux glibc+mlockall+calloc
1783#endif 1785#endif
1784 1786
1785int munlockall () 1787int munlockall ()
1786 1788
1787#endif 1789#endif
1825int exp_to_level (val64 exp) 1827int exp_to_level (val64 exp)
1826 1828
1827val64 level_to_min_exp (int level) 1829val64 level_to_min_exp (int level)
1828 1830
1829SV * 1831SV *
1830resistance_to_string (int atnr) 1832attacktype_name (int atnr)
1831 CODE: 1833 CODE:
1832 if (atnr >= 0 && atnr < NROFATTACKS) 1834 RETVAL = IN_RANGE_EXC (atnr, 0, NROFATTACKS)
1835 ? newSVpv (attacktype_name [atnr], 0)
1836 : &PL_sv_undef;
1837 OUTPUT: RETVAL
1838
1839SV *
1840attacktype_desc (int atnr)
1841 CODE:
1842 RETVAL = IN_RANGE_EXC (atnr, 0, NROFATTACKS)
1843 ? newSVpv (attacktype_desc [atnr], 0)
1844 : &PL_sv_undef;
1845 OUTPUT: RETVAL
1846
1847SV *
1848resist_plus (int atnr)
1849 CODE:
1850 RETVAL = IN_RANGE_EXC (atnr, 0, NROFATTACKS)
1833 RETVAL = newSVpv (resist_plus[atnr], 0); 1851 ? newSVpv (resist_plus [atnr], 0)
1834 else 1852 : &PL_sv_undef;
1835 XSRETURN_UNDEF; 1853 OUTPUT: RETVAL
1854
1855SV *
1856change_resist_msg (int atnr)
1857 CODE:
1858 RETVAL = IN_RANGE_EXC (atnr, 0, NROFATTACKS)
1859 ? newSVpv (change_resist_msg [atnr], 0)
1860 : &PL_sv_undef;
1836 OUTPUT: RETVAL 1861 OUTPUT: RETVAL
1837 1862
1838UUID 1863UUID
1839uuid_cur () 1864uuid_cur ()
1840 CODE: 1865 CODE:
1963int mortals_size () 1988int mortals_size ()
1964 CODE: 1989 CODE:
1965 RETVAL = attachable::mortals.size (); 1990 RETVAL = attachable::mortals.size ();
1966 OUTPUT: RETVAL 1991 OUTPUT: RETVAL
1967 1992
1968const_utf8_string slot_use_name (U32 slot) 1993const_utf8_string slot_name (U32 slot)
1969 ALIAS: 1994 ALIAS:
1995 slot_name = 0
1996 slot_use_name = 1
1970 slot_nonuse_name = 1 1997 slot_nonuse_name = 2
1971 CODE: 1998 CODE:
1972{ 1999{
1973 if (slot >= NUM_BODY_LOCATIONS) 2000 if (slot >= NUM_BODY_LOCATIONS)
1974 croak ("body slot index out of range"); 2001 croak ("body slot index out of range");
1975 2002
1976 switch (ix) 2003 switch (ix)
1977 { 2004 {
2005 case 0: RETVAL = body_locations[slot].name ; break;
1978 case 0: RETVAL = body_locations[slot].use_name; break; 2006 case 1: RETVAL = body_locations[slot].use_name ; break;
1979 case 1: RETVAL = body_locations[slot].nonuse_name; break; 2007 case 2: RETVAL = body_locations[slot].nonuse_name; break;
1980 } 2008 }
1981} 2009}
1982 OUTPUT: 2010 OUTPUT:
1983 RETVAL 2011 RETVAL
1984 2012
2538} 2566}
2539 OUTPUT: RETVAL 2567 OUTPUT: RETVAL
2540 2568
2541# worst xs function of my life 2569# worst xs function of my life
2542bool 2570bool
2543_create_random_map (\ 2571_create_random_map (maptile *self, SV *options)
2544 maptile *self,\
2545 SV *options,\
2546 val64 total_map_hp,\
2547 region *region\
2548)
2549 CODE: 2572 CODE:
2550{ 2573{
2551 random_map_params rmp; 2574 random_map_params rmp ((HV *)SvRV (options));
2552
2553 rmp.hv = (HV *)SvREFCNT_inc_NN (SvRV (options));
2554
2555 assign (rmp.wall_name, rmp.get_str ("wall_name"));
2556
2557 rmp.xsize = rmp.get_iv ("xsize");
2558 rmp.ysize = rmp.get_iv ("ysize");
2559 rmp.expand2x = rmp.get_iv ("expand2x");
2560 rmp.layoutoptions1 = rmp.get_iv ("layoutoptions1");
2561 rmp.layoutoptions2 = rmp.get_iv ("layoutoptions2");
2562 rmp.layoutoptions3 = rmp.get_iv ("layoutoptions3");
2563 rmp.symmetry = rmp.get_iv ("symmetry");
2564 rmp.difficulty = rmp.get_iv ("difficulty");
2565 rmp.difficulty_given = rmp.get_iv ("difficulty_given");
2566 rmp.difficulty_increase = rmp.get_nv ("difficulty_increase");
2567 rmp.dungeon_level = rmp.get_iv ("dungeon_level");
2568 rmp.dungeon_depth = rmp.get_iv ("dungeon_depth");
2569 rmp.orientation = rmp.get_iv ("orientation");
2570 rmp.random_seed = rmp.get_uv ("random_seed");
2571 rmp.total_map_hp = (uint64_t)total_map_hp;
2572 rmp.map_layout_style = rmp.get_iv ("map_layout_style");
2573 rmp.symmetry_used = rmp.get_iv ("symmetry_used");
2574 rmp.region = region;
2575
2576 RETVAL = self->generate_random_map (&rmp); 2575 RETVAL = self->generate_random_map (&rmp);
2577} 2576}
2578 OUTPUT: 2577 OUTPUT:
2579 RETVAL 2578 RETVAL
2580 2579
2752 2751
2753void set_data (faceidx idx, int faceset, SV *data, SV *chksum) 2752void set_data (faceidx idx, int faceset, SV *data, SV *chksum)
2754 CODE: 2753 CODE:
2755{ 2754{
2756 faceinfo *f = face_info (idx); assert (f); 2755 faceinfo *f = face_info (idx); assert (f);
2757 facedata *d = &(faceset ? f->data64 : f->data32); 2756 facedata *d = f->face + faceset;
2758 sv_to (data, d->data); 2757 sv_to (data, d->data);
2759 STRLEN clen; 2758 STRLEN clen;
2760 char *cdata = SvPVbyte (chksum, clen); 2759 char *cdata = SvPVbyte (chksum, clen);
2761 clen = min (CHKSUM_MAXLEN, clen); 2760 clen = min (CHKSUM_MAXLEN, clen);
2762 2761
2916 self->skip (); 2915 self->skip ();
2917 } 2916 }
2918 2917
2919MODULE = cf PACKAGE = cf::layout 2918MODULE = cf PACKAGE = cf::layout
2920 2919
2921INCLUDE: $PERL $srcdir/genacc layout $srcdir/../random_maps/random_map.h | 2920INCLUDE: $PERL $srcdir/genacc layout $srcdir/../include/rmg.h |
2922 2921

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines