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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines