… | |
… | |
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 | |
1776 | int mlockall (int flags = MCL_CURRENT | MCL_FUTURE) |
1777 | int 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 | |
1785 | int munlockall () |
1787 | int munlockall () |
1786 | |
1788 | |
1787 | #endif |
1789 | #endif |
… | |
… | |
1825 | int exp_to_level (val64 exp) |
1827 | int exp_to_level (val64 exp) |
1826 | |
1828 | |
1827 | val64 level_to_min_exp (int level) |
1829 | val64 level_to_min_exp (int level) |
1828 | |
1830 | |
1829 | SV * |
1831 | SV * |
1830 | resistance_to_string (int atnr) |
1832 | attacktype_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 | |
|
|
1839 | SV * |
|
|
1840 | attacktype_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 | |
|
|
1847 | SV * |
|
|
1848 | resist_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 | |
|
|
1855 | SV * |
|
|
1856 | change_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 | |
1838 | UUID |
1863 | UUID |
1839 | uuid_cur () |
1864 | uuid_cur () |
1840 | CODE: |
1865 | CODE: |
… | |
… | |
1963 | int mortals_size () |
1988 | int mortals_size () |
1964 | CODE: |
1989 | CODE: |
1965 | RETVAL = attachable::mortals.size (); |
1990 | RETVAL = attachable::mortals.size (); |
1966 | OUTPUT: RETVAL |
1991 | OUTPUT: RETVAL |
1967 | |
1992 | |
1968 | const_utf8_string slot_use_name (U32 slot) |
1993 | const_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 | |
… | |
… | |
2723 | |
2751 | |
2724 | void set_data (faceidx idx, int faceset, SV *data, SV *chksum) |
2752 | void set_data (faceidx idx, int faceset, SV *data, SV *chksum) |
2725 | CODE: |
2753 | CODE: |
2726 | { |
2754 | { |
2727 | faceinfo *f = face_info (idx); assert (f); |
2755 | faceinfo *f = face_info (idx); assert (f); |
2728 | facedata *d = &(faceset ? f->data64 : f->data32); |
2756 | facedata *d = f->face + faceset; |
2729 | sv_to (data, d->data); |
2757 | sv_to (data, d->data); |
2730 | STRLEN clen; |
2758 | STRLEN clen; |
2731 | char *cdata = SvPVbyte (chksum, clen); |
2759 | char *cdata = SvPVbyte (chksum, clen); |
2732 | clen = min (CHKSUM_MAXLEN, clen); |
2760 | clen = min (CHKSUM_MAXLEN, clen); |
2733 | |
2761 | |
… | |
… | |
2887 | self->skip (); |
2915 | self->skip (); |
2888 | } |
2916 | } |
2889 | |
2917 | |
2890 | MODULE = cf PACKAGE = cf::layout |
2918 | MODULE = cf PACKAGE = cf::layout |
2891 | |
2919 | |
2892 | INCLUDE: $PERL $srcdir/genacc layout $srcdir/../random_maps/random_map.h | |
2920 | INCLUDE: $PERL $srcdir/genacc layout $srcdir/../include/rmg.h | |
2893 | |
2921 | |