Skip to content

Commit 83ab11c

Browse files
authored
Pause load bug fix, third time is the charm (dkfans#4834)
1 parent 1e03129 commit 83ab11c

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/game_saves.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "game_merge.h"
4343
#include "frontmenu_ingame_map.h"
4444
#include "gui_boxmenu.h"
45+
#include "net_exchange_gameplay.h"
4546
#include "packets.h"
4647
#include "keeperfx.hpp"
4748
#include "api.h"
@@ -408,8 +409,8 @@ TbBool load_game(long slot_num)
408409
LbFileClose(fh);
409410
snprintf(game.campaign_fname, sizeof(game.campaign_fname), "%s", campaign.fname);
410411
reinit_level_after_load();
412+
initialize_packet_history();
411413
clear_packets();
412-
game.skip_initial_input_turns = 0;
413414
process_pause_packet(0, 0);
414415
clear_flag(game.operation_flags, GOF_Paused);
415416
clear_flag(game.operation_flags, GOF_WorldInfluence);

src/net_input_lag.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ enum InputLagMode {
2727
TbBool input_lag_skips_initial_processing(void)
2828
{
2929
if ((game.system_flags & GSF_NetworkActive) == 0) {
30-
game.skip_initial_input_turns = 0;
3130
return false;
3231
}
3332
if ((game.operation_flags & GOF_Paused) != 0) {

src/packets.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,6 @@ void process_pause_packet(long curr_pause, long new_pause)
344344
set_flag_value(game.operation_flags, GOF_Paused, curr_pause);
345345
if ((game.operation_flags & GOF_Paused) != 0) {
346346
set_flag_value(game.operation_flags, GOF_WorldInfluence, new_pause);
347-
game.skip_initial_input_turns = 0;
348347
if ((game.system_flags & GSF_NetworkActive) != 0) {
349348
game.skip_initial_input_turns = game.input_lag_turns + 1;
350349
}
@@ -1633,15 +1632,16 @@ void process_packets(void)
16331632
return;
16341633
}
16351634
}
1636-
MULTIPLAYER_LOG("process_packets: Loading packets from packet history");
1637-
load_old_packets();
1638-
1639-
if (input_lag_skips_initial_processing())
1640-
{
1635+
if (input_lag_skips_initial_processing()) {
16411636
clear_packets();
16421637
return;
16431638
}
16441639

1640+
if ((game.system_flags & GSF_NetworkActive) != 0) {
1641+
MULTIPLAYER_LOG("process_packets: Loading packets from packet history");
1642+
load_old_packets();
1643+
}
1644+
16451645
if ((game.system_flags & GSF_NetworkActive) != 0 && checksums_different()) {
16461646
set_flag(game.system_flags, GSF_NetGameNoSync);
16471647
clear_flag(game.system_flags, GSF_NetSeedNoSync);

0 commit comments

Comments
 (0)