… | |
… | |
785 | * object.c ? |
785 | * object.c ? |
786 | */ |
786 | */ |
787 | void |
787 | void |
788 | object::destroy_inv (bool drop_to_ground) |
788 | object::destroy_inv (bool drop_to_ground) |
789 | { |
789 | { |
|
|
790 | // need to check first, because the checks below might segfault |
|
|
791 | // as we might be on an invalid mapspace and crossfire code |
|
|
792 | // is too buggy to ensure that the inventory is empty. |
|
|
793 | // corollary: if you create arrows etc. with stuff in tis inventory, |
|
|
794 | // cf will crash below with off-map x and y |
|
|
795 | if (!inv) |
|
|
796 | return; |
|
|
797 | |
790 | /* Only if the space blocks everything do we not process - |
798 | /* Only if the space blocks everything do we not process - |
791 | * if some form of movement is allowed, let objects |
799 | * if some form of movement is allowed, let objects |
792 | * drop on that space. |
800 | * drop on that space. |
793 | */ |
801 | */ |
794 | if (!drop_to_ground |
802 | if (!drop_to_ground |
795 | || !map |
803 | || !map |
796 | || map->in_memory != MAP_IN_MEMORY |
804 | || map->in_memory != MAP_IN_MEMORY |
797 | || map->at (x, y).move_block == MOVE_ALL) |
805 | || ms ().move_block == MOVE_ALL) |
798 | { |
806 | { |
799 | while (inv) |
807 | while (inv) |
800 | { |
808 | { |
801 | inv->destroy_inv (drop_to_ground); |
809 | inv->destroy_inv (drop_to_ground); |
802 | inv->destroy (); |
810 | inv->destroy (); |