summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-03-09 19:00:35 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-03-09 19:00:35 +0000
commit168677929dc43930a81a49a54d748a3b2298a811 (patch)
tree8eb547e2537ea19df6ad193d66411db939d36827 /src
parent5cca96bf950bcd9586ab04f0e0f2b5d9a556c5e0 (diff)
downloadhercules-168677929dc43930a81a49a54d748a3b2298a811.tar.gz
hercules-168677929dc43930a81a49a54d748a3b2298a811.tar.bz2
hercules-168677929dc43930a81a49a54d748a3b2298a811.tar.xz
hercules-168677929dc43930a81a49a54d748a3b2298a811.zip
* Fixed some missing/wrong bits in merge from trunk (follow up to r14740).
- Fixed added files not being svn-copied (thus lacking svn history). - Applied missing property changes. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/renewal@14741 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/itemdb.c3
-rw-r--r--src/map/pc.c56
2 files changed, 21 insertions, 38 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 92fe757c8..e8afebdfe 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -703,6 +703,7 @@ static bool itemdb_read_stack(char* fields[], int columns, int current)
return true;
}
+
/// Reads items allowed to be sold in buying stores
static bool itemdb_read_buyingstore(char* fields[], int columns, int current)
{// <nameid>
@@ -1045,8 +1046,8 @@ static void itemdb_read(void)
sv_readdb(db_path, "item_noequip.txt", ',', 2, 2, -1, &itemdb_read_noequip);
sv_readdb(db_path, "item_trade.txt", ',', 3, 3, -1, &itemdb_read_itemtrade);
sv_readdb(db_path, "item_delay.txt", ',', 2, 2, MAX_ITEMDELAYS, &itemdb_read_itemdelay);
- sv_readdb(db_path, "item_buyingstore.txt", ',', 1, 1, -1, &itemdb_read_buyingstore);
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);
}
/*==========================================
diff --git a/src/map/pc.c b/src/map/pc.c
index ffbd2d3cf..4b2d4511e 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -7372,55 +7372,38 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
*------------------------------------------*/
int pc_checkitem(struct map_session_data *sd)
{
- int i,j,k,id,calc_flag = 0;
+ int i,id,calc_flag = 0;
struct item_data *it=NULL;
nullpo_ret(sd);
if( sd->vender_id ) //Avoid reorganizing items when we are vending, as that leads to exploits (pointed out by End of Exam)
return 0;
-
- for( i = j = 0; i < MAX_INVENTORY; i++ )
- {
- if( (id = sd->status.inventory[i].nameid) == 0 )
- continue;
- if( battle_config.item_check && !itemdb_available(id) )
- {
- ShowWarning("illegal item id %d in %d[%s] inventory.\n",id,sd->bl.id,sd->status.name);
- pc_delitem(sd,i,sd->status.inventory[i].amount,3,0);
- continue;
- }
- if( i > j )
+ if( battle_config.item_check )
+ {// check for invalid(ated) items
+ for( i = 0; i < MAX_INVENTORY; i++ )
{
- memcpy(&sd->status.inventory[j], &sd->status.inventory[i], sizeof(struct item));
- sd->inventory_data[j] = sd->inventory_data[i];
- }
- j++;
- }
-
- if( j < MAX_INVENTORY )
- memset(&sd->status.inventory[j], 0, sizeof(struct item)*(MAX_INVENTORY-j));
- for( k = j ; k < MAX_INVENTORY; k++ )
- sd->inventory_data[k] = NULL;
+ id = sd->status.inventory[i].nameid;
- for( i = j = 0; i < MAX_CART; i++ )
- {
- if( (id=sd->status.cart[i].nameid) == 0 )
- continue;
- if( battle_config.item_check && !itemdb_available(id) ){
- ShowWarning("illegal item id %d in %d[%s] cart.\n",id,sd->bl.id,sd->status.name);
- pc_cart_delitem(sd,i,sd->status.cart[i].amount,1);
- continue;
+ if( id && !itemdb_available(id) )
+ {
+ ShowWarning("Removed invalid/disabled item id %d from inventory (amount=%d, char_id=%d).\n", id, sd->status.inventory[i].amount, sd->status.char_id);
+ pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0);
+ }
}
- if( i > j )
+
+ for( i = 0; i < MAX_CART; i++ )
{
- memcpy(&sd->status.cart[j],&sd->status.cart[i],sizeof(struct item));
+ id = sd->status.cart[i].nameid;
+
+ if( id && !itemdb_available(id) )
+ {
+ ShowWarning("Removed invalid/disabled item id %d from cart (amount=%d, char_id=%d).\n", id, sd->status.cart[i].amount, sd->status.char_id);
+ pc_cart_delitem(sd, i, sd->status.cart[i].amount, 0);
+ }
}
- j++;
}
- if( j < MAX_CART )
- memset(&sd->status.cart[j],0,sizeof(struct item)*(MAX_CART-j));
for( i = 0; i < MAX_INVENTORY; i++)
{
@@ -7453,7 +7436,6 @@ int pc_checkitem(struct map_session_data *sd)
}
}
- pc_setequipindex(sd);
if( calc_flag && sd->state.active )
{
pc_checkallowskill(sd);