dungeons-of-moria / umoria

Moria: a roguelike Dungeon Crawler game | Umoria Source Code
https://umoria.org
GNU General Public License v3.0
342 stars 71 forks source link

List of Inventory Items Blank After Dropping Item #50

Open jhirschberg70 opened 3 years ago

jhirschberg70 commented 3 years ago

I am playing version 5.7.15 on Ubuntu 20.04.2 LTS using the Umoria keyboard layout.

To recreate the issue, display the character's inventory with the "i" command. Then use the "d" command to drop an item (it doesn't matter which item). Since this consumes a turn, the monsters will update after dropping the item. If the update causes screen_has_changed to be set to true, then the game attempts to display the character's remaining inventory, but the list of items is blank. I have attached a screenshot to show the incorrect behavior. I've also attached a save file that should make it easy to expose the bug. Simply load the file and follow the steps above.

While having a blank list of inventory items is incorrect, I believe the real bug may be that the game shouldn't attempt to display the remaining items at all. Instead, I believe the game should be querying the player to continue with the inventory command. This is what happens if the player wields an item from the inventory screen ("i" followed by "w" followed by selecting an item) and screen_has_changed is set to true.

I believe that this issue can be fixed by removing all references the variable recoverScreen in ui_inventory.cpp. I've attached a corresponding update to ui_inventory.cpp.

Moria Inventory Bug

game.sav.zip

ui_inventory.cpp.zip

mrcook commented 1 year ago

Hi Jeff,

That could very well be the fix, however, the original 5.6 code was performing a command check:

if (command == ' ' || !get_check("Continuing with inventory command?"))

I think I'd be more comfortable keeping that check -- but obviously my refactor was not good -- so I'll leave this issue open and take another look at this code at some point.

Cheers!

jhirschberg70 commented 1 year ago

Thanks for looking at this Michael. Boy, do I feel foolish. I could swear that my proposed fix worked if the player decides to not continue with the inventory command, but it clearly doesn't. Sorry for not testing this better.

Cheers,

Jeff