CleverRaven/Cataclysm-DDA — pull request #5539 by BevapDin (2014-01-13 23:02:34+00:00)
Title: Fix closing non-closeable things

Seems the code did not check if the door was actually closed, so the items would be pushed out of the way - onto the very same till. That would normally (assuming closed doors have the "NOITEM" flag) move the item to an adjacent tile. But if one closes a pavement (which does not actually do anything, the pavement remains there), the tile does not have the "NOITEM" flag even after "closing" the non-existent door. That would mess up the item-vector, and can cause a crash.

The PR checks that there is something to be closed (with `map::close_door`, the last parameter means check-only). It prints a message if there is nothing to be closed.

Finally it only moves the items away from the door tile if the door has been closed and if the (closed) door tile has the "NOITEM" flag. Without this flag items remain there.

Note: some "door" tiles (fence door, chain link gate) don't have the "NOITEM" flag, and closing them with items on it would trigger the same bug.

fixes #5538, related to #5504