summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authoramber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-18 05:51:46 +0000
committeramber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-18 05:51:46 +0000
commitc782ab3c206324ce4e9f92939db5c218f3830476 (patch)
tree67395cf55df33f2b0612f8fe4348acb511f6c2cc /src/map
parentb1688563811b869b03e77b9b40424c7f1a06532f (diff)
downloadhercules-c782ab3c206324ce4e9f92939db5c218f3830476.tar.gz
hercules-c782ab3c206324ce4e9f92939db5c218f3830476.tar.bz2
hercules-c782ab3c206324ce4e9f92939db5c218f3830476.tar.xz
hercules-c782ab3c206324ce4e9f92939db5c218f3830476.zip
update
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@601 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/intif.c1
-rw-r--r--src/map/storage.c45
-rw-r--r--src/map/storage.h1
3 files changed, 20 insertions, 27 deletions
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 && 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;
}
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);