MegaGlest / megaglest-source

MegaGlest real-time strategy game engine (cross-platform, 3-d)
http://megaglest.org/
348 stars 89 forks source link

upgrade states not saved if upgrade is in progress #155

Closed andy5995 closed 2 years ago

andy5995 commented 7 years ago

I noticed this while playing the Amazones scenario on git.

To reproduce:

  1. From the blacksmith, when sharpen points is at 2% (or 5 or 10, etc), save the game.
  2. now exit
  3. Load the saved game. You'll see the upgrade went back to 0%.
andy5995 commented 7 years ago

Te test this further, I started the scenario Egypt Mayhem.

I started the uprades: research scarab, speed-up priest production, and sharpen edges.

I saved the game while all 3 were in progress. When I re-loaded, all 3 upgrades had reset to 0%

Rampoina commented 2 years ago

Ok first of all it's not only upgrades, it's the progress for any unit (including buildings): The progress for a unit being built doesn't get saved either for example.

The issue is that when loading the game the setCurrSkill function overrides the previously restored progress2 variable. This happens here I've worked around it in #244 but I'm not sure why that line is there in the first place (why is it set to 0).