Bugs and Taxes
Hey Folks! Had a pretty good continuation of yesterday's bug-fixing. Plus, taxes!
The taxes were sort of old news, as I've already done them and was just waiting for a PIN from the IRS. And true to the IRS's style of late, it came way sooner than they promised. They are one government organization that sends things out fast! Now if only we could simplify some of those forms... :)
The bug fixes today involved newspapers, deleting items, and hacking.
Newspapers were sometimes appearing with multiple headlines extending beyond the screen. And I had a hunch that it was mucking with the template newspaper for each new headline, appending text each time. Sure enough, the place where the newspapers are conjured was providing the original copy of the template instead of a copy, so every new paper had the previous papers' headlines before its own. A pretty easy fix.
The deleting items was a bit trickier, and I only stumbled upon it while trying to fix hacking.
Basically, I was getting a huge amount of laptops and their contents being leaked when testing hacking. And after some probing, it turns out that destroying an item in-game (such as with the context menu) doesn't destroy the object in memory. It just removes it from the ground, letting it float away into RAM. So I added some code to explicitly destroy items deleted this way, but ran into more issues.
As it would happen, there is more than one way to delete an item in-game. The context menu is one way, but so is the destroy cursor. And for that matter, the mobile and desktop code for this are in two separate places. So, after fixing all three locations, I think I have that wrapped-up.
Finally, hacking. This one turned out a bit trickier to solve. Encounters would clear items from the previous screen before awarding new items. But, in the case of hacking, it still needed a reference to the previous screen's item in order to change that item's mode to the new hacked item. I ended up having to split the code between that which removes it from the UI, and that which destroys it in memory. It does the former midway through updating the encounter, and the latter at the end.
I finally seem to have that working, and it fixes the hacking bug. But one issue remains: there is one leaked laptop in memory, and a lot of electric charges and data files. It could be stuff orphaned in the encounter, or temporary encounter items, or...something else? Anyway, I need to look into that tomorrow. Not a bad day, though!