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.280 by root, Mon Apr 21 06:35:26 2008 UTC vs.
Revision 1.293 by root, Mon Aug 11 23:23:41 2008 UTC

21 * The authors can be reached via e-mail to <support@deliantra.net> 21 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 22 */
23 23
24#include "autoconf.h" 24#include "autoconf.h"
25 25
26#define PLUGIN_NAME "perl"
27#define PLUGIN_VERSION "cfperl 0.5"
28
29#if HAVE_EXECINFO_H 26#if HAVE_EXECINFO_H
30# include <execinfo.h> 27# include <execinfo.h>
31#endif 28#endif
32 29
33#include <cstdarg> 30#include <cstdarg>
31#include <typeinfo>
34 32
35#include "global.h" 33#include "global.h"
36#include "loader.h" 34#include "loader.h"
37#include "../random_maps/random_map.h" 35#include "../random_maps/random_map.h"
38#include "evthread.h" 36#include "evthread.h"
83 *stash_cf, 81 *stash_cf,
84 *stash_cf_object_wrap, 82 *stash_cf_object_wrap,
85 *stash_cf_object_player_wrap, 83 *stash_cf_object_player_wrap,
86 *stash_cf_player_wrap, 84 *stash_cf_player_wrap,
87 *stash_cf_map_wrap, 85 *stash_cf_map_wrap,
86 *stash_cf_mapspace_wrap,
88 *stash_cf_client_wrap, 87 *stash_cf_client_wrap,
89 *stash_cf_arch_wrap, 88 *stash_cf_arch_wrap,
90 *stash_cf_party_wrap, 89 *stash_cf_party_wrap,
91 *stash_cf_region_wrap, 90 *stash_cf_region_wrap,
92 *stash_cf_living_wrap; 91 *stash_cf_living_wrap;
431inline SV *to_sv (maptile * v) { return newSVattachable (v, stash_cf_map_wrap); } 430inline SV *to_sv (maptile * v) { return newSVattachable (v, stash_cf_map_wrap); }
432inline SV *to_sv (archetype * v) { return newSVattachable (v, stash_cf_arch_wrap); } 431inline SV *to_sv (archetype * v) { return newSVattachable (v, stash_cf_arch_wrap); }
433inline SV *to_sv (region * v) { return newSVattachable (v, stash_cf_region_wrap); } 432inline SV *to_sv (region * v) { return newSVattachable (v, stash_cf_region_wrap); }
434inline SV *to_sv (partylist * v) { return newSVptr (v, stash_cf_party_wrap); } 433inline SV *to_sv (partylist * v) { return newSVptr (v, stash_cf_party_wrap); }
435inline SV *to_sv (living * v) { return newSVptr (v, stash_cf_living_wrap); } 434inline SV *to_sv (living * v) { return newSVptr (v, stash_cf_living_wrap); }
435inline SV *to_sv (mapspace * v) { return newSVptr (v, stash_cf_mapspace_wrap); }
436 436
437inline SV *to_sv (object & v) { return to_sv (&v); } 437inline SV *to_sv (object & v) { return to_sv (&v); }
438inline SV *to_sv (living & v) { return to_sv (&v); } 438inline SV *to_sv (living & v) { return to_sv (&v); }
439 439
440inline SV *to_sv (const std::string & v) { return newSVpvn (v.data (), v.size ()); } 440inline SV *to_sv (const std::string & v) { return newSVpvn (v.data (), v.size ()); }
464inline void sv_to (SV *sv, maptile * &v) { v = (maptile *)(attachable *)SvPTR_ornull (sv, "cf::map"); } 464inline void sv_to (SV *sv, maptile * &v) { v = (maptile *)(attachable *)SvPTR_ornull (sv, "cf::map"); }
465inline void sv_to (SV *sv, region * &v) { v = (region *)(attachable *)SvPTR_ornull (sv, "cf::region"); } 465inline void sv_to (SV *sv, region * &v) { v = (region *)(attachable *)SvPTR_ornull (sv, "cf::region"); }
466inline void sv_to (SV *sv, attachable * &v) { v = (attachable *)SvPTR_ornull (sv, "cf::attachable"); } 466inline void sv_to (SV *sv, attachable * &v) { v = (attachable *)SvPTR_ornull (sv, "cf::attachable"); }
467inline void sv_to (SV *sv, partylist * &v) { v = (partylist *)SvPTR_ornull (sv, "cf::party"); } 467inline void sv_to (SV *sv, partylist * &v) { v = (partylist *)SvPTR_ornull (sv, "cf::party"); }
468inline void sv_to (SV *sv, living * &v) { v = (living *)SvPTR_ornull (sv, "cf::living"); } 468inline void sv_to (SV *sv, living * &v) { v = (living *)SvPTR_ornull (sv, "cf::living"); }
469inline void sv_to (SV *sv, mapspace * &v) { v = (mapspace *)SvPTR_ornull (sv, "cf::mapspace"); }
469inline void sv_to (SV *sv, object_freezer * &v) { v = (object_freezer *)SvPTR_ornull (sv, "cf::object::freezer"); } 470inline void sv_to (SV *sv, object_freezer * &v) { v = (object_freezer *)SvPTR_ornull (sv, "cf::object::freezer"); }
470inline void sv_to (SV *sv, object_thawer * &v) { v = (object_thawer *)SvPTR_ornull (sv, "cf::object::thawer" ); } 471inline void sv_to (SV *sv, object_thawer * &v) { v = (object_thawer *)SvPTR_ornull (sv, "cf::object::thawer" ); }
471 472
472//inline void sv_to (SV *sv, faceinfo * &v) { v = &faces [face_find (SvPV_nolen (sv), 0)]; } 473//inline void sv_to (SV *sv, faceinfo * &v) { v = &faces [face_find (SvPV_nolen (sv), 0)]; }
473inline void sv_to (SV *sv, treasurelist * &v) { v = treasurelist::find (SvPV_nolen (sv)); } 474inline void sv_to (SV *sv, treasurelist * &v) { v = treasurelist::find (SvPV_nolen (sv)); }
944 CALL_CALL ("ext::books::make_book", G_VOID); 945 CALL_CALL ("ext::books::make_book", G_VOID);
945 CALL_END; 946 CALL_END;
946} 947}
947 948
948void 949void
950cfperl_expand_cfpod (player *pl, std::string &msg)
951{
952 CALL_BEGIN (2);
953 CALL_ARG (pl);
954 CALL_ARG_SV (newSVpvn_utf8 (msg.data (), msg.size ()));
955 CALL_CALL ("cf::player::expand_cfpod", G_SCALAR);
956
957 if (count)
958 {
959 STRLEN len;
960 char *data = SvPVutf8 (TOPs, len);
961 msg.assign (data, len);
962 }
963
964 CALL_END;
965}
966
967void
949cfperl_send_msg (client *ns, int color, const char *type, const char *msg) 968cfperl_send_msg (client *ns, int color, const char *type, const char *msg)
950{ 969{
951 CALL_BEGIN (4); 970 CALL_BEGIN (4);
952 CALL_ARG (ns); 971 CALL_ARG (ns);
953 CALL_ARG (type); 972 CALL_ARG (type);
977{ 996{
978 CALL_BEGIN (1); 997 CALL_BEGIN (1);
979 CALL_ARG (name); 998 CALL_ARG (name);
980 CALL_CALL ("cf::player::find", G_SCALAR); 999 CALL_CALL ("cf::player::find", G_SCALAR);
981 1000
982 player *retval; 1001 player *retval = 0;
983
984 if (count)
985 sv_to (POPs, retval); 1002 if (count) sv_to (POPs, retval);
986 else 1003
987 retval = 0; 1004 CALL_END;
1005
1006 return retval;
1007}
1008
1009maptile *
1010find_style (const char *dirname, const char *stylename, int difficulty)
1011{
1012 CALL_BEGIN (3);
1013 CALL_ARG (dirname);
1014 CALL_ARG (stylename);
1015 CALL_ARG (difficulty);
1016 CALL_CALL ("ext::map_random::find_style", G_SCALAR);
1017
1018 maptile *retval = 0;
1019 if (count) sv_to (POPs, retval);
988 1020
989 CALL_END; 1021 CALL_END;
990 1022
991 return retval; 1023 return retval;
992} 1024}
997 CALL_BEGIN (2); 1029 CALL_BEGIN (2);
998 CALL_ARG (path); 1030 CALL_ARG (path);
999 CALL_ARG (origin); 1031 CALL_ARG (origin);
1000 CALL_CALL ("cf::map::find_sync", G_SCALAR); 1032 CALL_CALL ("cf::map::find_sync", G_SCALAR);
1001 1033
1002 maptile *retval; 1034 maptile *retval = 0;
1003
1004 if (count)
1005 sv_to (POPs, retval); 1035 if (count) sv_to (POPs, retval);
1006 else
1007 retval = 0;
1008 1036
1009 CALL_END; 1037 CALL_END;
1010 1038
1011 return retval; 1039 return retval;
1012} 1040}
1018 CALL_ARG (path); 1046 CALL_ARG (path);
1019 CALL_ARG (origin); 1047 CALL_ARG (origin);
1020 CALL_ARG (load); 1048 CALL_ARG (load);
1021 CALL_CALL ("cf::map::find_async", G_SCALAR); 1049 CALL_CALL ("cf::map::find_async", G_SCALAR);
1022 1050
1023 maptile *retval; 1051 maptile *retval = 0;
1024
1025 if (count)
1026 sv_to (POPs, retval); 1052 if (count) sv_to (POPs, retval);
1027 else
1028 retval = 0;
1029 1053
1030 CALL_END; 1054 CALL_END;
1031 1055
1032 return retval; 1056 return retval;
1033} 1057}
1058 1082
1059 CALL_BEGIN (2); 1083 CALL_BEGIN (2);
1060 CALL_ARG (this); 1084 CALL_ARG (this);
1061 CALL_ARG (exit); 1085 CALL_ARG (exit);
1062 CALL_CALL ("cf::object::player::enter_exit", G_VOID); 1086 CALL_CALL ("cf::object::player::enter_exit", G_VOID);
1087 CALL_END;
1088}
1089
1090void
1091object::player_goto (const char *path, int x, int y)
1092{
1093 if (type != PLAYER)
1094 return;
1095
1096 CALL_BEGIN (4);
1097 CALL_ARG (this);
1098 CALL_ARG (path);
1099 CALL_ARG (x);
1100 CALL_ARG (y);
1101 CALL_CALL ("cf::object::player::goto", G_VOID);
1063 CALL_END; 1102 CALL_END;
1064} 1103}
1065 1104
1066const char * 1105const char *
1067object::ref () const 1106object::ref () const
1154 1193
1155 stash_cf_object_wrap = gv_stashpv ("cf::object::wrap", 1); 1194 stash_cf_object_wrap = gv_stashpv ("cf::object::wrap", 1);
1156 stash_cf_object_player_wrap = gv_stashpv ("cf::object::player::wrap", 1); 1195 stash_cf_object_player_wrap = gv_stashpv ("cf::object::player::wrap", 1);
1157 stash_cf_player_wrap = gv_stashpv ("cf::player::wrap", 1); 1196 stash_cf_player_wrap = gv_stashpv ("cf::player::wrap", 1);
1158 stash_cf_map_wrap = gv_stashpv ("cf::map::wrap" , 1); 1197 stash_cf_map_wrap = gv_stashpv ("cf::map::wrap" , 1);
1198 stash_cf_mapspace_wrap = gv_stashpv ("cf::mapspace::wrap" , 1);
1159 stash_cf_client_wrap = gv_stashpv ("cf::client::wrap", 1); 1199 stash_cf_client_wrap = gv_stashpv ("cf::client::wrap", 1);
1160 stash_cf_arch_wrap = gv_stashpv ("cf::arch::wrap" , 1); 1200 stash_cf_arch_wrap = gv_stashpv ("cf::arch::wrap" , 1);
1161 stash_cf_party_wrap = gv_stashpv ("cf::party::wrap" , 1); 1201 stash_cf_party_wrap = gv_stashpv ("cf::party::wrap" , 1);
1162 stash_cf_region_wrap = gv_stashpv ("cf::region::wrap", 1); 1202 stash_cf_region_wrap = gv_stashpv ("cf::region::wrap", 1);
1163 stash_cf_living_wrap = gv_stashpv ("cf::living::wrap", 1); 1203 stash_cf_living_wrap = gv_stashpv ("cf::living::wrap", 1);
1356 const_iv (F_CURSED) const_iv (F_DAMNED) const_iv (F_OPEN) const_iv (F_NOPICK) 1396 const_iv (F_CURSED) const_iv (F_DAMNED) const_iv (F_OPEN) const_iv (F_NOPICK)
1357 const_iv (F_LOCKED) 1397 const_iv (F_LOCKED)
1358 1398
1359 const_iv (F_BUY) const_iv (F_SHOP) const_iv (F_SELL) 1399 const_iv (F_BUY) const_iv (F_SHOP) const_iv (F_SELL)
1360 1400
1361 const_iv (P_BLOCKSVIEW) const_iv (P_PLAYER) const_iv (P_NO_MAGIC) const_iv (P_IS_ALIVE) 1401 const_iv (P_BLOCKSVIEW) const_iv (P_NO_MAGIC) const_iv (P_IS_ALIVE)
1362 const_iv (P_NO_CLERIC) const_iv (P_OUT_OF_MAP) const_iv (P_NEW_MAP) const_iv (P_UPTODATE) 1402 const_iv (P_NO_CLERIC) const_iv (P_OUT_OF_MAP) const_iv (P_NEW_MAP) const_iv (P_UPTODATE)
1363 1403
1364 const_iv (UP_OBJ_INSERT) const_iv (UP_OBJ_REMOVE) const_iv (UP_OBJ_CHANGE) const_iv (UP_OBJ_FACE) 1404 const_iv (UP_OBJ_INSERT) const_iv (UP_OBJ_REMOVE) const_iv (UP_OBJ_CHANGE) const_iv (UP_OBJ_FACE)
1365 1405
1366 const_iv (INS_NO_MERGE) const_iv (INS_ABOVE_FLOOR_ONLY) const_iv (INS_NO_WALK_ON) 1406 const_iv (INS_NO_MERGE) const_iv (INS_ABOVE_FLOOR_ONLY) const_iv (INS_NO_WALK_ON)
1432 1472
1433 const_iv (SYMMETRY_RANDOM) const_iv (SYMMETRY_NONE) const_iv (SYMMETRY_X) 1473 const_iv (SYMMETRY_RANDOM) const_iv (SYMMETRY_NONE) const_iv (SYMMETRY_X)
1434 const_iv (SYMMETRY_Y) const_iv (SYMMETRY_XY) 1474 const_iv (SYMMETRY_Y) const_iv (SYMMETRY_XY)
1435 1475
1436 const_iv (GT_ENVIRONMENT) const_iv (GT_INVISIBLE) const_iv (GT_STARTEQUIP) 1476 const_iv (GT_ENVIRONMENT) const_iv (GT_INVISIBLE) const_iv (GT_STARTEQUIP)
1437 const_iv (GT_APPLY) const_iv (GT_ONLY_GOOD) const_iv (GT_UPDATE_INV) 1477 const_iv (GT_APPLY) const_iv (GT_ONLY_GOOD) const_iv (GT_MINIMAL)
1438 const_iv (GT_MINIMAL)
1439 1478
1440 const_iv (FT_FACE) const_iv (FT_MUSIC) const_iv (FT_SOUND) 1479 const_iv (FT_FACE) const_iv (FT_MUSIC) const_iv (FT_SOUND)
1441 const_iv (FT_RSRC) const_iv (FT_NUM) 1480 const_iv (FT_RSRC) const_iv (FT_NUM)
1442 }; 1481 };
1443 1482
1574NV floor (NV x) 1613NV floor (NV x)
1575 1614
1576NV ceil (NV x) 1615NV ceil (NV x)
1577 1616
1578NV rndm (...) 1617NV rndm (...)
1618 ALIAS:
1619 rmg_rndm = 1
1579 CODE: 1620 CODE:
1621{
1622 rand_gen &gen = ix ? rmg_rndm : rndm;
1580 switch (items) 1623 switch (items)
1581 { 1624 {
1582 case 0: RETVAL = rndm (); break; 1625 case 0: RETVAL = gen (); break;
1583 case 1: RETVAL = rndm (SvUV (ST (0))); break; 1626 case 1: RETVAL = gen (SvUV (ST (0))); break;
1584 case 2: RETVAL = rndm (SvIV (ST (0)), SvIV (ST (1))); break; 1627 case 2: RETVAL = gen (SvIV (ST (0)), SvIV (ST (1))); break;
1585 default: croak ("cf::rndm requires none, one or two parameters."); break; 1628 default: croak ("cf::rndm requires none, one or two parameters."); break;
1586 } 1629 }
1630}
1587 OUTPUT: 1631 OUTPUT:
1588 RETVAL 1632 RETVAL
1589 1633
1590NV clamp (NV value, NV min_value, NV max_value) 1634NV clamp (NV value, NV min_value, NV max_value)
1591 CODE: 1635 CODE:
1694 PUSHs (sv_2mortal (newSVpv ("keepcost", 0))); PUSHs (sv_2mortal (newSViv (mai.keepcost))); 1738 PUSHs (sv_2mortal (newSVpv ("keepcost", 0))); PUSHs (sv_2mortal (newSViv (mai.keepcost)));
1695#endif 1739#endif
1696 EXTEND (SP, 2*2); 1740 EXTEND (SP, 2*2);
1697 PUSHs (sv_2mortal (newSVpv ("slice_alloc", 0))); PUSHs (sv_2mortal (newSVuv (slice_alloc))); 1741 PUSHs (sv_2mortal (newSVpv ("slice_alloc", 0))); PUSHs (sv_2mortal (newSVuv (slice_alloc)));
1698 PUSHs (sv_2mortal (newSVpv ("shstr_alloc", 0))); PUSHs (sv_2mortal (newSVuv (shstr_alloc))); 1742 PUSHs (sv_2mortal (newSVpv ("shstr_alloc", 0))); PUSHs (sv_2mortal (newSVuv (shstr_alloc)));
1743 PUSHs (sv_2mortal (newSVpv ("objects" , 0))); PUSHs (sv_2mortal (newSVuv (objects.size () * sizeof (object))));
1699} 1744}
1700 1745
1701int find_animation (utf8_string text) 1746int find_animation (utf8_string text)
1702 PROTOTYPE: $ 1747 PROTOTYPE: $
1703 1748
1787 PUSHs (sv_2mortal (to_sv (archetype::find (coins [i])))); 1832 PUSHs (sv_2mortal (to_sv (archetype::find (coins [i]))));
1788 1833
1789bool 1834bool
1790load_resource_file_ (octet_string filename) 1835load_resource_file_ (octet_string filename)
1791 1836
1837void
1838fix_weight ()
1839
1792MODULE = cf PACKAGE = cf::attachable 1840MODULE = cf PACKAGE = cf::attachable
1793 1841
1794int 1842int
1795valid (SV *obj) 1843valid (SV *obj)
1796 CODE: 1844 CODE:
1859object *actives (U32 index) 1907object *actives (U32 index)
1860 CODE: 1908 CODE:
1861 RETVAL = index < actives.size () ? actives [index] : 0; 1909 RETVAL = index < actives.size () ? actives [index] : 0;
1862 OUTPUT: RETVAL 1910 OUTPUT: RETVAL
1863 1911
1912int mortals_size ()
1913 CODE:
1914 RETVAL = attachable::mortals.size ();
1915 OUTPUT: RETVAL
1916
1864const char *slot_use_name (U32 slot) 1917const char *slot_use_name (U32 slot)
1865 ALIAS: 1918 ALIAS:
1866 slot_nonuse_name = 1 1919 slot_nonuse_name = 1
1867 CODE: 1920 CODE:
1868{ 1921{
1946void apply_below (object *op) 1999void apply_below (object *op)
1947 CODE: 2000 CODE:
1948 player_apply_below (op); 2001 player_apply_below (op);
1949 2002
1950int cast_heal (object *op, object *caster, object *spell, int dir = 0) 2003int cast_heal (object *op, object *caster, object *spell, int dir = 0)
1951
1952#//TODO
1953object *clone_ (object *op, int recursive = 0)
1954 CODE:
1955 if (recursive)
1956 RETVAL = object_create_clone (op);
1957 else
1958 {
1959 RETVAL = object::create ();
1960 op->copy_to (RETVAL);
1961 }
1962 OUTPUT: RETVAL
1963 2004
1964int pay_item (object *op, object *buyer) 2005int pay_item (object *op, object *buyer)
1965 CODE: 2006 CODE:
1966 RETVAL = pay_for_item (op, buyer); 2007 RETVAL = pay_for_item (op, buyer);
1967 OUTPUT: RETVAL 2008 OUTPUT: RETVAL
2045 CODE: 2086 CODE:
2046{ 2087{
2047 RETVAL = insert_ob_in_map_at (ob, where, orig, flag, x, y); 2088 RETVAL = insert_ob_in_map_at (ob, where, orig, flag, x, y);
2048} 2089}
2049 2090
2050const_utf8_string get_ob_key_value (object *op, utf8_string key) 2091shstr
2092object::kv_get (shstr key)
2051 2093
2052bool set_ob_key_value (object *op, utf8_string key, utf8_string value = 0, int add_key = 1) 2094void
2095object::kv_del (shstr key)
2096
2097void
2098object::kv_set (shstr key, shstr value)
2053 2099
2054object *get_nearest_player (object *ob) 2100object *get_nearest_player (object *ob)
2055 ALIAS: nearest_player = 0 2101 ALIAS: nearest_player = 0
2056 PREINIT: 2102 PREINIT:
2057 extern object *get_nearest_player (object *); 2103 extern object *get_nearest_player (object *);
2059void rangevector (object *ob, object *other, int flags = 0) 2105void rangevector (object *ob, object *other, int flags = 0)
2060 PROTOTYPE: $$;$ 2106 PROTOTYPE: $$;$
2061 PPCODE: 2107 PPCODE:
2062{ 2108{
2063 rv_vector rv; 2109 rv_vector rv;
2110
2111 PUTBACK;
2064 get_rangevector (ob, other, &rv, flags); 2112 get_rangevector (ob, other, &rv, flags);
2113 SPAGAIN;
2114
2065 EXTEND (SP, 5); 2115 EXTEND (SP, 5);
2066 PUSHs (newSVuv (rv.distance)); 2116 PUSHs (newSVuv (rv.distance));
2067 PUSHs (newSViv (rv.distance_x)); 2117 PUSHs (newSViv (rv.distance_x));
2068 PUSHs (newSViv (rv.distance_y)); 2118 PUSHs (newSViv (rv.distance_y));
2069 PUSHs (newSViv (rv.direction)); 2119 PUSHs (newSViv (rv.direction));
2376get_map_flags (maptile *map, int x, int y) 2426get_map_flags (maptile *map, int x, int y)
2377 PPCODE: 2427 PPCODE:
2378{ 2428{
2379 maptile *nmap = 0; 2429 maptile *nmap = 0;
2380 I16 nx = 0, ny = 0; 2430 I16 nx = 0, ny = 0;
2431
2432 PUTBACK;
2381 int flags = get_map_flags (map, &nmap, x, y, &nx, &ny); 2433 int flags = get_map_flags (map, &nmap, x, y, &nx, &ny);
2434 SPAGAIN;
2382 2435
2383 EXTEND (SP, 4); 2436 EXTEND (SP, 4);
2384 PUSHs (sv_2mortal (newSViv (flags))); 2437 PUSHs (sv_2mortal (newSViv (flags)));
2385 2438
2386 if (GIMME_V == G_ARRAY) 2439 if (GIMME_V == G_ARRAY)
2389 PUSHs (sv_2mortal (newSViv (nx))); 2442 PUSHs (sv_2mortal (newSViv (nx)));
2390 PUSHs (sv_2mortal (newSViv (ny))); 2443 PUSHs (sv_2mortal (newSViv (ny)));
2391 } 2444 }
2392} 2445}
2393 2446
2447mapspace *
2448ms (maptile *map, unsigned int x, unsigned int y)
2449 PROTOTYPE: $$$
2450 CODE:
2451{
2452 maptile *nmap = 0;
2453 I16 nx, ny;
2454
2455 PUTBACK;
2456 get_map_flags (map, &nmap, x, y, &nx, &ny);
2457 SPAGAIN;
2458
2459 if (!nmap)
2460 XSRETURN_UNDEF;
2461
2462 RETVAL = &nmap->at (nx, ny);
2463}
2464 OUTPUT:
2465 RETVAL
2466
2394void 2467void
2395at (maptile *map, unsigned int x, unsigned int y) 2468at (maptile *map, unsigned int x, unsigned int y)
2396 PROTOTYPE: $$$ 2469 PROTOTYPE: $$$
2397 PPCODE: 2470 PPCODE:
2398{ 2471{
2399 object *o;
2400 maptile *nmap = 0; 2472 maptile *nmap = 0;
2401 I16 nx, ny; 2473 I16 nx, ny;
2402 2474
2475 PUTBACK;
2403 get_map_flags (map, &nmap, x, y, &nx, &ny); 2476 get_map_flags (map, &nmap, x, y, &nx, &ny);
2477 SPAGAIN;
2404 2478
2405 if (nmap) 2479 if (nmap)
2406 for (o = GET_MAP_OB (nmap, nx, ny); o; o = o->above) 2480 for (object *o = nmap->at (nx, ny).bot; o; o = o->above)
2407 XPUSHs (sv_2mortal (to_sv (o))); 2481 XPUSHs (sv_2mortal (to_sv (o)));
2408} 2482}
2409 2483
2410SV * 2484SV *
2411bot_at (maptile *obj, unsigned int x, unsigned int y) 2485bot_at (maptile *obj, unsigned int x, unsigned int y)
2524 RETVAL = self->generate_random_map (&rmp); 2598 RETVAL = self->generate_random_map (&rmp);
2525} 2599}
2526 OUTPUT: 2600 OUTPUT:
2527 RETVAL 2601 RETVAL
2528 2602
2603MODULE = cf PACKAGE = cf::mapspace
2604
2605INCLUDE: $PERL $srcdir/genacc mapspace ../include/map.h |
2606
2529MODULE = cf PACKAGE = cf::arch 2607MODULE = cf PACKAGE = cf::arch
2530 2608
2531int archetypes_size () 2609int archetypes_size ()
2532 CODE: 2610 CODE:
2533 RETVAL = archetypes.size (); 2611 RETVAL = archetypes.size ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines