diff options
Diffstat (limited to 'src/char/int_guild.c')
-rw-r--r-- | src/char/int_guild.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/char/int_guild.c b/src/char/int_guild.c index e03278fad..8e05c76e2 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -319,8 +319,8 @@ static int inter_guild_tosql(struct guild *g, int flag) SQL->EscapeStringLen(inter->sql_handle, esc_name, e->name, strnlen(e->name, NAME_LENGTH)); SQL->EscapeStringLen(inter->sql_handle, esc_mes, e->mes, strnlen(e->mes, sizeof(e->mes))); - if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`guild_id`,`account_id`,`name`,`mes`) " - "VALUES ('%d','%d','%s','%s')", guild_expulsion_db, g->guild_id, e->account_id, esc_name, esc_mes) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`guild_id`,`account_id`, `char_id`, `name`,`mes`) " + "VALUES ('%d','%d','%d','%s','%s')", guild_expulsion_db, g->guild_id, e->account_id, e->char_id, esc_name, esc_mes) ) Sql_ShowDebug(inter->sql_handle); } } @@ -443,7 +443,15 @@ static struct guild *inter_guild_fromsql(int guild_id) if( m->position >= MAX_GUILDPOSITION ) // Fix reduction of MAX_GUILDPOSITION [PoW] m->position = MAX_GUILDPOSITION - 1; SQL->GetData(inter->sql_handle, 11, &data, &len); memcpy(m->name, data, min(len, NAME_LENGTH)); - SQL->GetData(inter->sql_handle, 12, &data, NULL); m->last_login = atoi(data); + SQL->GetData(inter->sql_handle, 12, &data, NULL); + if (data != NULL) { + m->last_login = atoi(data); + // 2036-12-31 + if (m->last_login > 2114283600) { + ShowError("Last login time bigger than allowd value in %d:%s: %u\n", guild_id, g->name, m->last_login); + m->last_login = 0; + } + } m->modified = GS_MEMBER_UNMODIFIED; } @@ -486,7 +494,7 @@ static struct guild *inter_guild_fromsql(int guild_id) } //printf("- Read guild_expulsion %d from sql \n",guild_id); - if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `account_id`,`name`,`mes` FROM `%s` WHERE `guild_id`='%d'", guild_expulsion_db, guild_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `account_id`,`char_id`,`name`,`mes` FROM `%s` WHERE `guild_id`='%d'", guild_expulsion_db, guild_id) ) { Sql_ShowDebug(inter->sql_handle); aFree(g); @@ -497,8 +505,9 @@ static struct guild *inter_guild_fromsql(int guild_id) struct guild_expulsion *e = &g->expulsion[i]; SQL->GetData(inter->sql_handle, 0, &data, NULL); e->account_id = atoi(data); - SQL->GetData(inter->sql_handle, 1, &data, &len); memcpy(e->name, data, min(len, NAME_LENGTH)); - SQL->GetData(inter->sql_handle, 2, &data, &len); memcpy(e->mes, data, min(len, sizeof(e->mes))); + SQL->GetData(inter->sql_handle, 1, &data, NULL); e->char_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, &len); memcpy(e->name, data, min(len, NAME_LENGTH)); + SQL->GetData(inter->sql_handle, 3, &data, &len); memcpy(e->mes, data, min(len, sizeof(e->mes))); } //printf("- Read guild_skill %d from sql \n",guild_id); @@ -1036,6 +1045,7 @@ static bool inter_guild_leave(int guild_id, int account_id, int char_id, int fla } // Save the expulsion entry g->expulsion[j].account_id = account_id; + g->expulsion[j].char_id = char_id; safestrncpy(g->expulsion[j].name, g->member[i].name, NAME_LENGTH); safestrncpy(g->expulsion[j].mes, mes, 40); } @@ -1058,7 +1068,7 @@ static bool inter_guild_leave(int guild_id, int account_id, int char_id, int fla } // Change member info -static bool inter_guild_update_member_info_short(int guild_id, int account_id, int char_id, int online, int lv, int16 class) +static bool inter_guild_update_member_info_short(int guild_id, int account_id, int char_id, int online, int lv, int class) { // Could speed up by manipulating only guild_member struct guild *g; @@ -1600,7 +1610,7 @@ static int inter_guild_parse_frommap(int fd) case 0x3032: mapif->parse_GuildAddMember(fd, RFIFOL(fd,4), RFIFOP(fd,8)); break; case 0x3033: mapif->parse_GuildMasterChange(fd, RFIFOL(fd,4), RFIFOP(fd,8), RFIFOW(fd,2)-8); break; case 0x3034: mapif->parse_GuildLeave(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOB(fd,14), RFIFOP(fd,15)); break; - case 0x3035: mapif->parse_GuildChangeMemberInfoShort(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),RFIFOW(fd,15),RFIFOW(fd,17)); break; + case 0x3035: mapif->parse_GuildChangeMemberInfoShort(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),RFIFOL(fd,15),RFIFOL(fd,19)); break; case 0x3036: mapif->parse_BreakGuild(fd,RFIFOL(fd,2)); break; case 0x3037: mapif->parse_GuildMessage(fd, RFIFOL(fd,4), RFIFOL(fd,8), RFIFOP(fd,12), RFIFOW(fd,2)-12); break; case 0x3039: mapif->parse_GuildBasicInfoChange(fd, RFIFOL(fd,4), RFIFOW(fd,8), RFIFOP(fd,10), RFIFOW(fd,2)-10); break; |