fix inifinite loops
Store the result of p->inv.active_items() for iteration on it.

Otherwise the code would call end on different sets each time.
Also use item::tname(), instead of item::name.
Merge branch 'bugfix' of https://github.com/BevapDin/Cataclysm-DDA into merger
Merge branch 'bugfix2' of https://github.com/BevapDin/Cataclysm-DDA into merger