CleverRaven/Cataclysm-DDA — pull request #7613 by BevapDin (2014-05-11 13:36:22+00:00)
Title: Fix inventory ui.cpp

There is a class now that handles the inventory display.
One can move through the inventory with up/down keys like before. TAB is used for category selection, like before.
But now it wraps around when you select the last or the first item and press down/up.
Also: worn items and the weapon can be selected with the arrow keys - one has to move the cursor (LEFT arrow key) to that column, than it works like with the main inventory.

The default key binding for this might have to be changed. My suggestions:
left/right arrow to switch columns (main inventory <-> worn/wielded)
'+' for marking the currently selected item.

That means worn items and the weapon don't require a hotkey anymore, as they can be accessed like the main inventory.

Internally both columns (items from main inventory and worn/wielded items) are represented as a vector of `itemstack_or_category` entries. `itemstack_or_category` contains a pointer to the item (for displaying name and such), a pointer to the category and the item position (in the new item position system: -1 = weapon, < -1 = worn, > -1 = main inventory). The item pointer can be NULL which represents a category header.

This allows for paging both columns, which enables users of small screens to wear and view more armor. Previously the armor column could not scroll. If the window was too small and the player had a lot of items (> 18) worn, some would be displayed outside of the screen.

Also all 3 inventory screens (multidrop, single item selection, and compare) use the same code with very minor specialization. That should make it easier to add/change it later.

It's a complete rewrite because the current code is simply not salvageable.