summaryrefslogtreecommitdiff
path: root/src/map/guild.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/guild.c')
-rw-r--r--src/map/guild.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/map/guild.c b/src/map/guild.c
index 0b77aa9a1..8c5988dc8 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -52,13 +52,14 @@ struct guild_expcache {
};
static struct eri *expcache_ers; //For handling of guild exp payment.
+#define MAX_GUILD_SKILL_REQUIRE 5
struct{
int id;
int max;
struct{
short id;
short lv;
- }need[6];
+ }need[MAX_GUILD_SKILL_REQUIRE];
} guild_skill_tree[MAX_GUILDSKILL];
int guild_payexp_timer(int tid, unsigned int tick, int id, intptr_t data);
@@ -124,7 +125,7 @@ static bool guild_read_guildskill_tree_db(char* split[], int columns, int curren
guild_skill_tree[id].max = 1;
}
- for( k = 0; k < 5; k++ )
+ for( k = 0; k < MAX_GUILD_SKILL_REQUIRE; k++ )
{
guild_skill_tree[id].need[k].id = atoi(split[k*2+2]);
guild_skill_tree[id].need[k].lv = atoi(split[k*2+3]);
@@ -147,7 +148,7 @@ int guild_check_skill_require(struct guild *g,int id)
if (idx < 0 || idx >= MAX_GUILDSKILL)
return 0;
- for(i=0;i<5;i++)
+ for(i=0;i<MAX_GUILD_SKILL_REQUIRE;i++)
{
if(guild_skill_tree[idx].need[i].id == 0) break;
if(guild_skill_tree[idx].need[i].lv > guild_checkskill(g,guild_skill_tree[idx].need[i].id))
@@ -322,10 +323,14 @@ int guild_send_xy_timer_sub(DBKey key,void *data,va_list ap)
nullpo_ret(g);
+ if( !g->connect_member )
+ {// no members connected to this guild so do not iterate
+ return 0;
+ }
+
for(i=0;i<g->max_member;i++){
- //struct map_session_data* sd = g->member[i].sd;
- struct map_session_data* sd = map_charid2sd(g->member[i].char_id); // temporary crashfix
- if( sd != NULL && (sd->guild_x != sd->bl.x || sd->guild_y != sd->bl.y) && !sd->bg_id )
+ struct map_session_data* sd = g->member[i].sd;
+ if( sd != NULL && sd->fd && (sd->guild_x != sd->bl.x || sd->guild_y != sd->bl.y) && !sd->bg_id )
{
clif_guild_xy(sd);
sd->guild_x = sd->bl.x;
@@ -1943,7 +1948,7 @@ void do_init_guild(void)
sv_readdb(db_path, "castle_db.txt", ',', 4, 5, -1, &guild_read_castledb);
memset(guild_skill_tree,0,sizeof(guild_skill_tree));
- sv_readdb(db_path, "guild_skill_tree.txt", ',', 12, 12, -1, &guild_read_guildskill_tree_db); //guild skill tree [Komurka]
+ sv_readdb(db_path, "guild_skill_tree.txt", ',', 2+MAX_GUILD_SKILL_REQUIRE*2, 2+MAX_GUILD_SKILL_REQUIRE*2, -1, &guild_read_guildskill_tree_db); //guild skill tree [Komurka]
add_timer_func_list(guild_payexp_timer,"guild_payexp_timer");
add_timer_func_list(guild_send_xy_timer, "guild_send_xy_timer");