Tax Stuff and Mouse Events

A good chunk of the day was consumed by tax stuff today. I had to run into town to visit the bank and do some paperwork, and while that's never fun, it's unavoidable. The good news is that I think I'm in good hands for this tax year, with a good advisor/accountant. I'm going to need it, what with NEO Scavenger's launch causing increased GST scrutiny.

Back at the office, I decided to look into one of the recently reported bugs in 1.03. It turns out that using the context menu to destroy an item, and then again to use another un-deletable item (like a forest) causes that item to disappear. It's had me confused and grasping at straws until I stumbled across the problem later today. Basically, the delete button is firing a second time when the context menu reappears during the "use" command.

I haven't been able to figure out a fix for it yet, but I'm learning more and more about the problem. It stems from the recent changes I made to enable touchscreens to use the context menu. Touchscreen OSes were having trouble due to the game not seeing the mouseUp event at the right time, so I added some extra code to force the button to see it.

Unfortunately, that seems to have broken the button's logic in cases where it disappears immediately after being pressed. This normally goes unnoticed by players, as most disappearing buttons are never seen again. However, the context menu buttons are recycled, so when the context menu opens up later for a "use" command, the hidden "destroy" button wakes up and still thinks it needs to fire. And since the "use" has changed the target to the new item, "delete"'s action hits the new target, removing the used item.

It's a bit of a mind-twist, thinking about it.

Anyway, I need to poke around a bit more and try some alternate approaches. I'm not certain how I can fix it yet, so there's a chance I'll have to revert the change and break touchscreens. Hopefully, I'll find a way, though.

That's all for today. Have a good night, all!


Rovlad's picture

As far as I understand the problem, the game currently relies on the fact that delete button shouldn't appear to the user at all when right-clicking on a "protected" object. Shouldn't it be sufficient to just add a "sanity check" in the actual low-level delete function to make sure the object doesn't get deleted if it has a "protected" property?

dcfedor's picture

I think that'd work. There are some legitimate reasons the code might delete those items, so I might have to find the right hierarchy for such a sanity-check.

However, I also want to see if I can resolve the double-event issue, as I'm worried other non-delete buttons may have similar "gotchas" to be solved, too.

Dan Fedor - Founder, Blue Bottle Games