update
git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@601 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
ca2de30c5e
commit
c0842106f9
@ -1,4 +1,13 @@
|
||||
Date Added
|
||||
12/18
|
||||
* Added concept of dirty storage to reduce saves/load
|
||||
to the char server (do a clean build!) [MouseJstr]
|
||||
* Eliminated storage_storageopen2 as unused [MouseJstr]
|
||||
* Switched to account2storage2() whenever possible
|
||||
to eliminate the possibility of saving empty storage
|
||||
back to the character server (storage wipes) [MouseJstr]
|
||||
* Made it save storage as soon as you close the storage
|
||||
window to reduce possibility of loss/abuse [MouseJstr]
|
||||
12/17
|
||||
* Added #item [MC Cameri]
|
||||
* Added #storagelist, removed @charstoragelist [MC Cameri]
|
||||
|
@ -152,6 +152,7 @@ struct mmo_charstatus {
|
||||
};
|
||||
|
||||
struct storage {
|
||||
int dirty;
|
||||
int account_id;
|
||||
short storage_status;
|
||||
short storage_amount;
|
||||
|
@ -731,6 +731,7 @@ int intif_parse_LoadStorage(int fd) {
|
||||
if(battle_config.save_log)
|
||||
printf("intif_openstorage: %d\n",RFIFOL(fd,4) );
|
||||
memcpy(stor,RFIFOP(fd,8),sizeof(struct storage));
|
||||
stor->dirty=0;
|
||||
stor->storage_status=1;
|
||||
sd->state.storage_flag = 0;
|
||||
clif_storageitemlist(sd,stor);
|
||||
|
@ -121,25 +121,6 @@ int storage_storageopen(struct map_session_data *sd)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int storage_storageopen2(struct map_session_data *sd, struct map_session_data *pl_sd)
|
||||
{
|
||||
struct storage *stor;
|
||||
if(sd == NULL || pl_sd == NULL)
|
||||
{
|
||||
printf("storage_storageopen nullpo\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if((stor = numdb_search(storage_db,pl_sd->status.account_id)) != NULL)
|
||||
{
|
||||
clif_storageitemlist(sd,stor);
|
||||
clif_storageequiplist(sd,stor);
|
||||
clif_updatestorageamount(sd,stor);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* カプラ倉庫へアイテム追加
|
||||
*------------------------------------------
|
||||
@ -187,6 +168,8 @@ int storage_additem(struct map_session_data *sd,struct storage *stor,struct item
|
||||
if(i>=MAX_STORAGE)
|
||||
return 1;
|
||||
}
|
||||
|
||||
stor->dirty = 1;
|
||||
return 0;
|
||||
}
|
||||
/*==========================================
|
||||
@ -209,6 +192,8 @@ int storage_delitem(struct map_session_data *sd,struct storage *stor,int n,int a
|
||||
}
|
||||
clif_storageitemremoved(sd,n,amount);
|
||||
|
||||
stor->dirty = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*==========================================
|
||||
@ -220,7 +205,7 @@ int storage_storageadd(struct map_session_data *sd,int index,int amount)
|
||||
struct storage *stor;
|
||||
|
||||
nullpo_retr(0, sd);
|
||||
nullpo_retr(0, stor=account2storage(sd->status.account_id));
|
||||
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
||||
|
||||
if( (stor->storage_amount <= MAX_STORAGE) && (stor->storage_status == 1) ) { // storage not full & storage open
|
||||
if(index>=0 && index<MAX_INVENTORY) { // valid index
|
||||
@ -245,7 +230,7 @@ int storage_storageget(struct map_session_data *sd,int index,int amount)
|
||||
int flag;
|
||||
|
||||
nullpo_retr(0, sd);
|
||||
nullpo_retr(0, stor=account2storage(sd->status.account_id));
|
||||
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
||||
|
||||
if(stor->storage_status == 1) { // storage open
|
||||
if(index>=0 && index<MAX_STORAGE) { // valid index
|
||||
@ -269,7 +254,7 @@ int storage_storageaddfromcart(struct map_session_data *sd,int index,int amount)
|
||||
struct storage *stor;
|
||||
|
||||
nullpo_retr(0, sd);
|
||||
nullpo_retr(0, stor=account2storage(sd->status.account_id));
|
||||
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
||||
|
||||
if( (stor->storage_amount <= MAX_STORAGE) && (stor->storage_status == 1) ) { // storage not full & storage open
|
||||
if(index>=0 && index<MAX_INVENTORY) { // valid index
|
||||
@ -292,7 +277,7 @@ int storage_storagegettocart(struct map_session_data *sd,int index,int amount)
|
||||
struct storage *stor;
|
||||
|
||||
nullpo_retr(0, sd);
|
||||
nullpo_retr(0, stor=account2storage(sd->status.account_id));
|
||||
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
||||
|
||||
if(stor->storage_status == 1) { // storage open
|
||||
if(index>=0 && index<MAX_STORAGE) { // valid index
|
||||
@ -317,12 +302,14 @@ int storage_storageclose(struct map_session_data *sd)
|
||||
struct storage *stor;
|
||||
|
||||
nullpo_retr(0, sd);
|
||||
nullpo_retr(0, stor=account2storage(sd->status.account_id));
|
||||
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
||||
|
||||
stor->storage_status=0;
|
||||
sd->state.storage_flag = 0;
|
||||
clif_storageclose(sd);
|
||||
|
||||
storage_storage_save(sd);
|
||||
|
||||
sortage_sortitem(stor);
|
||||
return 0;
|
||||
}
|
||||
@ -338,7 +325,10 @@ int storage_storage_quit(struct map_session_data *sd)
|
||||
nullpo_retr(0, sd);
|
||||
|
||||
stor = numdb_search(storage_db,sd->status.account_id);
|
||||
if(stor) stor->storage_status = 0;
|
||||
if(stor) {
|
||||
stor->storage_status = 0;
|
||||
storage_storage_save(sd);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -350,7 +340,10 @@ int storage_storage_save(struct map_session_data *sd)
|
||||
nullpo_retr(0, sd);
|
||||
|
||||
stor=numdb_search(storage_db,sd->status.account_id);
|
||||
if(stor) intif_send_storage(stor);
|
||||
if(stor && stor->dirty) {
|
||||
intif_send_storage(stor);
|
||||
stor->dirty = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "mmo.h"
|
||||
|
||||
int storage_storageopen(struct map_session_data *sd);
|
||||
int storage_storageopen2(struct map_session_data *sd,struct map_session_data *pl_sd);
|
||||
int storage_storageadd(struct map_session_data *sd,int index,int amount);
|
||||
int storage_storageget(struct map_session_data *sd,int index,int amount);
|
||||
int storage_storageaddfromcart(struct map_session_data *sd,int index,int amount);
|
||||
|
Loading…
x
Reference in New Issue
Block a user