CleverRaven/Cataclysm-DDA — pull request #8321 by BevapDin (2014-07-24 14:23:43+00:00)
Title: Another bunch of squashed bug

Case insensitive search for recipes

Matching uses `lcmatch` (in ui.cpp). This function is case insensitive, but requires the pattern to be lowercase. Search for crafting recipes is now case-insensitive (includes search for required components and tools). The same for search of items nearby, the advanced filtering (by category or material) was already case-insensitive.

Fixes #6921

----

Add sort by damage to advanced inventory and bug fix:

When sorting by name, a "cracked firefighter PBA mask" appears at the front near other items with names starting with c, but a (undamaged) "firefighter PBA mask" appears near items starting with f.

The code uses a `item::tname` to get the item name without damage prefix and compares that (prefix-free) name when sorting by name. The prefix-free name should be the same for damaged and undamaged items (of the same type), so they should be sorted near each other.

The function `item::tname` was recently changed to accept a quantity as first parameter, the coder in the adv. inv. used to call it as `name = it.tname(false)`. The value false works as int, so this did not trigger a compiler error, but all items are now compared with their full name (including the damage prefix), because the `false` is interpreted as quantity. The correct call should be `it.tname(1, false)` (or some other quantity).

This only applies to the sort name, not to the displayed name (which still uses the prefix). Items with the same sort name (items of the same type) are still sorted by their actual name, the "cracked firefighter PBA mask" is still sorted before the "firefighter PBA mask", but there is no other item sorted between "cracked firefighter PBA mask" and "firefighter PBA mask".

----

Inventory screen:
I moved the check for the hotkey of ground items up before all other input evaluation.

The default key bindings for actions like UP/DOWN/LEFT/RIGHT contain the numbers on the numpad. Those actions are used in the inventory screen to move the cursor. If the item list contains items on the ground, those items have the numbers as hotkey. Before this: pressing '2' would trigger the DOWN action and move the cursor an item down, now pressing '2' triggers the selection of the item with the hotkey '2' (an item on the ground).