… | |
… | |
699 | |
699 | |
700 | if (item->type == FLOOR || QUERY_FLAG (item, FLAG_IS_FLOOR)) |
700 | if (item->type == FLOOR || QUERY_FLAG (item, FLAG_IS_FLOOR)) |
701 | item = item->above; |
701 | item = item->above; |
702 | |
702 | |
703 | if (!item) |
703 | if (!item) |
704 | { |
|
|
705 | new_draw_info (NDI_UNIQUE, 0, pl, "Nothing to remove."); |
704 | new_draw_info (NDI_UNIQUE, 0, pl, "Nothing to remove."); |
706 | return; |
705 | else if (item->type == BUILDABLE_WALL) |
707 | } |
|
|
708 | |
|
|
709 | /* Now remove object, with special cases (buttons & such) */ |
|
|
710 | switch (item->type) |
|
|
711 | { |
|
|
712 | case BUILDABLE_WALL: |
|
|
713 | new_draw_info (NDI_UNIQUE, 0, pl, "Can't remove a wall with that, build a floor."); |
706 | new_draw_info (NDI_UNIQUE, 0, pl, "Can't remove a wall with that, build a floor."); |
714 | return; |
707 | else if (!item->flag [FLAG_IS_BUILDABLE]) |
715 | |
|
|
716 | case DOOR: |
|
|
717 | case BUTTON: |
|
|
718 | case GATE: |
|
|
719 | case TIMED_GATE: |
|
|
720 | case DETECTOR: |
|
|
721 | case PEDESTAL: |
|
|
722 | case CF_HANDLE: |
|
|
723 | case MAGIC_EAR: |
|
|
724 | case SIGN: |
|
|
725 | /* Special case: must unconnect */ |
|
|
726 | if (QUERY_FLAG (item, FLAG_IS_LINKED)) |
|
|
727 | remove_button_link (item); |
|
|
728 | |
|
|
729 | /* Fall through */ |
|
|
730 | |
|
|
731 | default: |
|
|
732 | /* Remove generic item */ |
|
|
733 | if (!QUERY_FLAG (item, FLAG_IS_BUILDABLE)) |
|
|
734 | { |
|
|
735 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You can't remove the %s, it's not buildable!", query_name (item)); |
708 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You can't remove the %s, it's not buildable!", query_name (item)); |
736 | return; |
709 | else |
737 | } |
710 | { |
738 | |
|
|
739 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You remove the %s", query_name (item)); |
711 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You remove the %s", query_name (item)); |
740 | item->destroy (); |
712 | item->destroy (); |
741 | } |
713 | } |
742 | } |
714 | } |
743 | |
715 | |
744 | /** |
716 | /** |
745 | * Global building function |
717 | * Global building function |