diff options
author | brianluau <brianluau@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-06-12 16:22:33 +0000 |
---|---|---|
committer | brianluau <brianluau@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-06-12 16:22:33 +0000 |
commit | a8fe46e2e80ea5b7d998d3e92717153cc3315129 (patch) | |
tree | f023f80fd298226e974c34cf595e4e05e4462a9d /src/map/itemdb.c | |
parent | 22ea2706f0a9767d9910522868cc90f121cfc6fa (diff) | |
download | hercules-a8fe46e2e80ea5b7d998d3e92717153cc3315129.tar.gz hercules-a8fe46e2e80ea5b7d998d3e92717153cc3315129.tar.bz2 hercules-a8fe46e2e80ea5b7d998d3e92717153cc3315129.tar.xz hercules-a8fe46e2e80ea5b7d998d3e92717153cc3315129.zip |
* Merged /branches/renewal/ r14635 Item Stacking System to /trunk (follow up to r15060) pid:106973
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16279 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r-- | src/map/itemdb.c | 51 |
1 files changed, 46 insertions, 5 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 7059cbee7..f7b2da7cb 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -670,6 +670,46 @@ static bool itemdb_read_itemdelay(char* str[], int columns, int current) return true; } +/*================================================================== + * Reads item stacking restrictions + *----------------------------------------------------------------*/ +static bool itemdb_read_stack(char* fields[], int columns, int current) +{// <item id>,<stack limit amount>,<type> + unsigned short nameid, amount; + unsigned int type; + struct item_data* id; + + nameid = (unsigned short)strtoul(fields[0], NULL, 10); + + if( ( id = itemdb_exists(nameid) ) == NULL ) + { + ShowWarning("itemdb_read_stack: Unknown item id '%hu'.\n", nameid); + return false; + } + + if( !itemdb_isstackable2(id) ) + { + ShowWarning("itemdb_read_stack: Item id '%hu' is not stackable.\n", nameid); + return false; + } + + amount = (unsigned short)strtoul(fields[1], NULL, 10); + type = strtoul(fields[2], NULL, 10); + + if( !amount ) + {// ignore + return true; + } + + id->stack.amount = amount; + id->stack.inventory = (type&1)!=0; + id->stack.cart = (type&2)!=0; + id->stack.storage = (type&4)!=0; + id->stack.guildstorage = (type&8)!=0; + + return true; +} + /// Reads items allowed to be sold in buying stores static bool itemdb_read_buyingstore(char* fields[], int columns, int current) @@ -1050,11 +1090,12 @@ static void itemdb_read(void) itemdb_readdb(); itemdb_read_itemgroup(); - sv_readdb(db_path, "item_avail.txt", ',', 2, 2, -1, &itemdb_read_itemavail); - sv_readdb(db_path, DBPATH"item_noequip.txt", ',', 2, 2, -1, &itemdb_read_noequip); - sv_readdb(db_path, DBPATH"item_trade.txt", ',', 3, 3, -1, &itemdb_read_itemtrade); - sv_readdb(db_path, "item_delay.txt", ',', 2, 2, -1, &itemdb_read_itemdelay); - sv_readdb(db_path, "item_buyingstore.txt", ',', 1, 1, -1, &itemdb_read_buyingstore); + sv_readdb(db_path, "item_avail.txt", ',', 2, 2, -1, &itemdb_read_itemavail); + sv_readdb(db_path, DBPATH"item_noequip.txt", ',', 2, 2, -1, &itemdb_read_noequip); + sv_readdb(db_path, DBPATH"item_trade.txt", ',', 3, 3, -1, &itemdb_read_itemtrade); + sv_readdb(db_path, "item_delay.txt", ',', 2, 2, -1, &itemdb_read_itemdelay); + sv_readdb(db_path, "item_stack.txt", ',', 3, 3, -1, &itemdb_read_stack); + sv_readdb(db_path, "item_buyingstore.txt", ',', 1, 1, -1, &itemdb_read_buyingstore); } /*========================================== |