CleverRaven/Cataclysm-DDA — pull request #7975 by BevapDin (2014-06-15 13:55:25+00:00)
Title: Fix duplicated bionic hotkeys

When installing a new bionic, the hokey for it is derived from the hotkey of the previously installed bionic + 1. If the hotkey of the previously installed bionic has been changed it will not check for duplicates.

Example:

- install two bionics, first get hotkey 'a', second gets hotkey 'b' ('b'='a'+1).
- change the hotkey of the first bionic to 'b', this will swap the hotkey of the installed bionics, the second has no the hotkey 'a'.
- install another bionic. It will have the hotkey 'b', the same as the first bionic, because the previously installed bionic now has hotkey 'a', so the new gets the hotkey 'a'+1. So now there are two bionics with the same hotkey.

This PR fixes this and assigns the first unused hotkey instead.
I also added a debug message when installing a bionic that is already installed. This case should not happen as it is checked in bionics.cpp before actually adding the bionic. But it should never fail *silently*.

This uses the `inv_char` string that contains a list of all allowed hotkeys for inventory items. This string is also used in bionics.cpp when chaning the hotkey of a bionics to check if the new hotkey is allowed.

----

What to do if there is no free hotkey anymore?