|
@@ -30,7 +30,7 @@ static DBMap* guild_storage_db; // int guild_id -> struct guild_storage*
|
|
/*==========================================
|
|
/*==========================================
|
|
* ‘qŒÉ“àƒAƒCƒeƒ€ƒ\�[ƒg
|
|
* ‘qŒÉ“àƒAƒCƒeƒ€ƒ\�[ƒg
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-int storage_comp_item(const void *_i1, const void *_i2)
|
|
|
|
|
|
+static int storage_comp_item(const void *_i1, const void *_i2)
|
|
{
|
|
{
|
|
struct item *i1 = (struct item *)_i1;
|
|
struct item *i1 = (struct item *)_i1;
|
|
struct item *i2 = (struct item *)_i2;
|
|
struct item *i2 = (struct item *)_i2;
|
|
@@ -44,13 +44,13 @@ int storage_comp_item(const void *_i1, const void *_i2)
|
|
return i1->nameid - i2->nameid;
|
|
return i1->nameid - i2->nameid;
|
|
}
|
|
}
|
|
|
|
|
|
-void storage_sortitem (struct storage_data *stor)
|
|
|
|
|
|
+static void storage_sortitem (struct storage_data *stor)
|
|
{
|
|
{
|
|
nullpo_retv(stor);
|
|
nullpo_retv(stor);
|
|
qsort(stor->items, MAX_STORAGE, sizeof(struct item), storage_comp_item);
|
|
qsort(stor->items, MAX_STORAGE, sizeof(struct item), storage_comp_item);
|
|
}
|
|
}
|
|
|
|
|
|
-void storage_gsortitem (struct guild_storage* gstor)
|
|
|
|
|
|
+static void storage_gsortitem (struct guild_storage* gstor)
|
|
{
|
|
{
|
|
nullpo_retv(gstor);
|
|
nullpo_retv(gstor);
|
|
qsort(gstor->storage_, MAX_GUILD_STORAGE, sizeof(struct item), storage_comp_item);
|
|
qsort(gstor->storage_, MAX_GUILD_STORAGE, sizeof(struct item), storage_comp_item);
|
|
@@ -90,7 +90,7 @@ static int storage_reconnect_sub(DBKey key,void *data,va_list ap)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-//Function to be invoked upon server reconnection to char. To save all 'dirty' storages [Skotlex
|
|
|
|
|
|
+//Function to be invoked upon server reconnection to char. To save all 'dirty' storages [Skotlex]
|
|
void do_reconnect_storage(void)
|
|
void do_reconnect_storage(void)
|
|
{
|
|
{
|
|
storage_db->foreach(storage_db, storage_reconnect_sub, 0);
|
|
storage_db->foreach(storage_db, storage_reconnect_sub, 0);
|
|
@@ -153,7 +153,7 @@ int storage_storageopen(struct map_session_data *sd)
|
|
stor->storage_status = 1;
|
|
stor->storage_status = 1;
|
|
sd->state.storage_flag = 1;
|
|
sd->state.storage_flag = 1;
|
|
clif_storagelist(sd,stor);
|
|
clif_storagelist(sd,stor);
|
|
- clif_updatestorageamount(sd,stor);
|
|
|
|
|
|
+ clif_updatestorageamount(sd,stor->storage_amount);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -175,29 +175,32 @@ int compare_item(struct item *a, struct item *b)
|
|
/*==========================================
|
|
/*==========================================
|
|
* Internal add-item function.
|
|
* Internal add-item function.
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-static int storage_additem(struct map_session_data *sd,struct storage_data *stor,struct item *item_data,int amount)
|
|
|
|
|
|
+static int storage_additem(struct map_session_data* sd, struct storage_data* stor,struct item *item_data,int amount)
|
|
{
|
|
{
|
|
struct item_data *data;
|
|
struct item_data *data;
|
|
int i;
|
|
int i;
|
|
|
|
|
|
- if(item_data->nameid <= 0 || amount <= 0)
|
|
|
|
|
|
+ if( item_data->nameid <= 0 || amount <= 0 )
|
|
return 1;
|
|
return 1;
|
|
|
|
|
|
data = itemdb_search(item_data->nameid);
|
|
data = itemdb_search(item_data->nameid);
|
|
|
|
|
|
- if (!itemdb_canstore(item_data, pc_isGM(sd)))
|
|
|
|
|
|
+ if( !itemdb_canstore(item_data, pc_isGM(sd)) )
|
|
{ //Check if item is storable. [Skotlex]
|
|
{ //Check if item is storable. [Skotlex]
|
|
clif_displaymessage (sd->fd, msg_txt(264));
|
|
clif_displaymessage (sd->fd, msg_txt(264));
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
|
|
- if(itemdb_isstackable2(data)){ //Stackable
|
|
|
|
- for(i=0;i<MAX_STORAGE;i++){
|
|
|
|
- if( compare_item (&stor->items[i], item_data)) {
|
|
|
|
- if(amount > MAX_AMOUNT - stor->items[i].amount)
|
|
|
|
|
|
+ if( itemdb_isstackable2(data) )
|
|
|
|
+ {//Stackable
|
|
|
|
+ for( i = 0; i < MAX_STORAGE; i++ )
|
|
|
|
+ {
|
|
|
|
+ if( compare_item (&stor->items[i], item_data))
|
|
|
|
+ {// existing items found, stack them
|
|
|
|
+ if( amount > MAX_AMOUNT - stor->items[i].amount )
|
|
return 1;
|
|
return 1;
|
|
stor->items[i].amount+=amount;
|
|
stor->items[i].amount+=amount;
|
|
- clif_storageitemadded(sd,stor,i,amount);
|
|
|
|
|
|
+ clif_storageitemadded(sd,&stor->items[i],i,amount);
|
|
stor->dirty = 1;
|
|
stor->dirty = 1;
|
|
if(log_config.enable_logs&0x800)
|
|
if(log_config.enable_logs&0x800)
|
|
log_pick_pc(sd, "R", item_data->nameid, -amount, item_data);
|
|
log_pick_pc(sd, "R", item_data->nameid, -amount, item_data);
|
|
@@ -205,69 +208,73 @@ static int storage_additem(struct map_session_data *sd,struct storage_data *stor
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //Add item
|
|
|
|
- for(i=0;i<MAX_STORAGE && stor->items[i].nameid;i++);
|
|
|
|
-
|
|
|
|
- if(i>=MAX_STORAGE)
|
|
|
|
|
|
+
|
|
|
|
+ // find free slot
|
|
|
|
+ ARR_FIND( 0, MAX_STORAGE, i, stor->items[i].nameid == 0 );
|
|
|
|
+ if( i >= MAX_STORAGE )
|
|
return 1;
|
|
return 1;
|
|
|
|
|
|
|
|
+ // add item to slot
|
|
memcpy(&stor->items[i],item_data,sizeof(stor->items[0]));
|
|
memcpy(&stor->items[i],item_data,sizeof(stor->items[0]));
|
|
stor->items[i].amount=amount;
|
|
stor->items[i].amount=amount;
|
|
stor->storage_amount++;
|
|
stor->storage_amount++;
|
|
- clif_storageitemadded(sd,stor,i,amount);
|
|
|
|
- clif_updatestorageamount(sd,stor);
|
|
|
|
|
|
+ clif_storageitemadded(sd,&stor->items[i],i,amount);
|
|
|
|
+ clif_updatestorageamount(sd,stor->storage_amount);
|
|
stor->dirty = 1;
|
|
stor->dirty = 1;
|
|
if(log_config.enable_logs&0x800)
|
|
if(log_config.enable_logs&0x800)
|
|
log_pick_pc(sd, "R", item_data->nameid, -amount, item_data);
|
|
log_pick_pc(sd, "R", item_data->nameid, -amount, item_data);
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
+
|
|
/*==========================================
|
|
/*==========================================
|
|
* Internal del-item function
|
|
* Internal del-item function
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-static int storage_delitem(struct map_session_data *sd,struct storage_data *stor,int n,int amount)
|
|
|
|
|
|
+static int storage_delitem(struct map_session_data* sd, struct storage_data* stor, int n, int amount)
|
|
{
|
|
{
|
|
-
|
|
|
|
- if(stor->items[n].nameid==0 || stor->items[n].amount<amount)
|
|
|
|
|
|
+ if( stor->items[n].nameid == 0 || stor->items[n].amount < amount )
|
|
return 1;
|
|
return 1;
|
|
|
|
|
|
- stor->items[n].amount-=amount;
|
|
|
|
- if(log_config.enable_logs&0x800)
|
|
|
|
|
|
+ stor->items[n].amount -= amount;
|
|
|
|
+
|
|
|
|
+ if( log_config.enable_logs&0x800 )
|
|
log_pick_pc(sd, "R", stor->items[n].nameid, amount, &stor->items[n]);
|
|
log_pick_pc(sd, "R", stor->items[n].nameid, amount, &stor->items[n]);
|
|
- if(stor->items[n].amount==0){
|
|
|
|
|
|
+
|
|
|
|
+ if( stor->items[n].amount == 0 )
|
|
|
|
+ {
|
|
memset(&stor->items[n],0,sizeof(stor->items[0]));
|
|
memset(&stor->items[n],0,sizeof(stor->items[0]));
|
|
stor->storage_amount--;
|
|
stor->storage_amount--;
|
|
- clif_updatestorageamount(sd,stor);
|
|
|
|
|
|
+ clif_updatestorageamount(sd,stor->storage_amount);
|
|
}
|
|
}
|
|
clif_storageitemremoved(sd,n,amount);
|
|
clif_storageitemremoved(sd,n,amount);
|
|
|
|
|
|
stor->dirty = 1;
|
|
stor->dirty = 1;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
+
|
|
/*==========================================
|
|
/*==========================================
|
|
* Add an item to the storage from the inventory.
|
|
* Add an item to the storage from the inventory.
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-int storage_storageadd(struct map_session_data *sd,int index,int amount)
|
|
|
|
|
|
+int storage_storageadd(struct map_session_data* sd, int index, int amount)
|
|
{
|
|
{
|
|
struct storage_data *stor;
|
|
struct storage_data *stor;
|
|
|
|
|
|
nullpo_retr(0, sd);
|
|
nullpo_retr(0, sd);
|
|
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
|
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
|
|
|
|
|
- if((stor->storage_amount > MAX_STORAGE) || !stor->storage_status)
|
|
|
|
|
|
+ if( stor->storage_amount > MAX_STORAGE || !stor->storage_status )
|
|
return 0; // storage full / storage closed
|
|
return 0; // storage full / storage closed
|
|
|
|
|
|
- if(index<0 || index>=MAX_INVENTORY)
|
|
|
|
|
|
+ if( index < 0 || index >= MAX_INVENTORY )
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
- if(sd->status.inventory[index].nameid <= 0)
|
|
|
|
|
|
+ if( sd->status.inventory[index].nameid <= 0 )
|
|
return 0; //No item on that spot
|
|
return 0; //No item on that spot
|
|
|
|
|
|
- if(amount < 1 || amount > sd->status.inventory[index].amount)
|
|
|
|
|
|
+ if( amount < 1 || amount > sd->status.inventory[index].amount )
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
-// log_tostorage(sd, index, 0);
|
|
|
|
- if(storage_additem(sd,stor,&sd->status.inventory[index],amount)==0)
|
|
|
|
- // remove item from inventory
|
|
|
|
|
|
+ if( storage_additem(sd,stor,&sd->status.inventory[index],amount) == 0 )
|
|
pc_delitem(sd,index,amount,0);
|
|
pc_delitem(sd,index,amount,0);
|
|
|
|
|
|
return 1;
|
|
return 1;
|
|
@@ -276,7 +283,7 @@ int storage_storageadd(struct map_session_data *sd,int index,int amount)
|
|
/*==========================================
|
|
/*==========================================
|
|
* Retrieve an item from the storage.
|
|
* Retrieve an item from the storage.
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-int storage_storageget(struct map_session_data *sd,int index,int amount)
|
|
|
|
|
|
+int storage_storageget(struct map_session_data* sd, int index, int amount)
|
|
{
|
|
{
|
|
struct storage_data *stor;
|
|
struct storage_data *stor;
|
|
int flag;
|
|
int flag;
|
|
@@ -285,45 +292,46 @@ int storage_storageget(struct map_session_data *sd,int index,int amount)
|
|
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
|
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
|
|
|
|
|
|
|
|
|
- if(index<0 || index>=MAX_STORAGE)
|
|
|
|
|
|
+ if( index < 0 || index >= MAX_STORAGE )
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
- if(stor->items[index].nameid <= 0)
|
|
|
|
|
|
+ if( stor->items[index].nameid <= 0 )
|
|
return 0; //Nothing there
|
|
return 0; //Nothing there
|
|
|
|
|
|
- if(amount < 1 || amount > stor->items[index].amount)
|
|
|
|
|
|
+ if( amount < 1 || amount > stor->items[index].amount )
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
- if((flag = pc_additem(sd,&stor->items[index],amount)) == 0)
|
|
|
|
|
|
+ if( (flag = pc_additem(sd,&stor->items[index],amount)) == 0 )
|
|
storage_delitem(sd,stor,index,amount);
|
|
storage_delitem(sd,stor,index,amount);
|
|
else
|
|
else
|
|
clif_additem(sd,0,0,flag);
|
|
clif_additem(sd,0,0,flag);
|
|
-// log_fromstorage(sd, index, 0);
|
|
|
|
|
|
+
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
+
|
|
/*==========================================
|
|
/*==========================================
|
|
* Move an item from cart to storage.
|
|
* Move an item from cart to storage.
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-int storage_storageaddfromcart(struct map_session_data *sd,int index,int amount)
|
|
|
|
|
|
+int storage_storageaddfromcart(struct map_session_data* sd, int index, int amount)
|
|
{
|
|
{
|
|
struct storage_data *stor;
|
|
struct storage_data *stor;
|
|
|
|
|
|
nullpo_retr(0, sd);
|
|
nullpo_retr(0, sd);
|
|
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
|
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
|
|
|
|
|
- if(stor->storage_amount > MAX_STORAGE || !stor->storage_status)
|
|
|
|
|
|
+ if( stor->storage_amount > MAX_STORAGE || !stor->storage_status )
|
|
return 0; // storage full / storage closed
|
|
return 0; // storage full / storage closed
|
|
|
|
|
|
- if(index< 0 || index>=MAX_CART)
|
|
|
|
|
|
+ if( index < 0 || index >= MAX_CART )
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
- if(sd->status.cart[index].nameid <= 0)
|
|
|
|
|
|
+ if( sd->status.cart[index].nameid <= 0 )
|
|
return 0; //No item there.
|
|
return 0; //No item there.
|
|
|
|
|
|
- if(amount < 1 || amount > sd->status.cart[index].amount)
|
|
|
|
|
|
+ if( amount < 1 || amount > sd->status.cart[index].amount )
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
- if(storage_additem(sd,stor,&sd->status.cart[index],amount)==0)
|
|
|
|
|
|
+ if( storage_additem(sd,stor,&sd->status.cart[index],amount) == 0 )
|
|
pc_cart_delitem(sd,index,amount,0);
|
|
pc_cart_delitem(sd,index,amount,0);
|
|
|
|
|
|
return 1;
|
|
return 1;
|
|
@@ -332,26 +340,26 @@ int storage_storageaddfromcart(struct map_session_data *sd,int index,int amount)
|
|
/*==========================================
|
|
/*==========================================
|
|
* Get from Storage to the Cart
|
|
* Get from Storage to the Cart
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-int storage_storagegettocart(struct map_session_data *sd,int index,int amount)
|
|
|
|
|
|
+int storage_storagegettocart(struct map_session_data* sd, int index, int amount)
|
|
{
|
|
{
|
|
struct storage_data *stor;
|
|
struct storage_data *stor;
|
|
|
|
|
|
nullpo_retr(0, sd);
|
|
nullpo_retr(0, sd);
|
|
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
|
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
|
|
|
|
|
- if(!stor->storage_status)
|
|
|
|
|
|
+ if( !stor->storage_status )
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
- if(index< 0 || index>=MAX_STORAGE)
|
|
|
|
|
|
+ if( index < 0 || index >= MAX_STORAGE )
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
- if(stor->items[index].nameid <= 0)
|
|
|
|
|
|
+ if( stor->items[index].nameid <= 0 )
|
|
return 0; //Nothing there.
|
|
return 0; //Nothing there.
|
|
|
|
|
|
- if(amount < 1 || amount > stor->items[index].amount)
|
|
|
|
|
|
+ if( amount < 1 || amount > stor->items[index].amount )
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
- if(pc_cart_additem(sd,&stor->items[index],amount)==0)
|
|
|
|
|
|
+ if( pc_cart_additem(sd,&stor->items[index],amount) == 0 )
|
|
storage_delitem(sd,stor,index,amount);
|
|
storage_delitem(sd,stor,index,amount);
|
|
|
|
|
|
return 1;
|
|
return 1;
|
|
@@ -361,7 +369,7 @@ int storage_storagegettocart(struct map_session_data *sd,int index,int amount)
|
|
/*==========================================
|
|
/*==========================================
|
|
* Modified By Valaris to save upon closing [massdriller]
|
|
* Modified By Valaris to save upon closing [massdriller]
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-int storage_storageclose(struct map_session_data *sd)
|
|
|
|
|
|
+int storage_storageclose(struct map_session_data* sd)
|
|
{
|
|
{
|
|
struct storage_data *stor;
|
|
struct storage_data *stor;
|
|
|
|
|
|
@@ -376,22 +384,23 @@ int storage_storageclose(struct map_session_data *sd)
|
|
else
|
|
else
|
|
storage_storage_save(sd->status.account_id, 0);
|
|
storage_storage_save(sd->status.account_id, 0);
|
|
}
|
|
}
|
|
- stor->storage_status=0;
|
|
|
|
- sd->state.storage_flag=0;
|
|
|
|
|
|
+ stor->storage_status = 0;
|
|
|
|
+ sd->state.storage_flag = 0;
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
/*==========================================
|
|
/*==========================================
|
|
* When quitting the game.
|
|
* When quitting the game.
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-int storage_storage_quit(struct map_session_data *sd, int flag)
|
|
|
|
|
|
+int storage_storage_quit(struct map_session_data* sd, int flag)
|
|
{
|
|
{
|
|
struct storage_data *stor;
|
|
struct storage_data *stor;
|
|
|
|
|
|
nullpo_retr(0, sd);
|
|
nullpo_retr(0, sd);
|
|
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
|
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
|
|
|
|
|
- if (stor->storage_status)
|
|
|
|
|
|
+ if( stor->storage_status )
|
|
{
|
|
{
|
|
if (save_settings&4)
|
|
if (save_settings&4)
|
|
chrif_save(sd, flag); //Invokes the storage saving as well.
|
|
chrif_save(sd, flag); //Invokes the storage saving as well.
|
|
@@ -400,10 +409,11 @@ int storage_storage_quit(struct map_session_data *sd, int flag)
|
|
}
|
|
}
|
|
stor->storage_status = 0;
|
|
stor->storage_status = 0;
|
|
sd->state.storage_flag = 0;
|
|
sd->state.storage_flag = 0;
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-void storage_storage_dirty(struct map_session_data *sd)
|
|
|
|
|
|
+void storage_storage_dirty(struct map_session_data* sd)
|
|
{
|
|
{
|
|
struct storage_data *stor;
|
|
struct storage_data *stor;
|
|
|
|
|
|
@@ -487,7 +497,7 @@ int guild_storage_delete(int guild_id)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-int storage_guild_storageopen(struct map_session_data *sd)
|
|
|
|
|
|
+int storage_guild_storageopen(struct map_session_data* sd)
|
|
{
|
|
{
|
|
struct guild_storage *gstor;
|
|
struct guild_storage *gstor;
|
|
|
|
|
|
@@ -514,11 +524,11 @@ int storage_guild_storageopen(struct map_session_data *sd)
|
|
gstor->storage_status = 1;
|
|
gstor->storage_status = 1;
|
|
sd->state.storage_flag = 2;
|
|
sd->state.storage_flag = 2;
|
|
clif_guildstoragelist(sd,gstor);
|
|
clif_guildstoragelist(sd,gstor);
|
|
- clif_updateguildstorageamount(sd,gstor);
|
|
|
|
|
|
+ clif_updateguildstorageamount(sd,gstor->storage_amount);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-int guild_storage_additem(struct map_session_data *sd,struct guild_storage *stor,struct item *item_data,int amount)
|
|
|
|
|
|
+int guild_storage_additem(struct map_session_data* sd, struct guild_storage* stor, struct item* item_data, int amount)
|
|
{
|
|
{
|
|
struct item_data *data;
|
|
struct item_data *data;
|
|
int i;
|
|
int i;
|
|
@@ -543,7 +553,7 @@ int guild_storage_additem(struct map_session_data *sd,struct guild_storage *stor
|
|
if(stor->storage_[i].amount+amount > MAX_AMOUNT)
|
|
if(stor->storage_[i].amount+amount > MAX_AMOUNT)
|
|
return 1;
|
|
return 1;
|
|
stor->storage_[i].amount+=amount;
|
|
stor->storage_[i].amount+=amount;
|
|
- clif_guildstorageitemadded(sd,stor,i,amount);
|
|
|
|
|
|
+ clif_guildstorageitemadded(sd,&stor->storage_[i],i,amount);
|
|
stor->dirty = 1;
|
|
stor->dirty = 1;
|
|
if(log_config.enable_logs&0x1000)
|
|
if(log_config.enable_logs&0x1000)
|
|
log_pick_pc(sd, "G", item_data->nameid, -amount, item_data);
|
|
log_pick_pc(sd, "G", item_data->nameid, -amount, item_data);
|
|
@@ -560,15 +570,15 @@ int guild_storage_additem(struct map_session_data *sd,struct guild_storage *stor
|
|
memcpy(&stor->storage_[i],item_data,sizeof(stor->storage_[0]));
|
|
memcpy(&stor->storage_[i],item_data,sizeof(stor->storage_[0]));
|
|
stor->storage_[i].amount=amount;
|
|
stor->storage_[i].amount=amount;
|
|
stor->storage_amount++;
|
|
stor->storage_amount++;
|
|
- clif_guildstorageitemadded(sd,stor,i,amount);
|
|
|
|
- clif_updateguildstorageamount(sd,stor);
|
|
|
|
|
|
+ clif_guildstorageitemadded(sd,&stor->storage_[i],i,amount);
|
|
|
|
+ clif_updateguildstorageamount(sd,stor->storage_amount);
|
|
stor->dirty = 1;
|
|
stor->dirty = 1;
|
|
if(log_config.enable_logs&0x1000)
|
|
if(log_config.enable_logs&0x1000)
|
|
log_pick_pc(sd, "G", item_data->nameid, -amount, item_data);
|
|
log_pick_pc(sd, "G", item_data->nameid, -amount, item_data);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-int guild_storage_delitem(struct map_session_data *sd,struct guild_storage *stor,int n,int amount)
|
|
|
|
|
|
+int guild_storage_delitem(struct map_session_data* sd, struct guild_storage* stor, int n, int amount)
|
|
{
|
|
{
|
|
nullpo_retr(1, sd);
|
|
nullpo_retr(1, sd);
|
|
nullpo_retr(1, stor);
|
|
nullpo_retr(1, stor);
|
|
@@ -582,14 +592,14 @@ int guild_storage_delitem(struct map_session_data *sd,struct guild_storage *stor
|
|
if(stor->storage_[n].amount==0){
|
|
if(stor->storage_[n].amount==0){
|
|
memset(&stor->storage_[n],0,sizeof(stor->storage_[0]));
|
|
memset(&stor->storage_[n],0,sizeof(stor->storage_[0]));
|
|
stor->storage_amount--;
|
|
stor->storage_amount--;
|
|
- clif_updateguildstorageamount(sd,stor);
|
|
|
|
|
|
+ clif_updateguildstorageamount(sd,stor->storage_amount);
|
|
}
|
|
}
|
|
clif_storageitemremoved(sd,n,amount);
|
|
clif_storageitemremoved(sd,n,amount);
|
|
stor->dirty = 1;
|
|
stor->dirty = 1;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-int storage_guild_storageadd(struct map_session_data *sd,int index,int amount)
|
|
|
|
|
|
+int storage_guild_storageadd(struct map_session_data* sd, int index, int amount)
|
|
{
|
|
{
|
|
struct guild_storage *stor;
|
|
struct guild_storage *stor;
|
|
|
|
|
|
@@ -615,7 +625,7 @@ int storage_guild_storageadd(struct map_session_data *sd,int index,int amount)
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
|
|
-int storage_guild_storageget(struct map_session_data *sd,int index,int amount)
|
|
|
|
|
|
+int storage_guild_storageget(struct map_session_data* sd, int index, int amount)
|
|
{
|
|
{
|
|
struct guild_storage *stor;
|
|
struct guild_storage *stor;
|
|
int flag;
|
|
int flag;
|
|
@@ -644,7 +654,7 @@ int storage_guild_storageget(struct map_session_data *sd,int index,int amount)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-int storage_guild_storageaddfromcart(struct map_session_data *sd,int index,int amount)
|
|
|
|
|
|
+int storage_guild_storageaddfromcart(struct map_session_data* sd, int index, int amount)
|
|
{
|
|
{
|
|
struct guild_storage *stor;
|
|
struct guild_storage *stor;
|
|
|
|
|
|
@@ -669,7 +679,7 @@ int storage_guild_storageaddfromcart(struct map_session_data *sd,int index,int a
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
|
|
-int storage_guild_storagegettocart(struct map_session_data *sd,int index,int amount)
|
|
|
|
|
|
+int storage_guild_storagegettocart(struct map_session_data* sd, int index, int amount)
|
|
{
|
|
{
|
|
struct guild_storage *stor;
|
|
struct guild_storage *stor;
|
|
|
|
|
|
@@ -724,7 +734,7 @@ int storage_guild_storagesaved(int guild_id)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-int storage_guild_storageclose(struct map_session_data *sd)
|
|
|
|
|
|
+int storage_guild_storageclose(struct map_session_data* sd)
|
|
{
|
|
{
|
|
struct guild_storage *stor;
|
|
struct guild_storage *stor;
|
|
|
|
|
|
@@ -745,7 +755,7 @@ int storage_guild_storageclose(struct map_session_data *sd)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-int storage_guild_storage_quit(struct map_session_data *sd,int flag)
|
|
|
|
|
|
+int storage_guild_storage_quit(struct map_session_data* sd, int flag)
|
|
{
|
|
{
|
|
struct guild_storage *stor;
|
|
struct guild_storage *stor;
|
|
|
|
|