… | |
… | |
2546 | for (int x = 0; x < THIS->width; ++x) |
2546 | for (int x = 0; x < THIS->width; ++x) |
2547 | for (int y = 0; y < THIS->height; ++y) |
2547 | for (int y = 0; y < THIS->height; ++y) |
2548 | { |
2548 | { |
2549 | for (object *op = THIS->at (x, y).bot; op; op = op->above) |
2549 | for (object *op = THIS->at (x, y).bot; op; op = op->above) |
2550 | if (op->flag [FLAG_IS_FLOOR]) |
2550 | if (op->flag [FLAG_IS_FLOOR]) |
2551 | goto skip_space; |
2551 | goto skip; |
2552 | |
2552 | |
2553 | { |
2553 | { |
2554 | int offs = offset + y * stride + x; |
2554 | int offs = offset + y * stride + x; |
|
|
2555 | |
2555 | if (IN_RANGE_EXC (offs, 0, idxlen)) |
2556 | if (IN_RANGE_EXC (offs, 0, idxlen)) |
2556 | { |
2557 | { |
2557 | if (SV **elem = av_fetch ((AV *)palette, idx [offs], 0)) |
2558 | if (SV **elem = av_fetch ((AV *)palette, idx [offs], 0)) |
2558 | { |
2559 | { |
2559 | object *ob = get_archetype (SvPVutf8_nolen (*elem)); |
2560 | object *ob = get_archetype (SvPVutf8_nolen (*elem)); |
2560 | ob->flag [FLAG_NO_MAP_SAVE] = true; |
2561 | ob->flag [FLAG_NO_MAP_SAVE] = true; |
2561 | THIS->insert (ob, x, y, 0, INS_ABOVE_FLOOR_ONLY); |
2562 | THIS->insert (ob, x, y, 0, INS_ABOVE_FLOOR_ONLY); |
2562 | |
2563 | |
2563 | if (ob->randomitems) |
2564 | if (ob->randomitems && !ob->above) |
2564 | { |
2565 | { |
2565 | if (!ob->above) |
|
|
2566 | { |
|
|
2567 | ob->create_treasure (ob->randomitems); |
2566 | ob->create_treasure (ob->randomitems); |
2568 | |
2567 | |
2569 | for (object *op = ob->above; op; op = op->above) |
2568 | for (object *op = ob->above; op; op = op->above) |
2570 | op->flag [FLAG_NO_MAP_SAVE] = true; |
2569 | op->flag [FLAG_NO_MAP_SAVE] = true; |
2571 | } |
2570 | // TODO: if this is a pickable object, then the item |
2572 | |
2571 | // will at a bit weird - saving inside the player |
2573 | ob->randomitems = 0; |
2572 | // will clear the flag, but when the player drops |
|
|
2573 | // it without logging out, it keeps the flag. |
|
|
2574 | // nobody ahs reported this, but this can be rather |
|
|
2575 | // annoying on persistent maps. |
2574 | } |
2576 | } |
2575 | } |
2577 | } |
2576 | } |
2578 | } |
2577 | } |
2579 | } |
2578 | |
2580 | |
2579 | skip_space: ; |
2581 | skip: ; |
2580 | } |
2582 | } |
2581 | } |
2583 | } |
2582 | |
2584 | |
2583 | void |
2585 | void |
2584 | maptile::set_regiondata (SV *data, int offset, int stride, SV *palette) |
2586 | maptile::set_regiondata (SV *data, int offset, int stride, SV *palette) |