… | |
… | |
2410 | return /*who->flag [FLAG_WIZ]|| */ |
2410 | return /*who->flag [FLAG_WIZ]|| */ |
2411 | (item->weight > 0 && !item->flag [FLAG_NO_PICK] && |
2411 | (item->weight > 0 && !item->flag [FLAG_NO_PICK] && |
2412 | !item->flag [FLAG_ALIVE] && !item->invisible && (who->is_player () || item->weight < who->weight / 3)); |
2412 | !item->flag [FLAG_ALIVE] && !item->invisible && (who->is_player () || item->weight < who->weight / 3)); |
2413 | } |
2413 | } |
2414 | |
2414 | |
|
|
2415 | //-GPL |
|
|
2416 | |
2415 | /* |
2417 | /* |
2416 | * create clone from object to another |
2418 | * create clone from object to another |
2417 | */ |
2419 | */ |
2418 | object * |
2420 | object * |
2419 | object::deep_clone () |
2421 | object::deep_clone () |
… | |
… | |
2631 | object::region () const |
2633 | object::region () const |
2632 | { |
2634 | { |
2633 | return map ? map->region (x, y) |
2635 | return map ? map->region (x, y) |
2634 | : region::default_region (); |
2636 | : region::default_region (); |
2635 | } |
2637 | } |
|
|
2638 | |
|
|
2639 | //+GPL |
2636 | |
2640 | |
2637 | void |
2641 | void |
2638 | object::open_container (object *new_container) |
2642 | object::open_container (object *new_container) |
2639 | { |
2643 | { |
2640 | if (container == new_container) |
2644 | if (container == new_container) |
… | |
… | |
2698 | } |
2702 | } |
2699 | // else if (!old_container->env && contr && contr->ns) |
2703 | // else if (!old_container->env && contr && contr->ns) |
2700 | // contr->ns->floorbox_reset (); |
2704 | // contr->ns->floorbox_reset (); |
2701 | } |
2705 | } |
2702 | |
2706 | |
|
|
2707 | //-GPL |
|
|
2708 | |
|
|
2709 | // prefetch some flat area around the player |
|
|
2710 | static void |
|
|
2711 | prefetch_surrounding_area (object *op, maptile *map, int range) |
|
|
2712 | { |
|
|
2713 | for (maprect *rect = map->split_to_tiles (mapwalk_buf, |
|
|
2714 | op->x - range , op->y - range , |
|
|
2715 | op->x + range + 1, op->y + range + 1); |
|
|
2716 | rect->m; |
|
|
2717 | ++rect) |
|
|
2718 | { |
|
|
2719 | rect->m->touch (); |
|
|
2720 | rect->m->activate (); |
|
|
2721 | } |
|
|
2722 | } |
|
|
2723 | |
|
|
2724 | // prefetch a generous area around the player, also up and down |
|
|
2725 | void |
|
|
2726 | object::prefetch_surrounding_maps () |
|
|
2727 | { |
|
|
2728 | prefetch_surrounding_area (this, map, 40); |
|
|
2729 | |
|
|
2730 | if (maptile *m = map->tile_available (TILE_DOWN)) |
|
|
2731 | prefetch_surrounding_area (this, m, 20); |
|
|
2732 | |
|
|
2733 | if (maptile *m = map->tile_available (TILE_UP)) |
|
|
2734 | prefetch_surrounding_area (this, m, 20); |
|
|
2735 | } |
|
|
2736 | |
|
|
2737 | //+GPL |
|
|
2738 | |
2703 | object * |
2739 | object * |
2704 | object::force_find (shstr_tmp name) |
2740 | object::force_find (shstr_tmp name) |
2705 | { |
2741 | { |
2706 | /* cycle through his inventory to look for the MARK we want to |
2742 | /* cycle through his inventory to look for the MARK we want to |
2707 | * place |
2743 | * place |
… | |
… | |
2711 | return splay (tmp); |
2747 | return splay (tmp); |
2712 | |
2748 | |
2713 | return 0; |
2749 | return 0; |
2714 | } |
2750 | } |
2715 | |
2751 | |
2716 | //-GPL |
|
|
2717 | |
|
|
2718 | void |
2752 | void |
2719 | object::force_set_timer (int duration) |
2753 | object::force_set_timer (int duration) |
2720 | { |
2754 | { |
2721 | this->duration = 1; |
2755 | this->duration = 1; |
2722 | this->speed_left = -1.f; |
2756 | this->speed_left = -1.f; |