Skip to content

Commit

Permalink
Merge pull request #3256 from csnv/fix/sc_not_loaded
Browse files Browse the repository at this point in the history
Fix sc statuses not loaded on time when under heavy load
  • Loading branch information
MishimaHaruna authored Dec 28, 2023
2 parents 11d7d1b + ed0d652 commit 40a0387
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/map/clif.c
Original file line number Diff line number Diff line change
Expand Up @@ -11161,6 +11161,10 @@ static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd)
return;
}

if (sd->state.scloaded == 0) { // SC data was not received yet. pc->scdata_received will reinvoke
return;
}

if (sd->state.rewarp != 0) { // Rewarp character.
sd->state.rewarp = 0;
clif->changemap(sd, sd->bl.m, sd->bl.x, sd->bl.y);
Expand Down
13 changes: 9 additions & 4 deletions src/map/pc.c
Original file line number Diff line number Diff line change
Expand Up @@ -12260,14 +12260,19 @@ static void pc_scdata_received(struct map_session_data *sd)
pc->expire_check(sd);
}

if( sd->state.standalone ) {

if (sd->sc.data[SC_SOULENERGY] != NULL)
sd->soulball = sd->sc.data[SC_SOULENERGY]->val1;

sd->state.scloaded = 1;
if (sd->state.standalone) {
clif->pLoadEndAck(0,sd);
pc->autotrade_populate(sd);
pc->autotrade_start(sd);
} else {
clif->pLoadEndAck(sd->fd, sd);
}

if (sd->sc.data[SC_SOULENERGY] != NULL)
sd->soulball = sd->sc.data[SC_SOULENERGY]->val1;

}
static int pc_expiration_timer(int tid, int64 tick, int id, intptr_t data)
{
Expand Down
1 change: 1 addition & 0 deletions src/map/pc.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ struct map_session_data {
//status_calc_pc, while special_state is recalculated in each call. [Skotlex]
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 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
Expand Down

0 comments on commit 40a0387

Please sign in to comment.