diff options
author | Haru <haru@dotalux.com> | 2018-07-06 23:24:27 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2018-07-06 23:24:27 +0200 |
commit | 6c99adb0b3de4677fdcc28d636aeaa618ce04bb1 (patch) | |
tree | 16060ca60d876c40936794553aee053d9b13c8ee /src/char | |
parent | eed4e9bb3a466cfe32bdb72df12c7ad2ceb0dd79 (diff) | |
download | hercules-6c99adb0b3de4677fdcc28d636aeaa618ce04bb1.tar.gz hercules-6c99adb0b3de4677fdcc28d636aeaa618ce04bb1.tar.bz2 hercules-6c99adb0b3de4677fdcc28d636aeaa618ce04bb1.tar.xz hercules-6c99adb0b3de4677fdcc28d636aeaa618ce04bb1.zip |
Fix a regression in inter_guild_add_member
Fixes #2122
Regression introduced in 735e2e8340c9522ee5a9afdcad29d191da29c8d4, #2108
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/char')
-rw-r--r-- | src/char/int_guild.c | 9 | ||||
-rw-r--r-- | src/char/int_guild.h | 2 | ||||
-rw-r--r-- | src/char/mapif.c | 6 |
3 files changed, 9 insertions, 8 deletions
diff --git a/src/char/int_guild.c b/src/char/int_guild.c index e7315ed50..e03278fad 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -969,21 +969,24 @@ static struct guild *inter_guild_create(const char *name, const struct guild_mem } // Add member to guild -static bool inter_guild_add_member(int guild_id, const struct guild_member *member) +static bool inter_guild_add_member(int guild_id, const struct guild_member *member, int map_fd) { struct guild * g; int i; nullpo_ret(member); g = inter_guild->fromsql(guild_id); - if (g == NULL) + if (g == NULL) { + mapif->guild_memberadded(map_fd, guild_id, member->account_id, member->char_id, 1); // 1: Failed to add return false; + } // Find an empty slot for (i = 0; i < g->max_member; i++) { if (g->member[i].account_id == 0) { g->member[i] = *member; g->member[i].modified = (GS_MEMBER_NEW | GS_MEMBER_MODIFIED); + mapif->guild_memberadded(map_fd, guild_id, member->account_id, member->char_id, 0); // 0: success if (!inter_guild->calcinfo(g)) //Send members if it was not invoked. mapif->guild_info(-1, g); @@ -993,6 +996,8 @@ static bool inter_guild_add_member(int guild_id, const struct guild_member *memb return true; } } + + mapif->guild_memberadded(map_fd, guild_id, member->account_id, member->char_id, 1); // 1: Failed to add return false; } diff --git a/src/char/int_guild.h b/src/char/int_guild.h index 2af8f6801..33873edcd 100644 --- a/src/char/int_guild.h +++ b/src/char/int_guild.h @@ -70,7 +70,7 @@ struct inter_guild_interface { int (*parse_frommap) (int fd); int (*broken) (int guild_id); struct guild *(*create) (const char *name, const struct guild_member *master); - bool (*add_member) (int guild_id, const struct guild_member *member); + bool (*add_member) (int guild_id, const struct guild_member *member, int map_fd); bool (*leave) (int guild_id, int account_id, int char_id, int flag, const char *mes, int map_fd); bool (*update_member_info_short) (int guild_id, int account_id, int char_id, int online, int lv, int16 class); bool (*update_member_info) (int guild_id, int account_id, int char_id, int type, const char *data, int len); diff --git a/src/char/mapif.c b/src/char/mapif.c index e0565c126..6acf803e2 100644 --- a/src/char/mapif.c +++ b/src/char/mapif.c @@ -784,11 +784,7 @@ static int mapif_parse_GuildAddMember(int fd, int guild_id, const struct guild_m { nullpo_ret(m); - if (!inter_guild->add_member(guild_id, m)) { - mapif->guild_memberadded(fd, guild_id, m->account_id, m->char_id, 1); // 1: Failed to add - } else { - mapif->guild_memberadded(fd, guild_id, m->account_id, m->char_id, 0); // 0: success - } + inter_guild->add_member(guild_id, m, fd); return 0; } |