* Inventory and Cart item arrays are no longer getting compacted on each log-in/teleport/warp.
- This also resolves yet another issue caused by r14685 (bugreport:2604). git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14691 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
7557d37013
commit
2bc3dafd59
@ -1,6 +1,8 @@
|
|||||||
Date Added
|
Date Added
|
||||||
|
|
||||||
2011/01/31
|
2011/01/31
|
||||||
|
* Inventory and Cart item arrays are no longer getting compacted on each log-in/teleport/warp. [Ai4rei]
|
||||||
|
- This also resolves yet another issue caused by r14685 (bugreport:2604).
|
||||||
* Various accumulated cleanups and fixes. [Ai4rei]
|
* Various accumulated cleanups and fixes. [Ai4rei]
|
||||||
- Improved the compile speed for files which include common/socket.h on windows builds (related r10471).
|
- Improved the compile speed for files which include common/socket.h on windows builds (related r10471).
|
||||||
- Moved FIFOSIZE_SERVERLINK define from common/mmo.h to common/socket.h (since it is a server connection FIFO size setting).
|
- Moved FIFOSIZE_SERVERLINK define from common/mmo.h to common/socket.h (since it is a server connection FIFO size setting).
|
||||||
|
58
src/map/pc.c
58
src/map/pc.c
@ -7308,7 +7308,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int pc_checkitem(struct map_session_data *sd)
|
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;
|
struct item_data *it=NULL;
|
||||||
|
|
||||||
nullpo_ret(sd);
|
nullpo_ret(sd);
|
||||||
@ -7316,48 +7316,31 @@ int pc_checkitem(struct map_session_data *sd)
|
|||||||
if( sd->vender_id ) //Avoid reorganizing items when we are vending, as that leads to exploits (pointed out by End of Exam)
|
if( sd->vender_id ) //Avoid reorganizing items when we are vending, as that leads to exploits (pointed out by End of Exam)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for( i = j = 0; i < MAX_INVENTORY; i++ )
|
if( battle_config.item_check )
|
||||||
{
|
{// check for invalid(ated) items
|
||||||
if( (id = sd->status.inventory[i].nameid) == 0 )
|
for( i = 0; i < MAX_INVENTORY; i++ )
|
||||||
continue;
|
{
|
||||||
|
id = sd->status.inventory[i].nameid;
|
||||||
|
|
||||||
if( battle_config.item_check && !itemdb_available(id) )
|
if( id && !itemdb_available(id) )
|
||||||
{
|
{
|
||||||
ShowWarning("illegal item id %d in %d[%s] inventory.\n",id,sd->bl.id,sd->status.name);
|
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,3,0);
|
pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0);
|
||||||
continue;
|
}
|
||||||
}
|
}
|
||||||
if( i > j )
|
|
||||||
|
for( i = 0; i < MAX_CART; i++ )
|
||||||
{
|
{
|
||||||
memcpy(&sd->status.inventory[j], &sd->status.inventory[i], sizeof(struct item));
|
id = sd->status.cart[i].nameid;
|
||||||
sd->inventory_data[j] = sd->inventory_data[i];
|
|
||||||
|
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_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;
|
|
||||||
|
|
||||||
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( i > j )
|
|
||||||
{
|
|
||||||
memcpy(&sd->status.cart[j],&sd->status.cart[i],sizeof(struct item));
|
|
||||||
}
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
if( j < MAX_CART )
|
|
||||||
memset(&sd->status.cart[j],0,sizeof(struct item)*(MAX_CART-j));
|
|
||||||
|
|
||||||
for( i = 0; i < MAX_INVENTORY; i++)
|
for( i = 0; i < MAX_INVENTORY; i++)
|
||||||
{
|
{
|
||||||
it = sd->inventory_data[i];
|
it = sd->inventory_data[i];
|
||||||
@ -7389,7 +7372,6 @@ int pc_checkitem(struct map_session_data *sd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pc_setequipindex(sd);
|
|
||||||
if( calc_flag && sd->state.active )
|
if( calc_flag && sd->state.active )
|
||||||
{
|
{
|
||||||
pc_checkallowskill(sd);
|
pc_checkallowskill(sd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user