Prevent crash of replay started from start-of-scenario save
Start-of-scenario saves in 1.11 do not contain the [replay_start] tag any more because its contents are identical to the starting situation. As a result, the tag needs to be created during the start-up sequence of a scenario. Whether this is necessary was previously decided by checking whether the scenario snapshot was empty. This works when the scenario is started by finishing the previous scenario. However, when the start-of-scenario savegame is loaded, the snapshot is not empty. Thus, we need to check whether the snapshot is empty OR whether the turn number in it is less than 1.
This commit is contained in:
parent
389a155e12
commit
ef0ffef5b0
1 changed files with 1 additions and 1 deletions
|
@ -399,7 +399,7 @@ LEVEL_RESULT playsingle_controller::play_scenario(
|
|||
}
|
||||
|
||||
//before first turn, save a snapshot as replay_start
|
||||
if(gamestate_.snapshot.empty()){
|
||||
if(gamestate_.snapshot.child_or_empty("variables")["turn_number"].to_int(-1)<1){
|
||||
gamestate_.replay_start() = to_config();
|
||||
gamestate_.write_snapshot(gamestate_.replay_start(), gui_.get());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue