From e01bbbe4ede7181a4b9d7143dcb2638d70f0ace2 Mon Sep 17 00:00:00 2001 From: skyleo Date: Fri, 26 Jan 2024 22:43:23 +0100 Subject: [PATCH] Fix clif->pLoadEndAck being called in pc->scdata_received before receiving client's loadendack --- src/map/clif.c | 1 + src/map/pc.c | 4 ++-- src/map/pc.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/map/clif.c b/src/map/clif.c index 7e6081f23f0..7cbf70b736b 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -11163,6 +11163,7 @@ static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) } if (sd->state.scloaded == 0) { // SC data was not received yet. pc->scdata_received will reinvoke + sd->state.loadendack_before_scloaded = 1; return; } diff --git a/src/map/pc.c b/src/map/pc.c index 975a9e719f1..46a1e40b6a9 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -12016,10 +12016,10 @@ static void pc_scdata_received(struct map_session_data *sd) clif->pLoadEndAck(0,sd); pc->autotrade_populate(sd); pc->autotrade_start(sd); - } else { + } else if (sd->state.loadendack_before_scloaded != 0) { clif->pLoadEndAck(sd->fd, sd); + sd->state.loadendack_before_scloaded = 0; } - } static int pc_expiration_timer(int tid, int64 tick, int id, intptr_t data) { diff --git a/src/map/pc.h b/src/map/pc.h index 0a9bd6f833f..c2452b38cff 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -210,6 +210,7 @@ struct map_session_data { struct { unsigned int active : 1; //Marks active player (not active is logging in/out, or changing map servers) unsigned int scloaded : 1; // Marks sc related data has been loaded for player + unsigned int loadendack_before_scloaded : 1; // Marks that the LoadEndAck packet was received before scloaded unsigned int menu_or_input : 1;// if a script is waiting for feedback from the player unsigned int dead_sit : 2; unsigned int lr_flag : 3;//1: left h. weapon; 2: arrow; 3: shield