calref / cboe

Classic Blades of Exile
http://spiderwebforums.ipbhost.com/index.php?/forum/12-blades-of-exile/
Other
167 stars 41 forks source link

Items are wiped when loading a save file. #324

Closed NQNStudios closed 1 year ago

NQNStudios commented 1 year ago

On Linux, when I create a new party in-game, save, close the game, open it and load the party, they won't have any items.

The same goes for opening any party in the character editor.

CelticMinstrel commented 1 year ago

This bug is quite mystifying. As far as I can tell, it goes wrong right here:

https://github.com/calref/cboe/blob/f083965e80ef7e6ba76ca8ef966d1b3396ac00af/src/fileio/fileio_party.cpp#L271

But how it can possibly go wrong there, I've yet to figure out.

NQNStudios commented 1 year ago

I put a breakpoint on that line and the debugger didn't stop at it. Maybe that's not where it goes wrong?

NQNStudios commented 1 year ago

Ah the breakpoint worked when I put in on the corresponding line in the v2 function.

NQNStudios commented 1 year ago

More specifically, it goes wrong when the adventurers array is swapped, like we talked about on IRC: https://github.com/calref/cboe/blob/32f24b40d6da3d483f5d05f1212d0e1ae8223497/src/universe/party.cpp#L167

In my debugger when I open the party, I'm actually finding that a breakpoint on that line triggers TWICE. The first time, items are preserved. The second time, they get wiped. Are we expecting it to be called twice?

(Edit: I'm using this debugger Watch expression to monitor the items: univ.party.adven[0]->items[0])

CelticMinstrel commented 1 year ago

Fixed in #328.