diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/clif.c | 7 | ||||
-rw-r--r-- | src/map/clif.h | 12 | ||||
-rw-r--r-- | src/map/guild.c | 9 |
3 files changed, 20 insertions, 8 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 738ca9485..01de1e51d 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -15592,6 +15592,13 @@ static int packetdb_readdb(void) if(p2) *p2++=0; k = atoi(str2[j]); // if (packet_db[packet_ver][cmd].pos[j] != k && clif_config.prefer_packet_db) // not used for now + + if( j >= MAX_PACKET_POS ) + { + ShowError("Too many positions found for packet 0x%04x (max=%d).\n", cmd, MAX_PACKET_POS); + break; + } + packet_db[packet_ver][cmd].pos[j] = k; } } diff --git a/src/map/clif.h b/src/map/clif.h index e34ff55a0..783c8f4a1 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -27,14 +27,18 @@ struct battleground_data; struct quest; struct party_booking_ad_info; #include <stdarg.h> -// packet DB -#define MAX_PACKET_DB 0x900 -#define MAX_PACKET_VER 26 + +enum +{// packet DB + MAX_PACKET_DB = 0x900, + MAX_PACKET_VER = 26, + MAX_PACKET_POS = 20, +}; struct s_packet_db { short len; void (*func)(int, struct map_session_data *); - short pos[20]; + short pos[MAX_PACKET_POS]; }; // packet_db[SERVER] is reserved for server use diff --git a/src/map/guild.c b/src/map/guild.c index 0b77aa9a1..835f10f9e 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)) @@ -1943,7 +1944,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"); |