… | |
… | |
299 | return 0; |
299 | return 0; |
300 | else if (!compare_ob_value_lists (ob1, ob2)) |
300 | else if (!compare_ob_value_lists (ob1, ob2)) |
301 | return 0; |
301 | return 0; |
302 | } |
302 | } |
303 | |
303 | |
304 | //TODO: generate an event or call into perl for additional checks |
|
|
305 | if (ob1->self || ob2->self) |
304 | if (ob1->self || ob2->self) |
306 | { |
305 | { |
307 | ob1->optimise (); |
306 | ob1->optimise (); |
308 | ob2->optimise (); |
307 | ob2->optimise (); |
309 | |
308 | |
310 | if (ob1->self || ob2->self) |
309 | if (ob1->self || ob2->self) |
|
|
310 | if (!cfperl_can_merge (ob1, ob2)) |
311 | return 0; |
311 | return 0; |
312 | } |
312 | } |
313 | |
313 | |
314 | /* Everything passes, must be OK. */ |
314 | /* Everything passes, must be OK. */ |
315 | return 1; |
315 | return 1; |
316 | } |
316 | } |
… | |
… | |
959 | if (destroyed ()) |
959 | if (destroyed ()) |
960 | return; |
960 | return; |
961 | |
961 | |
962 | if (destroy_inventory) |
962 | if (destroy_inventory) |
963 | destroy_inv (false); |
963 | destroy_inv (false); |
|
|
964 | |
|
|
965 | play_sound (sound_die); |
964 | |
966 | |
965 | attachable::destroy (); |
967 | attachable::destroy (); |
966 | } |
968 | } |
967 | |
969 | |
968 | /* |
970 | /* |
… | |
… | |
1375 | */ |
1377 | */ |
1376 | if (last && last->below && last != floor) |
1378 | if (last && last->below && last != floor) |
1377 | top = last->below; |
1379 | top = last->below; |
1378 | } |
1380 | } |
1379 | } /* If objects on this space */ |
1381 | } /* If objects on this space */ |
1380 | |
|
|
1381 | if (flag & INS_MAP_LOAD) |
1382 | if (flag & INS_MAP_LOAD) |
1382 | top = ms.top; |
1383 | top = ms.top; |
1383 | |
1384 | |
1384 | if (flag & INS_ABOVE_FLOOR_ONLY) |
1385 | if (flag & INS_ABOVE_FLOOR_ONLY) |
1385 | top = floor; |
1386 | top = floor; |
… | |
… | |
2640 | } |
2641 | } |
2641 | |
2642 | |
2642 | const materialtype_t * |
2643 | const materialtype_t * |
2643 | object::dominant_material () const |
2644 | object::dominant_material () const |
2644 | { |
2645 | { |
2645 | if (materialtype_t *mat = name_to_material (materialname)) |
2646 | if (materialtype_t *mt = name_to_material (materialname)) |
2646 | return mat; |
2647 | return mt; |
2647 | |
2648 | |
2648 | // omfg this is slow, this has to be temporary :) |
|
|
2649 | shstr unknown ("unknown"); |
|
|
2650 | |
|
|
2651 | return name_to_material (unknown); |
2649 | return name_to_material (shstr_unknown); |
2652 | } |
2650 | } |
2653 | |
2651 | |
2654 | void |
2652 | void |
2655 | object::open_container (object *new_container) |
2653 | object::open_container (object *new_container) |
2656 | { |
2654 | { |
… | |
… | |
2700 | esrv_update_item (UPD_FLAGS, this, new_container); |
2698 | esrv_update_item (UPD_FLAGS, this, new_container); |
2701 | esrv_send_inventory (this, new_container); |
2699 | esrv_send_inventory (this, new_container); |
2702 | } |
2700 | } |
2703 | } |
2701 | } |
2704 | |
2702 | |
|
|
2703 | object * |
|
|
2704 | object::force_find (const shstr name) |
|
|
2705 | { |
|
|
2706 | /* cycle through his inventory to look for the MARK we want to |
|
|
2707 | * place |
|
|
2708 | */ |
|
|
2709 | for (object *tmp = inv; tmp; tmp = tmp->below) |
|
|
2710 | if (tmp->type == FORCE && tmp->slaying == name) |
|
|
2711 | return splay (tmp); |
2705 | |
2712 | |
|
|
2713 | return 0; |
|
|
2714 | } |
|
|
2715 | |
|
|
2716 | void |
|
|
2717 | object::force_add (const shstr name, int duration) |
|
|
2718 | { |
|
|
2719 | if (object *force = force_find (name)) |
|
|
2720 | force->destroy (); |
|
|
2721 | |
|
|
2722 | object *force = get_archetype (FORCE_NAME); |
|
|
2723 | |
|
|
2724 | force->slaying = name; |
|
|
2725 | force->stats.food = 1; |
|
|
2726 | force->speed_left = -1.f; |
|
|
2727 | |
|
|
2728 | force->set_speed (duration ? 1.f / duration : 0.f); |
|
|
2729 | force->flag [FLAG_IS_USED_UP] = true; |
|
|
2730 | force->flag [FLAG_APPLIED] = true; |
|
|
2731 | |
|
|
2732 | insert (force); |
|
|
2733 | } |
|
|
2734 | |