… | |
… | |
2396 | |
2396 | |
2397 | void |
2397 | void |
2398 | maptile::create_region_treasure () |
2398 | maptile::create_region_treasure () |
2399 | CODE: |
2399 | CODE: |
2400 | { |
2400 | { |
2401 | object *op = object::create (); |
|
|
2402 | op->type = FLOOR; |
|
|
2403 | op->map = THIS; |
|
|
2404 | |
|
|
2405 | for (int x = 0; x < THIS->width; ++x) |
2401 | for (int x = 0; x < THIS->width; ++x) |
2406 | for (int y = 0; y < THIS->height; ++y) |
2402 | for (int y = 0; y < THIS->height; ++y) |
2407 | { |
2403 | { |
2408 | region *rgn = THIS->region (x, y); |
2404 | region *rgn = THIS->region (x, y); |
2409 | |
2405 | |
2410 | //fprintf (stderr, "%d,%d %f %p\n", x, y, rgn->treasure_density,rgn->treasure);//D |
2406 | //fprintf (stderr, "%d,%d %f %p\n", x, y, rgn->treasure_density,rgn->treasure);//D |
|
|
2407 | if (object *op = THIS->at (x, y).top) |
2411 | if (rgn->treasure && rndm () < rgn->treasure_density) |
2408 | if (rgn->treasure && rndm () < rgn->treasure_density) |
2412 | { |
|
|
2413 | op->x = x; |
|
|
2414 | op->y = y; |
|
|
2415 | create_treasure (rgn->treasure, op, GT_ENVIRONMENT, THIS->difficulty); |
2409 | create_treasure (rgn->treasure, op, GT_ENVIRONMENT, THIS->difficulty); |
2416 | } |
|
|
2417 | } |
2410 | } |
2418 | |
|
|
2419 | op->destroy (); |
|
|
2420 | } |
2411 | } |
2421 | |
2412 | |
2422 | int out_of_map (maptile *map, int x, int y) |
2413 | int out_of_map (maptile *map, int x, int y) |
2423 | |
2414 | |
2424 | void |
2415 | void |