Tilemap Clean-Up, Padding/Timming

I spent today doing a lot of clean-up on the old tilemap code. As mentioned yesterday, the old code made a lot of assumptions about the tilemap data. Most notably, it didn't care about synchronizing additional tile data arrays such as those used for lighting and sockets.

So, I replaced the old code that manipulated tilemap sizes to be more friendly to this meta data. This meant rewriting the tilemap trimming and padding functions.

So far, I think the functions are roughly working. They basically strip out all the items, rebuild the tilemap to the requested new size, erase the old sockets and lighting data, and then re-add the items in their new positions to populate socket and lighting data. The delete, move, and re-add process was simpler to do (and more reliable) than trying to manually update all the item metadata while they were still installed on the tilemap.

The one issue I'm running into, however, is the trimming/padding calculations. I have some offsets and rounding errors which are causing items to be placed in the wrong places, so tomorrow, I'll have to fix that.

I feel better about where I'm leaving off today, as the code is a bit cleaner than the old mess. But little to show for the work. So far, anyway. Until tomorrow!