Datafiles Sorted, and Crafting Crash Part 2
Hey Folks! More bug fixing today, as I sort out the various datafile bugs and find yet another crafting crash!
The situation with datafiles, as it turned out, was pretty messed-up. The game was doing a few things incorrectly, resulting in really weird outcomes. One part was that it returned requests for a "random data file" with the same data file over and over. (Namely, the generic template used to make data files.)
Another bug overwrote the template each time a new datafile was loaded, so loading any additional datafile changed all existing ones in-game.
The result was the mess I described yesterday. Datafiles changing into other datafiles, missing datafiles, and all sorts of confusion. Fixing the code to make a clone before altering the template solved one part, and the other fix was adding code to randomly choose a datafile if requested (which, in turn, required calculating the number of possible datafiles upon the first request).
Fortunately, this seems to be limited to datafiles, even though headlines and recipe scraps use the same template/copy technique.
The second issue was a crash, involving crafting again. Ugh, crafting! (Shakes fist.)
I think the fix I added the other day to avoid crashes in non-empty containers was failing in some situations. While trying to repro a bug involving duplicated pills in a noise trap, I stumbled upon this crash. It appears the contents of a container were being removed improperly, and crashes if one of those were also being used in the same recipe. I changed this to remove the items more formally, and that seems to be working now.
Yes sir, lots of fun here on the Blue Bottle Games ranch :)