CleverRaven/Cataclysm-DDA — pull request #9180 by BevapDin (2014-09-22 09:27:17+00:00)
Title: Fix the advanced inventory.

Fix the advanced inventory.

Fixes #7586 - you can still have the dragged vehicle on one side and the same spot on the other side. I don't consider this a bug, as it is a valid scenario: start with a dragged vehicle to the south, select dragged vehicle in one pane, select location to the east in the other pane. Close the AIM, move the dragged vehicle so it is now to the east of your character. Open the AIM again. Now you have the content of the dragged vehicle on both panes.

However it's not possible to move items in this case. The AIM will complain that source and destination are the same. That bug is fixed. And note that both panes are actually different: one contains the content of the dragged vehicle, the other the content of the vehicle that is to the east - it just happens to be the same in some circumstances.

----

Fixes #8014

----

Fixes #7543

----

Fixes #7544 - category headers on each page

About the remaining part of that issue:
> So, under "Surrounding area" and "All 9 squares", maybe show "[; tools]". I'm adding in the category hotkey there, too, just 'cuz I like it.
>
> While we're at it, it might be nice to be able to jump to a category by hitting its hotkey. Pressing ";" should result in the top line being "[; tools]", followed by the first screen of tool items. (ya ya, that's really a separate request).

Categories have no hotkey (are you referring to the default/standard item symbol?) and categories can be dynamically, one can define new ones in the json data. This does not go well with the input manager, one needed separate entries for each category.

----

About #7097 and #2859:
It's currently fairly easy to get items *under* the car:
- kill a creature, it drops everything (items/corpse) onto the map.
- craft /disassemble something, it goes (if possible) into the vehicle, but if there is no cargo part or if it's full, it goes onto the map.
- examining some tile triggers the examine action which might drop stuff on the ground
- casings dropped while firing
- weapon dropped while picking up something and wielding it
- taking something off that has with no space in the inventory, the item goes onto the map
- if you search, you'll surely find more

> Also we could easily close that up by having dropped items that don't go
> into vehicle storage go to the nearest non-vehicle tile.

If the vehicle is fully closed (e.g. standard car, all doors closed) how should the item teleport to the outside? Is *that* realistic (as opposed to dropping them under the car). Imagine a big vehicle, e.g. 4 or more vehicle tiles in *every* direction, the item might teleport far away.

----

There were also two bugs in the uimenu:

1. The initial selection was not checked. This can be seen when the adv. inv. is open and one pane is set to show all. Moving an item to that pane opens a uimenu that prompts for the actual destination. The last chosen entry is pre-selected. If nothing has been selected previously, no entry in the menu is selected (selectin index == -1). Pressing enter in this state crashes the program as it accesses the currently selected entry in the list of entries (and the current selection index is invalid).

2. Doing the above but selecting an entry moves the item and stores the selected destination so it is the default the next time the menu appears. Now change the destination square to something that can not hold items (either move around, or use the map editor). Than open the adv. inv. again, move an item. The menu appears, the same destination as previously chosen is selected again, but that entry is actually disabled and one should not be able to select it.

----

I changed the default bindings for selecting the square to match the displayed numbers and the numbers on the number pad, e.g. 2 is south, 8 is north. They key bindings worked already that way, but where used from in the code: entering '2', triggered the action "ITEMS_N" (north!), but that action set the location to 2 (that's the index of the `advanced_inventory::squares`) and that means South, so it's correct.