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.192 by root, Tue Apr 17 20:41:15 2007 UTC vs.
Revision 1.194 by root, Mon Apr 23 18:09:57 2007 UTC

56 56
57typedef char *octet_string; 57typedef char *octet_string;
58typedef char *utf8_string; 58typedef char *utf8_string;
59typedef const char *const_octet_string; 59typedef const char *const_octet_string;
60typedef const char *const_utf8_string; 60typedef const char *const_utf8_string;
61
62typedef std::string std__string;
61 63
62#if IVSIZE >= 8 64#if IVSIZE >= 8
63 typedef IV val64; 65 typedef IV val64;
64# define newSVval64 newSViv 66# define newSVval64 newSViv
65# define SvVAL64 SvIV 67# define SvVAL64 SvIV
356inline SV *to_sv (living * v) { return newSVptr (v, stash_cf_living_wrap); } 358inline SV *to_sv (living * v) { return newSVptr (v, stash_cf_living_wrap); }
357 359
358inline SV *to_sv (object & v) { return to_sv (&v); } 360inline SV *to_sv (object & v) { return to_sv (&v); }
359inline SV *to_sv (living & v) { return to_sv (&v); } 361inline SV *to_sv (living & v) { return to_sv (&v); }
360 362
361//inline SV *to_sv (faceinfo * v) { return to_sv (v->name); }
362inline SV *to_sv (treasurelist * v) { return to_sv (v->name); }
363inline SV *to_sv (std::string & v) { return newSVpvn (v.data (), v.size ()); } 363inline SV *to_sv (const std::string & v) { return newSVpvn (v.data (), v.size ()); }
364inline SV *to_sv (const treasurelist *v) { return to_sv (v->name); }
364 365
365inline SV *to_sv (UUID v) 366inline SV *to_sv (UUID v)
366{ 367{
367 char buf[128]; 368 char buf[128];
368 snprintf (buf, 128, "<1.%" PRIx64 ">", v.seq); 369 snprintf (buf, 128, "<1.%" PRIx64 ">", v.seq);
2008 sfree (THIS->regions, THIS->size ()); 2009 sfree (THIS->regions, THIS->size ());
2009 free (THIS->regionmap); 2010 free (THIS->regionmap);
2010 2011
2011 THIS->regions = regions; 2012 THIS->regions = regions;
2012 THIS->regionmap = regionmap; 2013 THIS->regionmap = regionmap;
2014}
2015
2016void
2017maptile::create_region_treasure ()
2018 CODE:
2019{
2020 object *op = object::create ();
2021 op->type = FLOOR;
2022 op->map = THIS;
2023
2024 for (int x = 0; x < THIS->width; ++x)
2025 for (int y = 0; y < THIS->height; ++y)
2026 {
2027 region *rgn = THIS->region (x, y);
2028
2029 //fprintf (stderr, "%d,%d %f %p\n", x, y, rgn->treasure_density,rgn->treasure);//D
2030 if (rgn->treasure && rndm () < rgn->treasure_density)
2031 {
2032 op->x = x;
2033 op->y = y;
2034 create_treasure (rgn->treasure, op, GT_ENVIRONMENT, THIS->difficulty);
2035 }
2036 }
2037
2038 op->destroy ();
2013} 2039}
2014 2040
2015void play_sound_map (maptile *map, int x, int y, int sound_num) 2041void play_sound_map (maptile *map, int x, int y, int sound_num)
2016 2042
2017int out_of_map (maptile *map, int x, int y) 2043int out_of_map (maptile *map, int x, int y)
2241 RETVAL = 0; 2267 RETVAL = 0;
2242 while (rgn = rgn->parent) 2268 while (rgn = rgn->parent)
2243 RETVAL++; 2269 RETVAL++;
2244 OUTPUT: RETVAL 2270 OUTPUT: RETVAL
2245 2271
2246INCLUDE: $PERL $srcdir/genacc region ../include/map.h | 2272INCLUDE: $PERL $srcdir/genacc region ../include/region.h |
2247 2273
2248MODULE = cf PACKAGE = cf::living 2274MODULE = cf PACKAGE = cf::living
2249 2275
2250INCLUDE: $PERL $srcdir/genacc living ../include/living.h | 2276INCLUDE: $PERL $srcdir/genacc living ../include/living.h |
2251 2277

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines