Result screen not shown in loaded game when a player was already defeated in saved game.

Bug #1302593 reported by wl-zocker
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Medium
Unassigned

Bug Description

Steps to reproduce:
1) Start a game with the win condition autocrat and (at least) two other players.
2) Save the game, but continue playing.
3) Defeat one of the other players.
4) Save the game, but continue playing.
5) Defeat the last player. You will get a congratulation message and the result screen is shown.
6) Load the savegame from step 4 and defeat the last player. You get the congratulation message, but no result screen.
7) Load the savegame from step 2 and defeat both players. The result screen will be shown.

Conclusion:
Saving and loading the game works only fine before any of the players has been defeated. When some players have been defeated and the game is loaded, then the remaining players are defeated, the result screen is not shown.

Tags: lua savegame

Related branches

Revision history for this message
wl-zocker (wl-zocker) wrote :

I attach the savegame from step 2 for easier repoduction. You just have to attack - the computerplayer has very few soldiers.

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Thanks for reporting this issue (and attaching the example save game)

This is fully reproducible in r6914. We have had some similar issues reported earlier, where a save game had forgotten the progress related to the win condition, but I don't remember the bug number.

Changed in widelands:
importance: Undecided → Medium
milestone: none → build19-rc1
status: New → Confirmed
tags: added: lua savegame
Revision history for this message
SirVer (sirver) wrote :

@hjd: adding the revisions at which the issues are reproducible is SUPER helpful! Thanks for that.

This makes me super nervous. I am investigating right now.

Revision history for this message
SirVer (sirver) wrote :

So some kind of relief here: The Lua persistence seems to be working correct and okay. This is what happens: 01_defeat_all.lua starts out with a list of all players and removes them one by one as they are marked as being defeated. As soon as all players/fractions are accounted for, it calls wl.game.report_result.

This will call PlayerManager::add_player_end_status() which will show the result screen as soon as it has results for all players. However, these are not persisted into the savegame - i.e. when you defeat one enemy it will be marked as being defeated. When you reload the game after saving, it will no longer be marked as defeated. But since the lua table no longer contains the player (since it got removed the first time it was reported) it will not get reported again -> you will never see the results screen.

I personally think it would be better to keep the state entirely in Lua and only report the results of the game once (at the end of the game). Other solution would be to save the state of the Players Manager to disk.

Charly, I assign you since you made this feature. Maybe you want to look into this bug too?

Changed in widelands:
assignee: nobody → cghislai (charlyghislain)
summary: - Result screen for autocrat not shown when the game has been loaded
+ Result screen not shown in loaded game when a player was already
+ defeated in saved game.
Revision history for this message
SirVer (sirver) wrote :

Setting to incomplete for bug sweeping.

Changed in widelands:
status: Confirmed → Incomplete
GunChleoc (gunchleoc)
Changed in widelands:
status: Incomplete → In Progress
assignee: cghislai (charlyghislain) → GunChleoc (gunchleoc)
GunChleoc (gunchleoc)
Changed in widelands:
status: In Progress → Fix Committed
assignee: GunChleoc (gunchleoc) → nobody
GunChleoc (gunchleoc)
Changed in widelands:
status: Fix Committed → Fix Released
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build19-rc1.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.