Item Fixes, AI Looting, and Mouse Upgrade
After reading about a few stubborn item bugs today, I decided to put the editor overhaul on the back burner for a day or so. I feel weird working on new stuff when the old stuff doesn't work correctly :)
Item Degrading Bug
The first bug had to do with items degrading. The most common case was clean rags degrading into dirty rags. It turns out last week's fixes didn't cover the case when a stacked item degraded, especially if the degrading item was deep inside a stack, instead of on the top.
The symptom is usually endless rags appearing on the ground if the player is carrying stacks of clean rags in low condition.
I was able to fix that, so it should start behaving in the next build.
Another change I worked on had to do with swapping items in the inventory screen. Normally, if a small item is hovering over a bigger item, it's possible to swap those two items. However, it's not possible to do the reverse: drop a big item and pick up the small item under it, even if the big item would've fit.
I wrote some code to handle that case, and it should be possible to swap items regardless of size, as long as the item being dragged fits in the space after the swap.
AI Looting Bug
Another fix involved the AI looting certain hex resources. AI was running off with whole lakes and woods in their hands, leaving the hexes empty.
I made some changes to stop that from happening.
This set of changes is a bit untested, so I left it for the bottom of the list. I don't want people to get too excited in case it doesn't work.
Basically, recent versions of Flash allow two new features for the mouse: hardware cursors, and right clicking. If the game is compiled in the right Flash version, and the plugin viewing the game is up-to-date, it's possible to do both of these things.
Hardware cursors just means that the OS handles the cursor updates, instead of Flash. The result should be smoother and faster cursor movement. So far, this appears to be working. Dragged items and button highlights are still a bit laggy (like before), but the cursor position is as fast as Windows/OSX/Linux cursors. Seems like an improvement!
And the other feature, right-clicking, is something folks have requested for a while now. This, too, seems to be working in my tests. I was able to get the top menu buttons to appear along side the mouse when right-clicking, and make them disappear when one is clicked (or the user clicks elsewhere on the screen).
So far, so good. Though, the top menu buttons may not be the right options for a right-click context menu. When the user right-clicks, they probably want the game to actually use the item, or delete it, not just change the cursor mode. On the other hand, clicking on "take" or "drag" is probably the user signifying that they want to change modes.
So I'll have to try out a few different solutions, to see what works. It'll probably evolve over time, too, as users try it out.
Hopefully, I can get this working tomorrow, and give you guys a chance to try it for yourselves. Wish me luck!