From c782ab3c206324ce4e9f92939db5c218f3830476 Mon Sep 17 00:00:00 2001 From: amber Date: Sat, 18 Dec 2004 05:51:46 +0000 Subject: update git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@601 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/intif.c | 1 + src/map/storage.c | 45 +++++++++++++++++++-------------------------- src/map/storage.h | 1 - 3 files changed, 20 insertions(+), 27 deletions(-) (limited to 'src/map') diff --git a/src/map/intif.c b/src/map/intif.c index 66428d13d..cf9d8ccee 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -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); diff --git a/src/map/storage.c b/src/map/storage.c index fc6f63cdd..fcc70845d 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -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 && indexstatus.account_id)); + nullpo_retr(0, stor=account2storage2(sd->status.account_id)); if(stor->storage_status == 1) { // storage open if(index>=0 && indexstatus.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 && indexstatus.account_id)); + nullpo_retr(0, stor=account2storage2(sd->status.account_id)); if(stor->storage_status == 1) { // storage open if(index>=0 && indexstatus.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; } diff --git a/src/map/storage.h b/src/map/storage.h index 352dee4f0..489741c71 100644 --- a/src/map/storage.h +++ b/src/map/storage.h @@ -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); -- cgit v1.2.3-70-g09d2