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.222 by root, Sun Jun 24 04:09:29 2007 UTC vs.
Revision 1.227 by root, Tue Jul 10 16:24:00 2007 UTC

3 * 3 *
4 * Copyright (©) 2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team 4 * Copyright (©) 2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team
5 * Copyright (©) 2001-2005,2007 by Chachkoff Yann 5 * Copyright (©) 2001-2005,2007 by Chachkoff Yann
6 * Copyright (©) 2006,2007 by Marc Lehmann <cf@schmorp.de> 6 * Copyright (©) 2006,2007 by Marc Lehmann <cf@schmorp.de>
7 * 7 *
8 * Crossfire TRT is free software; you can redistribute it and/or modify it 8 * Crossfire TRT is free software: you can redistribute it and/or modify
9 * under the terms of the GNU General Public License as published by the Free 9 * it under the terms of the GNU General Public License as published by
10 * Software Foundation; either version 2 of the License, or (at your option) 10 * the Free Software Foundation, either version 3 of the License, or
11 * any later version. 11 * (at your option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, but 13 * This program is distributed in the hope that it will be useful,
14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License along 18 * You should have received a copy of the GNU General Public License
19 * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 * 20 *
22 * The authors can be reached via e-mail to <crossfire@schmorp.de> 21 * The authors can be reached via e-mail to <crossfire@schmorp.de>
23 */ 22 */
24 23
25#include "autoconf.h" 24#include "autoconf.h"
382 return SvPTR (sv, klass); 381 return SvPTR (sv, klass);
383 else 382 else
384 return 0; 383 return 0;
385} 384}
386 385
386static inline SV *
387newSVpv_utf8 (const char *s)
388{
389 SV *sv = newSVpv (s, 0);
390 SvUTF8_on (sv);
391 return sv;
392}
393
394static inline SV *
395newSVpvn_utf8 (const char *s, STRLEN l)
396{
397 SV *sv = newSVpvn (s, l);
398 SvUTF8_on (sv);
399 return sv;
400}
401
387inline SV *to_sv (const shstr & v) { return v ? newSVpvn ((const char *)v, v.length ()) : &PL_sv_undef; } 402inline SV *to_sv (const shstr & v) { return v ? newSVpvn_utf8 ((const char *)v, v.length ()) : &PL_sv_undef; }
388inline SV *to_sv (const char * v) { return newSVpv (v, 0); } 403inline SV *to_sv (const char * v) { return newSVpv (v, 0); }
389inline SV *to_sv (bool v) { return newSViv (v); } 404inline SV *to_sv (bool v) { return newSViv (v); }
390inline SV *to_sv ( signed char v) { return newSViv (v); } 405inline SV *to_sv ( signed char v) { return newSViv (v); }
391inline SV *to_sv (unsigned char v) { return newSViv (v); } 406inline SV *to_sv (unsigned char v) { return newSViv (v); }
392inline SV *to_sv ( signed short v) { return newSViv (v); } 407inline SV *to_sv ( signed short v) { return newSViv (v); }
419 char buf[128]; 434 char buf[128];
420 snprintf (buf, 128, "<1.%" PRIx64 ">", v.seq); 435 snprintf (buf, 128, "<1.%" PRIx64 ">", v.seq);
421 return newSVpv (buf, 0); 436 return newSVpv (buf, 0);
422} 437}
423 438
424inline void sv_to (SV *sv, shstr &v) { v = SvOK (sv) ? SvPV_nolen (sv) : 0; } 439inline void sv_to (SV *sv, shstr &v) { v = SvOK (sv) ? SvPVutf8_nolen (sv) : 0; }
425inline void sv_to (SV *sv, char * &v) { free (v); v = SvOK (sv) ? strdup (SvPV_nolen (sv)) : 0; } 440inline void sv_to (SV *sv, char * &v) { free (v); v = SvOK (sv) ? strdup (SvPV_nolen (sv)) : 0; }
426inline void sv_to (SV *sv, bool &v) { v = SvIV (sv); } 441inline void sv_to (SV *sv, bool &v) { v = SvIV (sv); }
427inline void sv_to (SV *sv, signed char &v) { v = SvIV (sv); } 442inline void sv_to (SV *sv, signed char &v) { v = SvIV (sv); }
428inline void sv_to (SV *sv, unsigned char &v) { v = SvIV (sv); } 443inline void sv_to (SV *sv, unsigned char &v) { v = SvIV (sv); }
429inline void sv_to (SV *sv, signed short &v) { v = SvIV (sv); } 444inline void sv_to (SV *sv, signed short &v) { v = SvIV (sv); }
993{ 1008{
994 CALL_BEGIN (4); 1009 CALL_BEGIN (4);
995 CALL_ARG (ns); 1010 CALL_ARG (ns);
996 CALL_ARG (color); 1011 CALL_ARG (color);
997 CALL_ARG (type); 1012 CALL_ARG (type);
998 CALL_ARG (msg); 1013 CALL_ARG_SV (newSVpv_utf8 (msg));
999 CALL_CALL ("cf::client::send_msg", G_VOID); 1014 CALL_CALL ("cf::client::send_msg", G_VOID);
1000 CALL_END; 1015 CALL_END;
1001} 1016}
1002 1017
1003maptile * 1018maptile *
1994 CODE: 2009 CODE:
1995 RETVAL = archetype ? get_archetype (archetype) : object::create (); 2010 RETVAL = archetype ? get_archetype (archetype) : object::create ();
1996 OUTPUT: 2011 OUTPUT:
1997 RETVAL 2012 RETVAL
1998 2013
2014object *find_object (U32 tag)
2015
1999# TODO: nuke 2016# TODO: nuke
2000object *insert_ob_in_map_at (object *ob, maptile *where, object_ornull *orig, int flag, int x, int y) 2017object *insert_ob_in_map_at (object *ob, maptile *where, object_ornull *orig, int flag, int x, int y)
2001 PROTOTYPE: $$$$$$ 2018 PROTOTYPE: $$$$$$
2002 CODE: 2019 CODE:
2003{ 2020{
2004 int unused_type; 2021 int unused_type;
2005 RETVAL = (object *)object_insert (&unused_type, ob, 0, where, orig, flag, x, y); 2022 RETVAL = (object *)object_insert (&unused_type, ob, 0, where, orig, flag, x, y);
2006} 2023}
2007
2008player *contr (object *op)
2009 CODE:
2010 RETVAL = op->contr;
2011 OUTPUT: RETVAL
2012 2024
2013const_utf8_string get_ob_key_value (object *op, utf8_string key) 2025const_utf8_string get_ob_key_value (object *op, utf8_string key)
2014 2026
2015bool set_ob_key_value (object *op, utf8_string key, utf8_string value = 0, int add_key = 1) 2027bool set_ob_key_value (object *op, utf8_string key, utf8_string value = 0, int add_key = 1)
2016 2028
2591 if (!strcmp (name, BLANK_FACE_NAME)) blank_face = RETVAL; 2603 if (!strcmp (name, BLANK_FACE_NAME)) blank_face = RETVAL;
2592 if (!strcmp (name, EMPTY_FACE_NAME)) empty_face = RETVAL; 2604 if (!strcmp (name, EMPTY_FACE_NAME)) empty_face = RETVAL;
2593} 2605}
2594 OUTPUT: RETVAL 2606 OUTPUT: RETVAL
2595 2607
2596void set (faceidx idx, int visibility, int magicmap) 2608void set_type (faceidx idx, int value)
2609 ALIAS:
2610 set_type = 0
2611 set_visibility = 1
2612 set_magicmap = 2
2613 set_smooth = 3
2614 set_smoothlevel = 4
2597 CODE: 2615 CODE:
2598 faceinfo *f = face_info (idx); 2616 faceinfo *f = face_info (idx);
2599 assert (f); 2617 assert (f);
2600 f->visibility = visibility; 2618 switch (ix)
2601 f->magicmap = magicmap; 2619 {
2602 2620 case 0: f->type = value; break;
2603void set_smooth (faceidx idx, faceidx smooth, int smoothlevel) 2621 case 1: f->visibility = value; break;
2604 CODE: 2622 case 2: f->magicmap = value; break;
2605 faceinfo *f = face_info (idx); assert (f); 2623 case 3: f->smooth = value; break;
2606 f->smooth = smooth; 2624 case 4: f->smoothlevel = value; break;
2607 f->smoothlevel = smoothlevel; 2625 }
2608 2626
2609void set_data (faceidx idx, int faceset, SV *data, SV *chksum) 2627void set_data (faceidx idx, int faceset, SV *data, SV *chksum)
2610 CODE: 2628 CODE:
2611{ 2629{
2612 facedata *d = face_data (idx, faceset); 2630 facedata *d = face_data (idx, faceset);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines