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.288 by root, Tue May 6 18:47:32 2008 UTC vs.
Revision 1.291 by root, Sun Jun 15 20:32:51 2008 UTC

20 * 20 *
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
26#define PLUGIN_NAME "perl"
27#define PLUGIN_VERSION "cfperl 0.5"
28 25
29#if HAVE_EXECINFO_H 26#if HAVE_EXECINFO_H
30# include <execinfo.h> 27# include <execinfo.h>
31#endif 28#endif
32 29
940{ 937{
941 CALL_BEGIN (2); 938 CALL_BEGIN (2);
942 CALL_ARG (book); 939 CALL_ARG (book);
943 CALL_ARG (level); 940 CALL_ARG (level);
944 CALL_CALL ("ext::books::make_book", G_VOID); 941 CALL_CALL ("ext::books::make_book", G_VOID);
942 CALL_END;
943}
944
945void
946cfperl_expand_cfpod (player *pl, std::string &msg)
947{
948 CALL_BEGIN (2);
949 CALL_ARG (pl);
950 CALL_ARG_SV (newSVpvn_utf8 (msg.data (), msg.size ()));
951 CALL_CALL ("cf::player::expand_cfpod", G_SCALAR);
952
953 if (count)
954 {
955 STRLEN len;
956 char *data = SvPVutf8 (TOPs, len);
957 msg.assign (data, len);
958 }
959
945 CALL_END; 960 CALL_END;
946} 961}
947 962
948void 963void
949cfperl_send_msg (client *ns, int color, const char *type, const char *msg) 964cfperl_send_msg (client *ns, int color, const char *type, const char *msg)
2085void rangevector (object *ob, object *other, int flags = 0) 2100void rangevector (object *ob, object *other, int flags = 0)
2086 PROTOTYPE: $$;$ 2101 PROTOTYPE: $$;$
2087 PPCODE: 2102 PPCODE:
2088{ 2103{
2089 rv_vector rv; 2104 rv_vector rv;
2105
2106 PUTBACK;
2090 get_rangevector (ob, other, &rv, flags); 2107 get_rangevector (ob, other, &rv, flags);
2108 SPAGAIN;
2109
2091 EXTEND (SP, 5); 2110 EXTEND (SP, 5);
2092 PUSHs (newSVuv (rv.distance)); 2111 PUSHs (newSVuv (rv.distance));
2093 PUSHs (newSViv (rv.distance_x)); 2112 PUSHs (newSViv (rv.distance_x));
2094 PUSHs (newSViv (rv.distance_y)); 2113 PUSHs (newSViv (rv.distance_y));
2095 PUSHs (newSViv (rv.direction)); 2114 PUSHs (newSViv (rv.direction));
2402get_map_flags (maptile *map, int x, int y) 2421get_map_flags (maptile *map, int x, int y)
2403 PPCODE: 2422 PPCODE:
2404{ 2423{
2405 maptile *nmap = 0; 2424 maptile *nmap = 0;
2406 I16 nx = 0, ny = 0; 2425 I16 nx = 0, ny = 0;
2426
2427 PUTBACK;
2407 int flags = get_map_flags (map, &nmap, x, y, &nx, &ny); 2428 int flags = get_map_flags (map, &nmap, x, y, &nx, &ny);
2429 SPAGAIN;
2408 2430
2409 EXTEND (SP, 4); 2431 EXTEND (SP, 4);
2410 PUSHs (sv_2mortal (newSViv (flags))); 2432 PUSHs (sv_2mortal (newSViv (flags)));
2411 2433
2412 if (GIMME_V == G_ARRAY) 2434 if (GIMME_V == G_ARRAY)
2420void 2442void
2421at (maptile *map, unsigned int x, unsigned int y) 2443at (maptile *map, unsigned int x, unsigned int y)
2422 PROTOTYPE: $$$ 2444 PROTOTYPE: $$$
2423 PPCODE: 2445 PPCODE:
2424{ 2446{
2425 object *o;
2426 maptile *nmap = 0; 2447 maptile *nmap = 0;
2427 I16 nx, ny; 2448 I16 nx, ny;
2428 2449
2450 PUTBACK;
2429 get_map_flags (map, &nmap, x, y, &nx, &ny); 2451 get_map_flags (map, &nmap, x, y, &nx, &ny);
2452 SPAGAIN;
2430 2453
2431 if (nmap) 2454 if (nmap)
2432 for (o = GET_MAP_OB (nmap, nx, ny); o; o = o->above) 2455 for (object *o = nmap->at (nx, ny).bot; o; o = o->above)
2433 XPUSHs (sv_2mortal (to_sv (o))); 2456 XPUSHs (sv_2mortal (to_sv (o)));
2434} 2457}
2435 2458
2436SV * 2459SV *
2437bot_at (maptile *obj, unsigned int x, unsigned int y) 2460bot_at (maptile *obj, unsigned int x, unsigned int y)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines