summaryrefslogtreecommitdiff
path: root/src/map/itemdb.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-01 21:15:57 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-01 21:15:57 +0000
commita6ba6ca70419e7f6db413c3581aee6e90dc87b0a (patch)
tree8f7f1e068fc2f9bae7e7ff041eb8c3dc83e0e887 /src/map/itemdb.c
parentb1d22b02963b16c4edcce0cd5d2bc521d97348f9 (diff)
downloadhercules-a6ba6ca70419e7f6db413c3581aee6e90dc87b0a.tar.gz
hercules-a6ba6ca70419e7f6db413c3581aee6e90dc87b0a.tar.bz2
hercules-a6ba6ca70419e7f6db413c3581aee6e90dc87b0a.tar.xz
hercules-a6ba6ca70419e7f6db413c3581aee6e90dc87b0a.zip
- Fixed the server crashing on startup due to bad define
- Fixed the server crashing on a timer-queued disguise / undisguise (no sd check) - re-added the item_group_list for consistency's sake, moved to itemdb.h (after some hacking to remove the ugly map.h dependency) - Removed some overly verbose item group messages & code git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10112 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r--src/map/itemdb.c71
1 files changed, 14 insertions, 57 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 404d8514f..c81e177e1 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -9,11 +9,11 @@
#include "../common/malloc.h"
#include "../common/showmsg.h"
#include "../common/strlib.h"
-#include "map.h"
-#include "battle.h"
#include "itemdb.h"
-#include "script.h"
-#include "pc.h"
+#include "map.h"
+#include "battle.h" // struct battle_config
+#include "script.h" // item script processing
+#include "pc.h" // W_MUSICAL, W_WHIP
static struct dbt* item_db;
@@ -103,19 +103,18 @@ int itemdb_searchrandomid(int group)
}
/*==========================================
- * Calculates total item-group related bonuses for the given item. [Skotlex]
- *------------------------------------------
- */
-int itemdb_group_bonus(struct map_session_data *sd, int itemid)
+ * Calculates total item-group related bonuses for the given item
+ *------------------------------------------*/
+int itemdb_group_bonus(const int itemgrouphealrate[MAX_ITEMGROUP], int itemid)
{
int bonus = 0, i, j;
for (i=0; i < MAX_ITEMGROUP; i++) {
- if (!sd->itemgrouphealrate[i])
+ if (itemgrouphealrate[i])
continue;
for (j=0; j < itemgroup_db[i].qty; j++) {
if (itemgroup_db[i].nameid[j] == itemid)
{
- bonus += sd->itemgrouphealrate[i];
+ bonus += itemgrouphealrate[i];
break;
}
}
@@ -447,8 +446,7 @@ static int itemdb_read_itemavail (void)
/*==========================================
* read item group data
- *------------------------------------------
- */
+ *------------------------------------------*/
static void itemdb_read_itemgroup_sub(const char* filename)
{
FILE *fp;
@@ -498,7 +496,7 @@ static void itemdb_read_itemgroup_sub(const char* filename)
continue;
}
k = atoi(str[2]);
- if (itemgroup_db[groupid].qty+k > MAX_RANDITEM) {
+ if (itemgroup_db[groupid].qty+k >= MAX_RANDITEM) {
ShowWarning("itemdb_read_itemgroup: Group %d is full (%d entries) in %s:%d\n", groupid, MAX_RANDITEM, filename, ln);
continue;
}
@@ -512,52 +510,11 @@ static void itemdb_read_itemgroup_sub(const char* filename)
static void itemdb_read_itemgroup(void)
{
char path[256];
- int i;
- const char* groups[] = {
- "Blue Box",
- "Violet Box",
- "Card Album",
- "Gift Box",
- "Scroll Box",
- "Finding Ore",
- "Cookie Bag",
- "Potion",
- "Herbs",
- "Fruits",
- "Meat",
- "Candy",
- "Juice",
- "Fish",
- "Boxes",
- "Gemstone",
- "Jellopy",
- "Ore",
- "Food",
- "Recovery",
- "Minerals",
- "Taming",
- "Scrolls",
- "Quivers",
- "Masks",
- "Accesory",
- "Jewels",
- "Gift Box 1",
- "Gift Box 2",
- "Gift Box 3",
- "Gift Box 4",
- "Egg Boy",
- "Egg Girl",
- "Gift Box China",
- "Lotto Box",
- };
- memset(&itemgroup_db, 0, sizeof(itemgroup_db));
snprintf(path, 255, "%s/item_group_db.txt", db_path);
+
+ memset(&itemgroup_db, 0, sizeof(itemgroup_db));
itemdb_read_itemgroup_sub(path);
- ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n","item_group_db.txt");
- if (battle_config.etc_log) {
- for (i = 1; i < MAX_ITEMGROUP; i++)
- ShowInfo("Group %s: %d entries.\n", groups[i-1], itemgroup_db[i].qty);
- }
+ ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n", "item_group_db.txt");
return;
}