diff options
author | Paradox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-11-10 18:57:14 +0000 |
---|---|---|
committer | Paradox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-11-10 18:57:14 +0000 |
commit | d95751dcd8b3e17f773117dac3897f0cf7cb90af (patch) | |
tree | 8fafe10caae1f6b5f9649006dda165d1d4b7e13d /src/map/itemdb.c | |
parent | 84cdcd0f78c162511734466e1d1a37078ee1a786 (diff) | |
download | hercules-d95751dcd8b3e17f773117dac3897f0cf7cb90af.tar.gz hercules-d95751dcd8b3e17f773117dac3897f0cf7cb90af.tar.bz2 hercules-d95751dcd8b3e17f773117dac3897f0cf7cb90af.tar.xz hercules-d95751dcd8b3e17f773117dac3897f0cf7cb90af.zip |
Added an item_delay database usable for item-specific use delays.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/renewal@14455 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r-- | src/map/itemdb.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c index fb7cbe86f..2096ddf9e 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -27,7 +27,7 @@ static struct item_group itemgroup_db[MAX_ITEMGROUP]; struct item_data dummy_item; //This is the default dummy item used for non-existant items. [Skotlex] - +int item_delays = 0; /*========================================== * 名前で検索用 @@ -661,6 +661,50 @@ static int itemdb_read_itemtrade(void) return 0; } +/*========================================== + * Reads item delay amounts [Paradox924X] + *------------------------------------------*/ +static int itemdb_read_itemdelay(void) +{ + FILE *fp; + int nameid, j; + char line[1024], *str[10], *p; + struct item_data *id; + + sprintf(line, "%s/item_delay.txt", db_path); + if ((fp = fopen(line,"r")) == NULL) { + ShowError("can't read %s\n", line); + return -1; + } + + while(fgets(line, sizeof(line), fp)) + { + if (item_delays == MAX_ITEMDELAYS) { + ShowError("itemdb_read_itemdelay: Too many entries specified in %s/item_delay.txt!\n", db_path); + break; + } + if (line[0] == '/' && line[1] == '/') + continue; + memset(str, 0, sizeof(str)); + for (j = 0, p = line; j < 2 && p; j++) { + str[j] = p; + p = strchr(p, ','); + if(p) *p++ = 0; + } + + if (j < 2 || str[0] == NULL || + (nameid = atoi(str[0])) < 0 || !(id = itemdb_exists(nameid))) + continue; + + id->delay = atoi(str[1]); + item_delays++; + } + fclose(fp); + ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", item_delays, "item_delay.txt"); + + return 0; +} + /*====================================== * Applies gender restrictions according to settings. [Skotlex] *======================================*/ @@ -971,6 +1015,7 @@ static void itemdb_read(void) itemdb_read_itemavail(); itemdb_read_noequip(); itemdb_read_itemtrade(); + itemdb_read_itemdelay(); } /*========================================== |