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.425 by root, Wed Nov 14 06:21:39 2012 UTC vs.
Revision 1.427 by root, Tue Nov 20 14:50:17 2012 UTC

1272 CALL_ARG (y); 1272 CALL_ARG (y);
1273 CALL_CALL ("cf::object::player::goto", G_VOID); 1273 CALL_CALL ("cf::object::player::goto", G_VOID);
1274 CALL_END; 1274 CALL_END;
1275} 1275}
1276 1276
1277const_utf8_string 1277const_utf8_string
1278object::ref () const 1278object::ref () const
1279{ 1279{
1280 if (type == PLAYER) 1280 if (type == PLAYER)
1281 return format ("player/<1.%llx>/%s", (unsigned long long)uuid.seq, &name); 1281 return format ("player/<1.%llx>/%s", (unsigned long long)uuid.seq, &name);
1282 else 1282 else
1606 coroapi::cede_to_tick (); 1606 coroapi::cede_to_tick ();
1607 1607
1608NV till_tick () 1608NV till_tick ()
1609 CODE: 1609 CODE:
1610 RETVAL = SvNVX (sv_next_tick) - now (); 1610 RETVAL = SvNVX (sv_next_tick) - now ();
1611 OUTPUT: 1611 OUTPUT: RETVAL
1612 RETVAL
1613 1612
1614int tick_inhibit () 1613int tick_inhibit ()
1615 CODE: 1614 CODE:
1616 RETVAL = tick_inhibit; 1615 RETVAL = tick_inhibit;
1617 OUTPUT: 1616 OUTPUT: RETVAL
1618 RETVAL
1619 1617
1620void tick_inhibit_inc () 1618void tick_inhibit_inc ()
1621 CODE: 1619 CODE:
1622 ++tick_inhibit; 1620 ++tick_inhibit;
1623 1621
1668 case 1: RETVAL = gen (SvUV (ST (0))); break; 1666 case 1: RETVAL = gen (SvUV (ST (0))); break;
1669 case 2: RETVAL = gen (SvIV (ST (0)), SvIV (ST (1))); break; 1667 case 2: RETVAL = gen (SvIV (ST (0)), SvIV (ST (1))); break;
1670 default: croak ("cf::rndm requires zero, one or two parameters."); break; 1668 default: croak ("cf::rndm requires zero, one or two parameters."); break;
1671 } 1669 }
1672} 1670}
1673 OUTPUT: 1671 OUTPUT: RETVAL
1674 RETVAL
1675 1672
1676NV clamp (NV value, NV min_value, NV max_value) 1673NV clamp (NV value, NV min_value, NV max_value)
1677 CODE: 1674 CODE:
1678 RETVAL = clamp (value, min_value, max_value); 1675 RETVAL = clamp (value, min_value, max_value);
1679 OUTPUT: 1676 OUTPUT: RETVAL
1680 RETVAL
1681 1677
1682NV lerp (NV value, NV min_in, NV max_in, NV min_out, NV max_out) 1678NV lerp (NV value, NV min_in, NV max_in, NV min_out, NV max_out)
1683 CODE: 1679 CODE:
1684 RETVAL = lerp (value, min_in, max_in, min_out, max_out); 1680 RETVAL = lerp (value, min_in, max_in, min_out, max_out);
1685 OUTPUT: 1681 OUTPUT: RETVAL
1686 RETVAL
1687 1682
1688const char *ordinal (int i) 1683const char *ordinal (int i)
1689 1684
1690void weaken (...) 1685void weaken (...)
1691 PROTOTYPE: @ 1686 PROTOTYPE: @
1839 RETVAL = IN_RANGE_EXC (atnr, 0, NROFATTACKS) 1834 RETVAL = IN_RANGE_EXC (atnr, 0, NROFATTACKS)
1840 ? newSVpv (change_resist_msg [atnr], 0) 1835 ? newSVpv (change_resist_msg [atnr], 0)
1841 : &PL_sv_undef; 1836 : &PL_sv_undef;
1842 OUTPUT: RETVAL 1837 OUTPUT: RETVAL
1843 1838
1839int
1840skill_flags (int idx)
1841 CODE:
1842 if (idx < 0 || idx >= array_length (skill_flags))
1843 croak ("skill_flags: index out of bounds");
1844 RETVAL = skill_flags [idx];
1845 OUTPUT: RETVAL
1846
1844UUID 1847UUID
1845uuid_cur () 1848uuid_cur ()
1846 CODE: 1849 CODE:
1847 RETVAL = UUID::cur; 1850 RETVAL = UUID::cur;
1848 OUTPUT: 1851 OUTPUT: RETVAL
1849 RETVAL
1850 1852
1851UUID 1853UUID
1852uuid_gen () 1854uuid_gen ()
1853 CODE: 1855 CODE:
1854 RETVAL = UUID::gen (); 1856 RETVAL = UUID::gen ();
1855 OUTPUT: 1857 OUTPUT: RETVAL
1856 RETVAL
1857 1858
1858val64 1859val64
1859uuid_seq (UUID uuid) 1860uuid_seq (UUID uuid)
1860 CODE: 1861 CODE:
1861 RETVAL = uuid.seq; 1862 RETVAL = uuid.seq;
1862 OUTPUT: 1863 OUTPUT: RETVAL
1863 RETVAL
1864 1864
1865UUID 1865UUID
1866uuid_str (val64 seq) 1866uuid_str (val64 seq)
1867 CODE: 1867 CODE:
1868 RETVAL.seq = seq; 1868 RETVAL.seq = seq;
1869 OUTPUT: 1869 OUTPUT: RETVAL
1870 RETVAL
1871 1870
1872void 1871void
1873coin_names () 1872coin_names ()
1874 PPCODE: 1873 PPCODE:
1875 EXTEND (SP, NUM_COINS); 1874 EXTEND (SP, NUM_COINS);
1898 1897
1899int 1898int
1900valid (SV *obj) 1899valid (SV *obj)
1901 CODE: 1900 CODE:
1902 RETVAL = SvROK (obj) && mg_find (SvRV (obj), PERL_MAGIC_ext); 1901 RETVAL = SvROK (obj) && mg_find (SvRV (obj), PERL_MAGIC_ext);
1903 OUTPUT: 1902 OUTPUT: RETVAL
1904 RETVAL
1905 1903
1906bool should_invoke (attachable *obj, int event) 1904bool should_invoke (attachable *obj, int event)
1907 CODE: 1905 CODE:
1908 RETVAL = obj->should_invoke ((event_type)event); 1906 RETVAL = obj->should_invoke ((event_type)event);
1909 OUTPUT: RETVAL 1907 OUTPUT: RETVAL
1991 case 0: RETVAL = body_locations[slot].name ; break; 1989 case 0: RETVAL = body_locations[slot].name ; break;
1992 case 1: RETVAL = body_locations[slot].use_name ; break; 1990 case 1: RETVAL = body_locations[slot].use_name ; break;
1993 case 2: RETVAL = body_locations[slot].nonuse_name; break; 1991 case 2: RETVAL = body_locations[slot].nonuse_name; break;
1994 } 1992 }
1995} 1993}
1996 OUTPUT: 1994 OUTPUT: RETVAL
1997 RETVAL
1998 1995
1999# missing properties 1996# missing properties
2000 1997
2001object *head (object *op) 1998object *head (object *op)
2002 PROTOTYPE: $ 1999 PROTOTYPE: $
2038 if (ix) 2035 if (ix)
2039 op->slot[slot].used = value; 2036 op->slot[slot].used = value;
2040 else 2037 else
2041 op->slot[slot].info = value; 2038 op->slot[slot].info = value;
2042} 2039}
2043 OUTPUT: 2040 OUTPUT: RETVAL
2044 RETVAL
2045 2041
2046object *find_best_object_match (object *op, utf8_string match) 2042object *find_best_object_match (object *op, utf8_string match)
2047 2043
2048int apply_shop_mat (object *shop_mat, object *op); 2044int apply_shop_mat (object *shop_mat, object *op);
2049 2045
2050int move (object *op, int dir, object *originator = op) 2046int move (object *op, int dir, object *originator = op)
2051 CODE: 2047 CODE:
2052 RETVAL = op->move (dir, originator); 2048 RETVAL = op->move (dir, originator);
2053 OUTPUT: 2049 OUTPUT: RETVAL
2054 RETVAL
2055 2050
2056void apply_below (object *op) 2051void apply_below (object *op)
2057 CODE: 2052 CODE:
2058 player_apply_below (op); 2053 player_apply_below (op);
2059 2054
2130 PROTOTYPE: ;$ 2125 PROTOTYPE: ;$
2131 CODE: 2126 CODE:
2132 RETVAL = archetype 2127 RETVAL = archetype
2133 ? archetype::get (archetype) 2128 ? archetype::get (archetype)
2134 : object::create (); 2129 : object::create ();
2135 OUTPUT: 2130 OUTPUT: RETVAL
2136 RETVAL
2137 2131
2138object *generate (utf8_string arch, object *creator) 2132object *generate (utf8_string arch, object *creator)
2139 CODE: 2133 CODE:
2140 object *obj = archetype::get (arch); 2134 object *obj = archetype::get (arch);
2141 fix_generated_item (obj, creator, 0, 0, GT_MINIMAL); 2135 fix_generated_item (obj, creator, 0, 0, GT_MINIMAL);
2142 RETVAL = obj; 2136 RETVAL = obj;
2143 OUTPUT: 2137 OUTPUT: RETVAL
2144 RETVAL
2145 2138
2146object *find_object (U32 tag) 2139object *find_object (U32 tag)
2147 2140
2148object *find_object_uuid (UUID i) 2141object *find_object_uuid (UUID i)
2149 2142
2155 RETVAL = insert_ob_in_map_at (ob, where, orig, flag, x, y); 2148 RETVAL = insert_ob_in_map_at (ob, where, orig, flag, x, y);
2156 2149
2157 if (RETVAL->destroyed ()) 2150 if (RETVAL->destroyed ())
2158 RETVAL = 0; 2151 RETVAL = 0;
2159} 2152}
2160 OUTPUT: 2153 OUTPUT: RETVAL
2161 RETVAL
2162 2154
2163shstr 2155shstr
2164object::kv_get (shstr key) 2156object::kv_get (shstr key)
2165 CODE: 2157 CODE:
2166 RETVAL = THIS->kv.get (key); 2158 RETVAL = THIS->kv.get (key);
2167 OUTPUT: 2159 OUTPUT: RETVAL
2168 RETVAL
2169 2160
2170void 2161void
2171object::kv_del (shstr key) 2162object::kv_del (shstr key)
2172 CODE: 2163 CODE:
2173 THIS->kv.del (key); 2164 THIS->kv.del (key);
2272#d# TODO: replace by blocked_los accessor, fix code using this 2263#d# TODO: replace by blocked_los accessor, fix code using this
2273bool 2264bool
2274cell_visible (player *pl, int dx, int dy) 2265cell_visible (player *pl, int dx, int dy)
2275 CODE: 2266 CODE:
2276 RETVAL = pl->blocked_los (dx, dy) != LOS_BLOCKED; 2267 RETVAL = pl->blocked_los (dx, dy) != LOS_BLOCKED;
2277 OUTPUT: 2268 OUTPUT: RETVAL
2278 RETVAL
2279 2269
2280void 2270void
2281send (player *pl, SV *packet) 2271send (player *pl, SV *packet)
2282 CODE: 2272 CODE:
2283{ 2273{
2359outdoor_darkness (int darkness = 0) 2349outdoor_darkness (int darkness = 0)
2360 CODE: 2350 CODE:
2361 RETVAL = maptile::outdoor_darkness; 2351 RETVAL = maptile::outdoor_darkness;
2362 if (items) 2352 if (items)
2363 maptile::outdoor_darkness = darkness; 2353 maptile::outdoor_darkness = darkness;
2364 OUTPUT: 2354 OUTPUT: RETVAL
2365 RETVAL
2366 2355
2367void 2356void
2368maptile::instantiate () 2357maptile::instantiate ()
2369 2358
2370maptile *new () 2359maptile *new ()
2371 PROTOTYPE: 2360 PROTOTYPE:
2372 CODE: 2361 CODE:
2373 RETVAL = new maptile; 2362 RETVAL = new maptile;
2374 OUTPUT: 2363 OUTPUT: RETVAL
2375 RETVAL
2376 2364
2377void 2365void
2378maptile::players () 2366maptile::players ()
2379 PPCODE: 2367 PPCODE:
2380 if (GIMME_V == G_SCALAR) 2368 if (GIMME_V == G_SCALAR)
2515 if (!pos.move (dir).normalise ()) 2503 if (!pos.move (dir).normalise ())
2516 XSRETURN_UNDEF; 2504 XSRETURN_UNDEF;
2517 2505
2518 RETVAL = &*pos; 2506 RETVAL = &*pos;
2519} 2507}
2520 OUTPUT: 2508 OUTPUT: RETVAL
2521 RETVAL
2522 2509
2523void 2510void
2524at (maptile *map, unsigned int x, unsigned int y, int dir = 0) 2511at (maptile *map, unsigned int x, unsigned int y, int dir = 0)
2525 PROTOTYPE: $$$;$ 2512 PROTOTYPE: $$$;$
2526 PPCODE: 2513 PPCODE:
2567# worst xs function of my life 2554# worst xs function of my life
2568bool 2555bool
2569_create_random_map (maptile *self, SV *options) 2556_create_random_map (maptile *self, SV *options)
2570 CODE: 2557 CODE:
2571{ 2558{
2572 random_map_params rmp ((HV *)SvRV (options)); 2559 random_map_params rmp ((HV *)SvRV (options));
2573 RETVAL = self->generate_random_map (&rmp); 2560 RETVAL = self->generate_random_map (&rmp);
2574} 2561}
2575 OUTPUT: 2562 OUTPUT: RETVAL
2576 RETVAL
2577 2563
2578MODULE = cf PACKAGE = cf::mapspace 2564MODULE = cf PACKAGE = cf::mapspace
2579 2565
2580INCLUDE: $PERL $srcdir/genacc mapspace $srcdir/../include/map.h | 2566INCLUDE: $PERL $srcdir/genacc mapspace $srcdir/../include/map.h |
2581 2567
2707 if (RETVAL) 2693 if (RETVAL)
2708 { 2694 {
2709 THIS->send_face (RETVAL, pri); 2695 THIS->send_face (RETVAL, pri);
2710 THIS->flush_fx (); 2696 THIS->flush_fx ();
2711 } 2697 }
2712 OUTPUT: 2698 OUTPUT: RETVAL
2713 RETVAL
2714 2699
2715int 2700int
2716client::fx_want (int idx, int value = -1) 2701client::fx_want (int idx, int value = -1)
2717 CODE: 2702 CODE:
2718 if (0 < idx && idx < FT_NUM) 2703 if (0 < idx && idx < FT_NUM)
2721 if (items > 2) 2706 if (items > 2)
2722 THIS->fx_want [idx] = value; 2707 THIS->fx_want [idx] = value;
2723 } 2708 }
2724 else 2709 else
2725 RETVAL = 0; 2710 RETVAL = 0;
2726 OUTPUT: 2711 OUTPUT: RETVAL
2727 RETVAL
2728 2712
2729MODULE = cf PACKAGE = cf::sound PREFIX = sound_ 2713MODULE = cf PACKAGE = cf::sound PREFIX = sound_
2730 2714
2731faceidx sound_find (utf8_string name) 2715faceidx sound_find (utf8_string name)
2732 2716
2806SV *mangle_csum (SV *chksum) 2790SV *mangle_csum (SV *chksum)
2807 CODE: 2791 CODE:
2808 STRLEN len; 2792 STRLEN len;
2809 char *data = SvPVbyte (chksum, len); 2793 char *data = SvPVbyte (chksum, len);
2810 RETVAL = newSVpvn (data, min (len, CHKSUM_MAXLEN)); 2794 RETVAL = newSVpvn (data, min (len, CHKSUM_MAXLEN));
2811 OUTPUT: 2795 OUTPUT: RETVAL
2812 RETVAL
2813 2796
2814SV *get_csum (faceidx idx, int faceset = 0) 2797SV *get_csum (faceidx idx, int faceset = 0)
2815 CODE: 2798 CODE:
2816 facedata *d = face_data (idx, faceset); 2799 facedata *d = face_data (idx, faceset);
2817 if (!d) XSRETURN_UNDEF; 2800 if (!d) XSRETURN_UNDEF;
2818 RETVAL = newSVpvn ((char *)d->chksum, d->chksum_len); 2801 RETVAL = newSVpvn ((char *)d->chksum, d->chksum_len);
2819 OUTPUT: 2802 OUTPUT: RETVAL
2820 RETVAL
2821 2803
2822int get_type (faceidx idx) 2804int get_type (faceidx idx)
2823 CODE: 2805 CODE:
2824 faceinfo *f = face_info (idx); 2806 faceinfo *f = face_info (idx);
2825 if (!f) XSRETURN_UNDEF; 2807 if (!f) XSRETURN_UNDEF;
2826 RETVAL = f->type; 2808 RETVAL = f->type;
2827 OUTPUT: 2809 OUTPUT: RETVAL
2828 RETVAL
2829 2810
2830SV *get_name (faceidx idx) 2811SV *get_name (faceidx idx)
2831 CODE: 2812 CODE:
2832 faceinfo *f = face_info (idx); 2813 faceinfo *f = face_info (idx);
2833 if (!f) XSRETURN_UNDEF; 2814 if (!f) XSRETURN_UNDEF;
2834 RETVAL = to_sv (f->name); 2815 RETVAL = to_sv (f->name);
2835 OUTPUT: 2816 OUTPUT: RETVAL
2836 RETVAL
2837 2817
2838void invalidate (faceidx idx) 2818void invalidate (faceidx idx)
2839 CODE: 2819 CODE:
2840 for_all_clients (ns) 2820 for_all_clients (ns)
2841 ns->invalidate_face (idx); 2821 ns->invalidate_face (idx);
2905bool 2885bool
2906errors_are_fatal (bool fatal) 2886errors_are_fatal (bool fatal)
2907 CODE: 2887 CODE:
2908 RETVAL = object_thawer::errors_are_fatal; 2888 RETVAL = object_thawer::errors_are_fatal;
2909 object_thawer::errors_are_fatal = fatal; 2889 object_thawer::errors_are_fatal = fatal;
2910 OUTPUT: 2890 OUTPUT: RETVAL
2911 RETVAL
2912 2891
2913SV * 2892SV *
2914new_from_file (char *klass, octet_string path) 2893new_from_file (char *klass, octet_string path)
2915 CODE: 2894 CODE:
2916 object_thawer *f = new object_thawer (path); 2895 object_thawer *f = new object_thawer (path);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines