Cornerstone item vanishes
Describe Item dropped on Cornerstone vanishes.
To Reproduce Steps to reproduce the behavior:
- Go to Crypt level 1
- Locate the Cornerstone of the World
- Select
Save Gamefrom the in-game menu - Select
Load Gamefrom the in-game menu (to reproduce the issue, you must load your game from the game menu rather than the main menu) - Drop an item on the Cornerstone that you don't want to keep
- Cast Town Portal and go to town
- Reenter the Town Portal to return to the Cornerstone
- The item has vanished
Expected behavior One copy of an item dropped on the Cornerstone should be shared with all Single Player Hellfire characters.
Additional context
The cause seems to be due to the order of operations in gamemenu_load_game().
https://github.com/diasurgical/devilutionX/blob/ca93d852d2f22eb82a04014d0c63e4c5373f8906/Source/gamemenu.cpp#L307-L309
In the snippet above, LoadGame() leads to dungeon generation. If the game was saved on Crypt level 1, at some point this will call CornerstoneLoad() which activates the Cornerstone. However, two lines later in gamemenu_load_game(), the Cornerstone is unconditionally deactivated, rendering the tile inert. If an item is dropped on the tile at this point, it will be captured as part of the game's state instead of saving it as the Cornerstone item. If you then leave Crypt level 1 and come back, it will rerun dungeon generation logic, activate the Cornerstone, and overwrite game state for that tile, causing the item to vanish.
I've confirmed that this same issue exists in vanilla Hellfire. I've also confirmed that a similar process can be used to very easily dupe items, however I'd like to leave that one as an exercise for the reader.
Given that the cornerstone is rendered obsolete by the stash, do you think we should disable its functionality entirely, and leave it as a decorative piece?
seems a bit sad