summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-10-28 12:33:30 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-10-28 12:33:30 +0000
commit5b3532830e8c18baea99eccaa21a5c7569f8d02d (patch)
treefdbee1bf48e372a16ae833c8996aad27c3e808d0
parentfb33ba865eb09eef71ed38adbd141b6d771321b8 (diff)
downloadhercules-5b3532830e8c18baea99eccaa21a5c7569f8d02d.tar.gz
hercules-5b3532830e8c18baea99eccaa21a5c7569f8d02d.tar.bz2
hercules-5b3532830e8c18baea99eccaa21a5c7569f8d02d.tar.xz
hercules-5b3532830e8c18baea99eccaa21a5c7569f8d02d.zip
* Fixed db/packet_db.txt reading not checking for max. amount of positions.
* Introduced MAX_GUILD_SKILL_REQUIRE to fix inconsistency in amount of prereq. guild skills. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14985 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt3
-rw-r--r--src/map/clif.c7
-rw-r--r--src/map/clif.h12
-rw-r--r--src/map/guild.c9
4 files changed, 23 insertions, 8 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index f3cfb81af..1363e4119 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -1,5 +1,8 @@
Date Added
+2011/10/28
+ * Fixed db/packet_db.txt reading not checking for max. amount of positions. [Ai4rei]
+ * Introduced MAX_GUILD_SKILL_REQUIRE to fix inconsistency in amount of prereq. guild skills.
2011/10/26
* Fixed a mistake in RID description in doc/script_commands.txt (since r2402). [Ai4rei]
2011/10/23
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");