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.182 by root, Fri Apr 6 19:20:33 2007 UTC vs.
Revision 1.183 by root, Mon Apr 9 04:40:39 2007 UTC

49 49
50extern sint64 *levels; // the experience table 50extern sint64 *levels; // the experience table
51 51
52typedef object object_ornull; 52typedef object object_ornull;
53typedef maptile maptile_ornull; 53typedef maptile maptile_ornull;
54
55typedef char *octet_string;
56typedef char *utf8_string;
57typedef const char *const_octet_string;
58typedef const char *const_utf8_string;
54 59
55#if IVSIZE >= 8 60#if IVSIZE >= 8
56 typedef IV val64; 61 typedef IV val64;
57# define newSVval64 newSViv 62# define newSVval64 newSViv
58# define SvVAL64 SvIV 63# define SvVAL64 SvIV
1628 CODE: 1633 CODE:
1629 runtime = SvNVx (sv_runtime); 1634 runtime = SvNVx (sv_runtime);
1630 server_tick (); 1635 server_tick ();
1631 1636
1632void 1637void
1633LOG (int level, char *msg) 1638LOG (int level, utf8_string msg)
1634 PROTOTYPE: $$ 1639 PROTOTYPE: $$
1635 C_ARGS: (LogLevel)level, "%s", msg 1640 C_ARGS: (LogLevel)level, "%s", msg
1636 1641
1637char *path_combine (char *base, char *path) 1642octet_string path_combine (octet_string base, octet_string path)
1638 PROTOTYPE: $$ 1643 PROTOTYPE: $$
1639 1644
1640char *path_combine_and_normalize (char *base, char *path) 1645octet_string path_combine_and_normalize (octet_string base, octet_string path)
1641 PROTOTYPE: $$ 1646 PROTOTYPE: $$
1642 1647
1643const char * 1648const_octet_string
1644get_maps_directory (char *path) 1649get_maps_directory (octet_string path)
1645 PROTOTYPE: $ 1650 PROTOTYPE: $
1646 ALIAS: maps_directory = 0 1651 ALIAS: maps_directory = 0
1647 CODE: 1652 CODE:
1648 RETVAL = create_pathname (path); 1653 RETVAL = create_pathname (path);
1649 OUTPUT: RETVAL 1654 OUTPUT: RETVAL
1651void 1656void
1652sub_generation_inc () 1657sub_generation_inc ()
1653 CODE: 1658 CODE:
1654 PL_sub_generation++; 1659 PL_sub_generation++;
1655 1660
1656const char * 1661const_octet_string
1657mapdir () 1662mapdir ()
1658 PROTOTYPE: 1663 PROTOTYPE:
1659 ALIAS: 1664 ALIAS:
1660 mapdir = 0 1665 mapdir = 0
1661 uniquedir = 1 1666 uniquedir = 1
1677 } 1682 }
1678 OUTPUT: RETVAL 1683 OUTPUT: RETVAL
1679 1684
1680void abort () 1685void abort ()
1681 1686
1682void fork_abort (char *cause = "cf::fork_abort") 1687void fork_abort (octet_string cause = "cf::fork_abort")
1683 1688
1684void cleanup (const char *cause, bool make_core = false) 1689void cleanup (octet_string cause, bool make_core = false)
1685 1690
1686void emergency_save () 1691void emergency_save ()
1687 1692
1688void _exit (int status = EXIT_SUCCESS) 1693void _exit (int status = EXIT_SUCCESS)
1689 1694
1699 1704
1700int munlockall () 1705int munlockall ()
1701 1706
1702#endif 1707#endif
1703 1708
1704int find_animation (char *text) 1709int find_animation (utf8_string text)
1705 PROTOTYPE: $ 1710 PROTOTYPE: $
1706 1711
1707int random_roll (int min, int max, object *op, int goodbad); 1712int random_roll (int min, int max, object *op, int goodbad);
1708 1713
1709const char *cost_string_from_value(uint64 cost, int approx = 0) 1714const_utf8_string cost_string_from_value(uint64 cost, int approx = 0)
1710 1715
1711int 1716int
1712exp_to_level (val64 exp) 1717exp_to_level (val64 exp)
1713 CODE: 1718 CODE:
1714{ 1719{
1746 else 1751 else
1747 XSRETURN_UNDEF; 1752 XSRETURN_UNDEF;
1748 OUTPUT: RETVAL 1753 OUTPUT: RETVAL
1749 1754
1750bool 1755bool
1751load_resource_file (const char *filename) 1756load_resource_file (octet_string filename)
1752 1757
1753MODULE = cf PACKAGE = cf::attachable 1758MODULE = cf PACKAGE = cf::attachable
1754 1759
1755int 1760int
1756valid (SV *obj) 1761valid (SV *obj)
1855num_animations (object *op) 1860num_animations (object *op)
1856 CODE: 1861 CODE:
1857 RETVAL = NUM_ANIMATIONS (op); 1862 RETVAL = NUM_ANIMATIONS (op);
1858 OUTPUT: RETVAL 1863 OUTPUT: RETVAL
1859 1864
1860object *find_best_object_match (object *op, const char *match) 1865object *find_best_object_match (object *op, utf8_string match)
1861 1866
1862object *find_marked_object (object *op) 1867object *find_marked_object (object *op)
1863 1868
1864int need_identify (object *obj); 1869int need_identify (object *obj);
1865 1870
1885 CODE: 1890 CODE:
1886 player_apply_below (op); 1891 player_apply_below (op);
1887 1892
1888int cast_heal (object *op, object *caster, object *spell, int dir = 0) 1893int cast_heal (object *op, object *caster, object *spell, int dir = 0)
1889 1894
1890object *cf_object_present_archname_inside (object *op, char *whatstr) 1895object *cf_object_present_archname_inside (object *op, utf8_string whatstr)
1891 1896
1892int cf_object_transfer (object *op, int x, int y, int r = 0, object_ornull *orig = 0) 1897int cf_object_transfer (object *op, int x, int y, int r = 0, object_ornull *orig = 0)
1893 1898
1894int cf_object_change_map (object *op, int x, int y, maptile *map) 1899int cf_object_change_map (object *op, int x, int y, maptile *map)
1895 1900
1915 RETVAL = pay_for_amount (amount, op); 1920 RETVAL = pay_for_amount (amount, op);
1916 OUTPUT: RETVAL 1921 OUTPUT: RETVAL
1917 1922
1918void pay_player (object *op, uint64 amount) 1923void pay_player (object *op, uint64 amount)
1919 1924
1920val64 pay_player_arch (object *op, const char *arch, uint64 amount) 1925val64 pay_player_arch (object *op, utf8_string arch, uint64 amount)
1921 1926
1922int cast_spell (object *op, object *caster, int dir, object *spell_ob, char *stringarg = 0) 1927int cast_spell (object *op, object *caster, int dir, object *spell_ob, utf8_string stringarg = 0)
1923 1928
1924void learn_spell (object *op, object *sp, int special_prayer = 0) 1929void learn_spell (object *op, object *sp, int special_prayer = 0)
1925 CODE: 1930 CODE:
1926 do_learn_spell (op, sp, special_prayer); 1931 do_learn_spell (op, sp, special_prayer);
1927 1932
1928void forget_spell (object *op, object *sp) 1933void forget_spell (object *op, object *sp)
1929 CODE: 1934 CODE:
1930 do_forget_spell (op, query_name (sp)); 1935 do_forget_spell (op, query_name (sp));
1931 1936
1932object *check_for_spell (object *op, char *spellname) 1937object *check_for_spell (object *op, utf8_string spellname)
1933 CODE: 1938 CODE:
1934 RETVAL = check_spell_known (op, spellname); 1939 RETVAL = check_spell_known (op, spellname);
1935 OUTPUT: RETVAL 1940 OUTPUT: RETVAL
1936 1941
1937int query_money (object *op) 1942int query_money (object *op)
1950 1955
1951int cf_object_teleport (object *op, maptile *map, int x, int y) 1956int cf_object_teleport (object *op, maptile *map, int x, int y)
1952 1957
1953void update_object (object *op, int action) 1958void update_object (object *op, int action)
1954 1959
1955object *cf_create_object_by_name (const char *name) 1960object *cf_create_object_by_name (utf8_string name)
1956 1961
1957void change_exp (object *op, uint64 exp, const char *skill_name = 0, int flag = 0) 1962void change_exp (object *op, uint64 exp, utf8_string skill_name = 0, int flag = 0)
1958 1963
1959void player_lvl_adj (object *who, object *skill = 0) 1964void player_lvl_adj (object *who, object *skill = 0)
1960 1965
1961int kill_object (object *op, int dam = 0, object *hitter = 0, int type = AT_PHYSICAL) 1966int kill_object (object *op, int dam = 0, object *hitter = 0, int type = AT_PHYSICAL)
1962 1967
1976object *cf_insert_ob_in_ob (object *ob, object *where) 1981object *cf_insert_ob_in_ob (object *ob, object *where)
1977 1982
1978# no clean way to get an object from an archetype - stupid idiotic 1983# no clean way to get an object from an archetype - stupid idiotic
1979# dumb kludgy misdesigned plug-in api slowly gets on my nerves. 1984# dumb kludgy misdesigned plug-in api slowly gets on my nerves.
1980 1985
1981object *new (const char *archetype = 0) 1986object *new (utf8_string archetype = 0)
1982 PROTOTYPE: ;$ 1987 PROTOTYPE: ;$
1983 CODE: 1988 CODE:
1984 RETVAL = archetype ? get_archetype (archetype) : cf_create_object (); 1989 RETVAL = archetype ? get_archetype (archetype) : cf_create_object ();
1985 OUTPUT: 1990 OUTPUT:
1986 RETVAL 1991 RETVAL
1991{ 1996{
1992 int unused_type; 1997 int unused_type;
1993 RETVAL = (object *)object_insert (&unused_type, ob, 0, where, orig, flag, x, y); 1998 RETVAL = (object *)object_insert (&unused_type, ob, 0, where, orig, flag, x, y);
1994} 1999}
1995 2000
1996# syntatic sugar for easier use in event callbacks.
1997const char *options (object *op)
1998 CODE:
1999 RETVAL = op->name;
2000 OUTPUT:
2001 RETVAL
2002
2003player *contr (object *op) 2001player *contr (object *op)
2004 CODE: 2002 CODE:
2005 RETVAL = op->contr; 2003 RETVAL = op->contr;
2006 OUTPUT: RETVAL 2004 OUTPUT: RETVAL
2007 2005
2008const char *get_ob_key_value (object *op, const char *key) 2006const_utf8_string get_ob_key_value (object *op, utf8_string key)
2009 2007
2010bool set_ob_key_value (object *op, const char *key, const char *value = 0, int add_key = 1) 2008bool set_ob_key_value (object *op, utf8_string key, utf8_string value = 0, int add_key = 1)
2011 2009
2012object *get_nearest_player (object *ob) 2010object *get_nearest_player (object *ob)
2013 ALIAS: nearest_player = 0 2011 ALIAS: nearest_player = 0
2014 PREINIT: 2012 PREINIT:
2015 extern object *get_nearest_player (object *); 2013 extern object *get_nearest_player (object *);
2031bool on_same_map_as (object *ob, object *other) 2029bool on_same_map_as (object *ob, object *other)
2032 CODE: 2030 CODE:
2033 RETVAL = on_same_map (ob, other); 2031 RETVAL = on_same_map (ob, other);
2034 OUTPUT: RETVAL 2032 OUTPUT: RETVAL
2035 2033
2036const char * 2034const_utf8_string
2037base_name (object *op, int plural = op->nrof > 1) 2035base_name (object *op, int plural = op->nrof > 1)
2038 CODE: 2036 CODE:
2039 RETVAL = query_base_name (op, plural); 2037 RETVAL = query_base_name (op, plural);
2040 OUTPUT: RETVAL 2038 OUTPUT: RETVAL
2041 2039
2048 RETVAL = op->contr; 2046 RETVAL = op->contr;
2049 OUTPUT: RETVAL 2047 OUTPUT: RETVAL
2050 2048
2051void check_score (object *op) 2049void check_score (object *op)
2052 2050
2053void message (object *op, char *txt, int flags = NDI_ORANGE | NDI_UNIQUE) 2051void message (object *op, utf8_string txt, int flags = NDI_ORANGE | NDI_UNIQUE)
2054 CODE: 2052 CODE:
2055 new_draw_info (flags, 0, op, txt); 2053 new_draw_info (flags, 0, op, txt);
2056 2054
2057object *cf_player_send_inventory (object *op) 2055object *cf_player_send_inventory (object *op)
2058 2056
2059char *cf_player_get_ip (object *op) 2057octet_string cf_player_get_ip (object *op)
2060 ALIAS: ip = 0 2058 ALIAS: ip = 0
2061 2059
2062object *cf_player_get_marked_item (object *op) 2060object *cf_player_get_marked_item (object *op)
2063 ALIAS: marked_item = 0 2061 ALIAS: marked_item = 0
2064 2062
2074void esrv_update_item (object *op, int what, object *item) 2072void esrv_update_item (object *op, int what, object *item)
2075 C_ARGS: what, op, item 2073 C_ARGS: what, op, item
2076 2074
2077void clear_los (object *op) 2075void clear_los (object *op)
2078 2076
2079int command_summon (object *op, char *params) 2077int command_summon (object *op, utf8_string params)
2080 2078
2081int command_arrest (object *op, char *params) 2079int command_arrest (object *op, utf8_string params)
2082 2080
2083 2081
2084MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ 2082MODULE = cf PACKAGE = cf::player PREFIX = cf_player_
2085 2083
2086INCLUDE: $PERL $srcdir/genacc player ../include/player.h | 2084INCLUDE: $PERL $srcdir/genacc player ../include/player.h |
2351 2349
2352# worst xs function of my life 2350# worst xs function of my life
2353bool 2351bool
2354_create_random_map (\ 2352_create_random_map (\
2355 maptile *self,\ 2353 maptile *self,\
2356 char *wallstyle,\ 2354 utf8_string wallstyle,\
2357 char *wall_name,\ 2355 utf8_string wall_name,\
2358 char *floorstyle,\ 2356 utf8_string floorstyle,\
2359 char *monsterstyle,\ 2357 utf8_string monsterstyle,\
2360 char *treasurestyle,\ 2358 utf8_string treasurestyle,\
2361 char *layoutstyle,\ 2359 utf8_string layoutstyle,\
2362 char *doorstyle,\ 2360 utf8_string doorstyle,\
2363 char *decorstyle,\ 2361 utf8_string decorstyle,\
2364 char *origin_map,\ 2362 utf8_string origin_map,\
2365 char *final_map,\ 2363 utf8_string final_map,\
2366 char *exitstyle,\ 2364 utf8_string exitstyle,\
2367 char *this_map,\ 2365 utf8_string this_map,\
2368 char *exit_on_final_map,\ 2366 utf8_string exit_on_final_map,\
2369 int xsize,\ 2367 int xsize,\
2370 int ysize,\ 2368 int ysize,\
2371 int expand2x,\ 2369 int expand2x,\
2372 int layoutoptions1,\ 2370 int layoutoptions1,\
2373 int layoutoptions2,\ 2371 int layoutoptions2,\
2386 val64 total_map_hp,\ 2384 val64 total_map_hp,\
2387 int map_layout_style,\ 2385 int map_layout_style,\
2388 int treasureoptions,\ 2386 int treasureoptions,\
2389 int symmetry_used,\ 2387 int symmetry_used,\
2390 region *region,\ 2388 region *region,\
2391 char *custom\ 2389 utf8_string custom\
2392) 2390)
2393 CODE: 2391 CODE:
2394{ 2392{
2395 random_map_params rmp; 2393 random_map_params rmp;
2396 2394
2437 OUTPUT: 2435 OUTPUT:
2438 RETVAL 2436 RETVAL
2439 2437
2440MODULE = cf PACKAGE = cf::arch 2438MODULE = cf PACKAGE = cf::arch
2441 2439
2442archetype *find (const char *name) 2440archetype *find (utf8_string name)
2443 CODE: 2441 CODE:
2444 RETVAL = archetype::find (name); 2442 RETVAL = archetype::find (name);
2445 OUTPUT: 2443 OUTPUT:
2446 RETVAL 2444 RETVAL
2447 2445
2469list () 2467list ()
2470 PPCODE: 2468 PPCODE:
2471 for_all_regions (rgn) 2469 for_all_regions (rgn)
2472 XPUSHs (sv_2mortal (to_sv (rgn))); 2470 XPUSHs (sv_2mortal (to_sv (rgn)));
2473 2471
2474region *find (char *name) 2472region *find (utf8_string name)
2475 PROTOTYPE: $ 2473 PROTOTYPE: $
2476 CODE: 2474 CODE:
2477 RETVAL = region::find (name); 2475 RETVAL = region::find (name);
2478 OUTPUT: RETVAL 2476 OUTPUT: RETVAL
2479 2477
2480region *find_fuzzy (char *name) 2478region *find_fuzzy (utf8_string name)
2481 PROTOTYPE: $ 2479 PROTOTYPE: $
2482 CODE: 2480 CODE:
2483 RETVAL = region::find_fuzzy (name); 2481 RETVAL = region::find_fuzzy (name);
2484 OUTPUT: RETVAL 2482 OUTPUT: RETVAL
2485 2483
2526 2524
2527MODULE = cf PACKAGE = cf::face PREFIX = face_ 2525MODULE = cf PACKAGE = cf::face PREFIX = face_
2528 2526
2529INCLUDE: $PERL $srcdir/genacc faceset ../include/face.h | 2527INCLUDE: $PERL $srcdir/genacc faceset ../include/face.h |
2530 2528
2531faceidx face_find (const char *name, faceidx defidx = 0) 2529faceidx face_find (utf8_string name, faceidx defidx = 0)
2532 2530
2533faceidx alloc (const char *name) 2531faceidx alloc (utf8_string name)
2534 CODE: 2532 CODE:
2535{ 2533{
2536 do 2534 do
2537 { 2535 {
2538 RETVAL = faces.size (); 2536 RETVAL = faces.size ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines