Friday, January 27, 2006

Friday 27th

Brute force urged me to make progress today, so after preparing Non-Disclosure Agreements for my team of Beta Testers, I ploughed ahead with the INI routines and completed the save portion of the routine. This took a while to debug, and on closer investigation it appeared that the file wasn't being touched by the Editor at all.

This led me to realise that some of my string values weren't enclosed in quotes, causing the routine to find a null value and exit; a few little tweaks later, everything was working perfectly. I finished up by adding the save function call at each of the three program exit points (clicking close, choosing Quit, or tapping Esc). I may choose to add a "Save Preferences" option later, but for now the system is complete.

The final task of the night was the Tile Duplicate system; I'd written the bare bones of this with some help from my chum Muttley, but for some reason the routine failed to work properly. Additionally, I'd also had issues with how the data is presented to the user (and over my dead body would I dump the data to an external TXT file).

A couple of days ago I hit upon the idea of using a similar system to that of my Unused Tiles system; basically, if a tile is being used in the current map, it is overlaid with a tick (and if not, overlaid with a cross). This system could also work for duplicates - click on a Tile, and any duplicates are overlaid with a tick.

After setting up the core variables and logic for this, I could then use it to debug the checking routine - after all, I would know what the duplicate tiles were and thus, be able to see precisely when the routine failed to work.

I finally managed to track down the source of the problem mere minutes before going to bed (I usually load my brain with code before I got to sleep in the hope that my subconscious will solve them overnight). The problem stemmed from the way the buffers were being set up and locked for pixel-reading operations. After a bit of tinkering, the routine is now slightly slower at checking, but works 100%. Result :)