Fixed possible crash in corpses involving layers

Buffer overrun was occurring when an item had a tile_layer larger than
25. This is the likely reason behind some crashes.

Moved valid_equip_layer() from Character to the namespace Items.

There were calls to PutItemOnLayer() which didn't check if the item had
a proper layer, so I've added asserts to make sure this won't happen
again.