HM3: Bug tweaks for layering

I just posted a minor update to HeroMachine3 that hopefully will fix some of the layering and "stuck item" problems people were having when loading up saved characters.

I'll explain the nitty gritty after the jump for those who are interested.

In the course of testing, I discovered two main problems. The first was that between the time some older characters were saved and today, the order and number of sets of items (sets are the second drop-down box in the main program, like Blades and Blunts) in various slots (slots are the first drop-down box, the main character areas like Nose, HandRight, Body, etc.) changed. For instance, initially Background only had one or two sets, but over time it grew to five. Along the way I rearranged the listing order of some of those sets. As a result, the character you saved last year might have used an item from Background-Standard when that set had an associated number of 1. But since then, Background-Floors was added and it is now entry number one on the list.

But your saved character still has Background Set number 1 listed as being "Standard", so when it loads up Background Set 1 it's actually getting Background Floors. Only it doesn't know that, so when you try to add another item from that set, it loads what it thinks is item 10 from Background Standard, but it actually gets item 10 from Background Floors. And the item gets stuck.

So, to get around that (and any future similar problems), I introduced some error catching that basically matches the NAME of the set (which at least so far doesn't change over time), and then from there gets whatever the latest number is. So even if I rearrange the order of all the sets and how they're listed, all the items should continue to load for your saved characters.

The second problem was that up until a few weeks ago, I still had two empty layers in the character layout shell for slots I thought about adding, but never did. Like a separate "Pet" slot in addition to "Companion". That caused some problems with layering so I removed the two vestigial layers from the main HeroMachine file. Well, it turns out that CAUSED problems for older save files, because they were trying to layer items onto a layer that no longer existed, in essence.

So I introduced more error checking that says basically, "Hey, if you try to put this on a layer that isn't there, then instead just move it down to the highest actual layer available."

As a result, hopefully this will clear up the problems some folks were having with layering and sticky objects in some older save files.