Skip to content

Commit 574e63d

Browse files
Merge pull request #2562 from MishimaHaruna/cached-info-fixes
Clean up cached party/guild data when leaving/disbanding
2 parents a7f67d0 + 36cb0a2 commit 574e63d

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/char/int_party.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ static void inter_party_calc_state(struct party_data *p)
118118
p->party.exp = 0; //Set off even share.
119119
mapif->party_optionchanged(0, &p->party, 0, 0);
120120
}
121-
return;
122121
}
123122

124123
// Save party to mysql
@@ -472,8 +471,11 @@ static bool inter_party_leave(int party_id, int account_id, int char_id)
472471
mapif->party_withdraw(party_id, account_id, char_id);
473472

474473
j = p->party.member[i].lv;
475-
if (p->party.member[i].online > 0)
474+
if (p->party.member[i].online > 0) {
475+
p->party.member[i].online = 0;
476476
p->party.count--;
477+
}
478+
inter_party->tosql(&p->party, PS_DELMEMBER, i);
477479
memset(&p->party.member[i], 0, sizeof(struct party_member));
478480
p->size--;
479481
if (j == p->min_lv || j == p->max_lv || p->family) {
@@ -482,7 +484,6 @@ static bool inter_party_leave(int party_id, int account_id, int char_id)
482484
}
483485

484486
if (inter_party->check_empty(p) == 0) {
485-
inter_party->tosql(&p->party, PS_DELMEMBER, i);
486487
mapif->party_info(-1, &p->party, 0);
487488
}
488489
return true;

src/map/guild.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ static int guild_check_member(const struct guild *g)
565565
if (i == INDEX_NOT_FOUND) {
566566
sd->status.guild_id=0;
567567
sd->guild_emblem_id=0;
568+
sd->guild = NULL;
568569
ShowWarning("guild: check_member %d[%s] is not member\n",sd->status.account_id,sd->status.name);
569570
}
570571
}
@@ -581,8 +582,11 @@ static int guild_recv_noinfo(int guild_id)
581582

582583
iter = mapit_getallusers();
583584
for (sd = BL_UCAST(BL_PC, mapit->first(iter)); mapit->exists(iter); sd = BL_UCAST(BL_PC, mapit->next(iter))) {
584-
if( sd->status.guild_id == guild_id )
585+
if (sd->status.guild_id == guild_id) {
585586
sd->status.guild_id = 0; // erase guild
587+
sd->guild_emblem_id = 0;
588+
sd->guild = NULL;
589+
}
586590
}
587591
mapit->free(iter);
588592

@@ -872,6 +876,8 @@ static void guild_member_joined(struct map_session_data *sd)
872876
i = guild->getindex(g, sd->status.account_id, sd->status.char_id);
873877
if (i == INDEX_NOT_FOUND) {
874878
sd->status.guild_id = 0;
879+
sd->guild_emblem_id = 0;
880+
sd->guild = NULL;
875881
} else {
876882
g->member[i].sd = sd;
877883
sd->guild = g;

src/map/party.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,7 @@ static int party_broken(int party_id)
695695
if( p->data[i].sd!=NULL ) {
696696
clif->party_withdraw(p,p->data[i].sd,p->party.member[i].account_id,p->party.member[i].name,0x10);
697697
p->data[i].sd->status.party_id=0;
698+
clif->charnameupdate(p->data[i].sd);
698699
}
699700
}
700701

0 commit comments

Comments
 (0)