… | |
… | |
2008 | sfree (THIS->regions, THIS->size ()); |
2008 | sfree (THIS->regions, THIS->size ()); |
2009 | free (THIS->regionmap); |
2009 | free (THIS->regionmap); |
2010 | |
2010 | |
2011 | THIS->regions = regions; |
2011 | THIS->regions = regions; |
2012 | THIS->regionmap = regionmap; |
2012 | THIS->regionmap = regionmap; |
|
|
2013 | } |
|
|
2014 | |
|
|
2015 | void |
|
|
2016 | maptile::create_region_treasure () |
|
|
2017 | CODE: |
|
|
2018 | { |
|
|
2019 | object *op = object::create (); |
|
|
2020 | op->type = FLOOR; |
|
|
2021 | op->map = THIS; |
|
|
2022 | |
|
|
2023 | for (int x = 0; x < THIS->width; ++x) |
|
|
2024 | for (int y = 0; y < THIS->height; ++y) |
|
|
2025 | { |
|
|
2026 | region *rgn = THIS->region (x, y); |
|
|
2027 | |
|
|
2028 | //fprintf (stderr, "%d,%d %f %p\n", x, y, rgn->treasure_density,rgn->treasure);//D |
|
|
2029 | if (rgn->treasure && rndm () < rgn->treasure_density) |
|
|
2030 | { |
|
|
2031 | op->x = x; |
|
|
2032 | op->y = y; |
|
|
2033 | create_treasure (rgn->treasure, op, GT_ENVIRONMENT, THIS->difficulty); |
|
|
2034 | } |
|
|
2035 | } |
|
|
2036 | |
|
|
2037 | op->destroy (); |
2013 | } |
2038 | } |
2014 | |
2039 | |
2015 | void play_sound_map (maptile *map, int x, int y, int sound_num) |
2040 | void play_sound_map (maptile *map, int x, int y, int sound_num) |
2016 | |
2041 | |
2017 | int out_of_map (maptile *map, int x, int y) |
2042 | int out_of_map (maptile *map, int x, int y) |
… | |
… | |
2241 | RETVAL = 0; |
2266 | RETVAL = 0; |
2242 | while (rgn = rgn->parent) |
2267 | while (rgn = rgn->parent) |
2243 | RETVAL++; |
2268 | RETVAL++; |
2244 | OUTPUT: RETVAL |
2269 | OUTPUT: RETVAL |
2245 | |
2270 | |
2246 | INCLUDE: $PERL $srcdir/genacc region ../include/map.h | |
2271 | INCLUDE: $PERL $srcdir/genacc region ../include/region.h | |
2247 | |
2272 | |
2248 | MODULE = cf PACKAGE = cf::living |
2273 | MODULE = cf PACKAGE = cf::living |
2249 | |
2274 | |
2250 | INCLUDE: $PERL $srcdir/genacc living ../include/living.h | |
2275 | INCLUDE: $PERL $srcdir/genacc living ../include/living.h | |
2251 | |
2276 | |