… | |
… | |
51 | #include <perl.h> |
51 | #include <perl.h> |
52 | #include <XSUB.h> |
52 | #include <XSUB.h> |
53 | |
53 | |
54 | #include "CoroAPI.h" |
54 | #include "CoroAPI.h" |
55 | #include "perlxsi.c" |
55 | #include "perlxsi.c" |
56 | |
|
|
57 | extern sint64 *levels; // the experience table |
|
|
58 | |
56 | |
59 | typedef object_thawer &object_thawer_ref; |
57 | typedef object_thawer &object_thawer_ref; |
60 | typedef object_freezer &object_freezer_ref; |
58 | typedef object_freezer &object_freezer_ref; |
61 | |
59 | |
62 | typedef std::string std__string; |
60 | typedef std::string std__string; |
… | |
… | |
1139 | |
1137 | |
1140 | return retval; |
1138 | return retval; |
1141 | } |
1139 | } |
1142 | |
1140 | |
1143 | maptile * |
1141 | maptile * |
1144 | find_style (const_utf8_string dirname, const_utf8_string stylename, int difficulty) |
1142 | find_style (const_utf8_string dirname, const_utf8_string stylename, int difficulty, bool recurse) |
1145 | { |
1143 | { |
1146 | CALL_BEGIN (3); |
1144 | CALL_BEGIN (4); |
1147 | CALL_ARG (dirname); |
1145 | CALL_ARG (dirname); |
1148 | CALL_ARG (stylename); |
1146 | CALL_ARG (stylename); |
1149 | CALL_ARG (difficulty); |
1147 | CALL_ARG (difficulty); |
|
|
1148 | CALL_ARG (recurse); |
1150 | CALL_CALL ("ext::map_random::find_style", G_SCALAR); |
1149 | CALL_CALL ("ext::map_random::find_style", G_SCALAR); |
1151 | |
1150 | |
1152 | maptile *retval = 0; |
1151 | maptile *retval = 0; |
1153 | if (count) sv_to (POPs, retval); |
1152 | if (count) sv_to (POPs, retval); |
1154 | |
1153 | |
… | |
… | |
1664 | switch (items) |
1663 | switch (items) |
1665 | { |
1664 | { |
1666 | case 0: RETVAL = gen (); break; |
1665 | case 0: RETVAL = gen (); break; |
1667 | case 1: RETVAL = gen (SvUV (ST (0))); break; |
1666 | case 1: RETVAL = gen (SvUV (ST (0))); break; |
1668 | case 2: RETVAL = gen (SvIV (ST (0)), SvIV (ST (1))); break; |
1667 | case 2: RETVAL = gen (SvIV (ST (0)), SvIV (ST (1))); break; |
1669 | default: croak ("cf::rndm requires none, one or two parameters."); break; |
1668 | default: croak ("cf::rndm requires zero, one or two parameters."); break; |
1670 | } |
1669 | } |
1671 | } |
1670 | } |
1672 | OUTPUT: |
1671 | OUTPUT: |
1673 | RETVAL |
1672 | RETVAL |
1674 | |
1673 | |
… | |
… | |
1798 | |
1797 | |
1799 | int random_roll (int min, int max, object *op, int goodbad); |
1798 | int random_roll (int min, int max, object *op, int goodbad); |
1800 | |
1799 | |
1801 | const_utf8_string cost_string_from_value(uint64 cost, int approx = 0) |
1800 | const_utf8_string cost_string_from_value(uint64 cost, int approx = 0) |
1802 | |
1801 | |
1803 | int |
|
|
1804 | exp_to_level (val64 exp) |
1802 | int exp_to_level (val64 exp) |
1805 | CODE: |
|
|
1806 | { |
|
|
1807 | int i = 0; |
|
|
1808 | |
1803 | |
1809 | RETVAL = settings.max_level; |
|
|
1810 | |
|
|
1811 | for (i = 1; i <= settings.max_level; i++) |
|
|
1812 | { |
|
|
1813 | if (levels[i] > exp) |
|
|
1814 | { |
|
|
1815 | RETVAL = i - 1; |
|
|
1816 | break; |
|
|
1817 | } |
|
|
1818 | } |
|
|
1819 | } |
|
|
1820 | OUTPUT: RETVAL |
|
|
1821 | |
|
|
1822 | val64 |
|
|
1823 | level_to_min_exp (int level) |
1804 | val64 level_to_min_exp (int level) |
1824 | CODE: |
|
|
1825 | if (level > settings.max_level) |
|
|
1826 | RETVAL = levels[settings.max_level]; |
|
|
1827 | else if (level < 1) |
|
|
1828 | RETVAL = 0; |
|
|
1829 | else |
|
|
1830 | RETVAL = levels[level]; |
|
|
1831 | OUTPUT: RETVAL |
|
|
1832 | |
1805 | |
1833 | SV * |
1806 | SV * |
1834 | resistance_to_string (int atnr) |
1807 | resistance_to_string (int atnr) |
1835 | CODE: |
1808 | CODE: |
1836 | if (atnr >= 0 && atnr < NROFATTACKS) |
1809 | if (atnr >= 0 && atnr < NROFATTACKS) |
… | |
… | |
2027 | } |
2000 | } |
2028 | OUTPUT: |
2001 | OUTPUT: |
2029 | RETVAL |
2002 | RETVAL |
2030 | |
2003 | |
2031 | object *find_best_object_match (object *op, utf8_string match) |
2004 | object *find_best_object_match (object *op, utf8_string match) |
2032 | |
|
|
2033 | object *find_marked_object (object *op) |
|
|
2034 | |
|
|
2035 | int need_identify (object *obj); |
|
|
2036 | |
2005 | |
2037 | int apply_shop_mat (object *shop_mat, object *op); |
2006 | int apply_shop_mat (object *shop_mat, object *op); |
2038 | |
2007 | |
2039 | int move (object *op, int dir, object *originator = op) |
2008 | int move (object *op, int dir, object *originator = op) |
2040 | CODE: |
2009 | CODE: |
… | |
… | |
2807 | while (!RETVAL); // crude way to leave index 0 |
2776 | while (!RETVAL); // crude way to leave index 0 |
2808 | |
2777 | |
2809 | faces [RETVAL].name = name; |
2778 | faces [RETVAL].name = name; |
2810 | facehash.insert (std::make_pair (faces [RETVAL].name, RETVAL)); |
2779 | facehash.insert (std::make_pair (faces [RETVAL].name, RETVAL)); |
2811 | |
2780 | |
2812 | if (!strcmp (name, BLANK_FACE_NAME)) blank_face = RETVAL; |
2781 | if (!strcmp (name, BLANK_FACE_NAME )) blank_face = RETVAL; |
2813 | if (!strcmp (name, EMPTY_FACE_NAME)) empty_face = RETVAL; |
2782 | if (!strcmp (name, EMPTY_FACE_NAME )) empty_face = RETVAL; |
|
|
2783 | if (!strcmp (name, MAGICMOUTH_FACE_NAME)) magicmouth_face = RETVAL; |
2814 | } |
2784 | } |
2815 | OUTPUT: RETVAL |
2785 | OUTPUT: RETVAL |
2816 | |
2786 | |
2817 | void set_type (faceidx idx, int value) |
2787 | void set_type (faceidx idx, int value) |
2818 | ALIAS: |
2788 | ALIAS: |
… | |
… | |
2952 | sv_to (sv, self); |
2922 | sv_to (sv, self); |
2953 | delete self; |
2923 | delete self; |
2954 | |
2924 | |
2955 | MODULE = cf PACKAGE = cf::object::thawer |
2925 | MODULE = cf PACKAGE = cf::object::thawer |
2956 | |
2926 | |
2957 | INCLUDE: $PERL $srcdir/genacc object_thawer $srcdir/../include/cfperl.h | |
2927 | INCLUDE: $PERL $srcdir/genacc object_thawer $srcdir/../include/freezethaw.h | |
|
|
2928 | |
|
|
2929 | bool |
|
|
2930 | errors_are_fatal (bool fatal) |
|
|
2931 | CODE: |
|
|
2932 | RETVAL = object_thawer::errors_are_fatal; |
|
|
2933 | object_thawer::errors_are_fatal = fatal; |
|
|
2934 | OUTPUT: |
|
|
2935 | RETVAL |
2958 | |
2936 | |
2959 | SV * |
2937 | SV * |
2960 | new_from_file (char *klass, octet_string path) |
2938 | new_from_file (char *klass, octet_string path) |
2961 | CODE: |
2939 | CODE: |
2962 | object_thawer *f = new object_thawer (path); |
2940 | object_thawer *f = new object_thawer (path); |