#4215: Loading savegames loses upgrade effects
-------------------------------------+-------------------------
        Reporter:  Althalus          |      Owner:
            Type:  bug               |     Status:  new
        Priority:  normal            |  Milestone:  unspecified
       Component:  Savegames         |    Version:  git/master
Operating System:  All/Non-Specific  |
-------------------------------------+-------------------------
\
\
 This bug is related to both #4178 and #4020, and I suspect they have the
 same causes.

 The observable bug is that whenever I load a savegame in skirmish mode,
 all the upgradable stats (hitpoints, armor, damage, research points, ...)
 are reset to the base values.
 I haven't tried with campaign saves, but #4178  is about campaign, so I
 think the bug could trigger too.

 I have tracked down the possible causes, and I found that the actual
 application of the upgrades is done via javascript (mainly the
 {{{eventResearched}}} function in rules.js), but the code that initializes
 the relevant data structures, which I believe is mainly the function
 {{{registerFunctions}}} in qtscriptfuncs.cpp, is called after the events
 have been processed.

 The nearest common caller of these functions is {{{levLoadData}}} in
 levels.cpp, with the research events being triggered by {{{loadGame}}} at
 line 887, while initialization of the scripts is done by
 {{{loadMultiScripts}}} at line 1004.

 I have tried to put the call to {{{loadMultiScripts}}} earlier, but
 putting it around line 852 leads to a crash, and putting it around line
 885 leads to a game playable, with upgrades as they should be, but I get a
 number of assertion failures so I suspect this is not a good solution
 either.

 As a reference, I am attaching a late-game save, where it is obvious
 whether upgrades are applied or not (factory has 1000 hp without upgrades,
 3700 with, for example).
\
\
\

--
Ticket URL: <http://developer.wz2100.net/ticket/4215>
Warzone 2100 Trac <http://developer.wz2100.net/>
The Warzone 2100 Project
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Warzone2100-project mailing list
Warzone2100-project@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/warzone2100-project

Reply via email to