diff options
author | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-12-20 18:13:04 +0000 |
---|---|---|
committer | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-12-20 18:13:04 +0000 |
commit | 958273319fea7cdc8b82ec988ae6c235c7657ca2 (patch) | |
tree | 199f7180bd715e3773cf5a19df5f37dc2c977daf /src/map/skill.c | |
parent | 114a63af2cecc309da7e34ddf65e5eb3156126af (diff) | |
download | hercules-958273319fea7cdc8b82ec988ae6c235c7657ca2.tar.gz hercules-958273319fea7cdc8b82ec988ae6c235c7657ca2.tar.bz2 hercules-958273319fea7cdc8b82ec988ae6c235c7657ca2.tar.xz hercules-958273319fea7cdc8b82ec988ae6c235c7657ca2.zip |
* Added auto reading leveluseskillspamount.txt and indoorrswtable.txt
* Added check in grfio.c to prevent crashing
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@667 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/skill.c')
-rw-r--r-- | src/map/skill.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/map/skill.c b/src/map/skill.c index ddfb04965..f74409caf 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -25,6 +25,7 @@ #include "chrif.h" #include "guild.h" #include "showmsg.h" +#include "grfio.h" #ifdef MEMWATCH #include "memwatch.h" @@ -11982,6 +11983,52 @@ int skill_readdb(void) return 0; } +/*=============================================== + * For reading leveluseskillspamount.txt [Celest] + *----------------------------------------------- + */ +static int skill_read_skillspamount(void) +{ + char *buf,*p; + struct skill_db *skill = NULL; + int s, idx, new_flag=1, level=1, sp=0; + + buf=grfio_reads("data\\leveluseskillspamount.txt",&s); + + if(buf==NULL) + return -1; + + buf[s]=0; + for(p=buf;p-buf<s;){ + char buf2[64]; + + if (sscanf(p,"%[@]",buf2) == 1) { + level = 1; + new_flag = 1; + } else if (new_flag && sscanf(p,"%[^#]#",buf2) == 1) { + for (idx=0; skill_names[idx].id != 0; idx++) { + if (strstr(buf2, skill_names[idx].name) != NULL) { + skill = &skill_db[ skill_names[idx].id ]; + new_flag = 0; + break; + } + } + } else if (!new_flag && sscanf(p,"%d#",&sp) == 1) { + skill->sp[level-1]=sp; + level++; + } + + p=strchr(p,10); + if(!p) break; + p++; + } + free(buf); + sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","data\\leveluseskillspamount.txt"); + ShowStatus(tmp_output); + + return 0; +} + void skill_reload(void) { /* @@ -12001,6 +12048,7 @@ void skill_reload(void) int do_init_skill(void) { skill_readdb(); + skill_read_skillspamount(); add_timer_func_list(skill_unit_timer,"skill_unit_timer"); add_timer_func_list(skill_castend_id,"skill_castend_id"); |