diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-04-27 11:06:55 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-04-27 11:06:55 +0000 |
commit | af99be9bd11d716e0b8ef8eab4a36c9b9925e4c8 (patch) | |
tree | 45c74210524f6069f3cb6750744cb59af5031c30 /src/map/npc.c | |
parent | 8dedf18e168afd90230af1997edb593431b36e03 (diff) | |
download | hercules-af99be9bd11d716e0b8ef8eab4a36c9b9925e4c8.tar.gz hercules-af99be9bd11d716e0b8ef8eab4a36c9b9925e4c8.tar.bz2 hercules-af99be9bd11d716e0b8ef8eab4a36c9b9925e4c8.tar.xz hercules-af99be9bd11d716e0b8ef8eab4a36c9b9925e4c8.zip |
Cleaning up the itemdb reload mess (see r12635, r12643, r12650, r12661, r12662, r12663)
* the player data inventory-itemdb index is now refreshed using pc_setinventorydata()
* mobdb will no longer initialize with nonexistent items, and mobs will no longer drop them in case of a reload
* the clif_buylist() function once again hides invalid npc shop items
* it is no longer possible to purchase nonexistent items from a npc shop
* npc shop loading will not abort if there is a nonexistent item entry, it will just skip over it
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12665 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index f1ff119da..683be8620 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -150,19 +150,6 @@ struct npc_data* npc_name2id(const char* name) return (struct npc_data *) strdb_get(npcname_db, name); } - -/*========================================== - * Run function for each npc - *------------------------------------------*/ - -void npc_foreach(int (*func)(DBKey, void*, va_list), ...) -{ - va_list ap; - va_start(ap, func); - npcname_db->vforeach(npcname_db, func, ap); - va_end(ap); -} - /*========================================== * イベントキューのイベント処理 *------------------------------------------*/ @@ -1128,7 +1115,7 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list) itemdb_viewid(nd->u.shop.shop_item[j].nameid)==item_list[i*2+1]) //item_avail replacement break; } - if (nd->u.shop.shop_item[j].nameid == 0) + if (nd->u.shop.shop_item[j].nameid == 0 || !itemdb_exists(nd->u.shop.shop_item[j].nameid)) return 3; if (!itemdb_isstackable(nd->u.shop.shop_item[j].nameid) && item_list[i*2] > 1) @@ -1687,8 +1674,9 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const if( (id = itemdb_exists(nameid)) == NULL ) { - ShowError("npc_parse_shop: Invalid sell item in file '%s', line '%d'. Ignoring the rest of the line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4); - break; + ShowWarning("npc_parse_shop: Invalid sell item in file '%s', line '%d' (id '%d').\n", filepath, strline(buffer,start-buffer), nameid); + p = strchr(p+1,','); + continue; } if( value < 0 ) |