diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-06-27 14:54:01 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-06-27 14:54:01 +0000 |
commit | 036bbfd9ae5a4a77031fb33a87264e58214c2ba0 (patch) | |
tree | 7df6db240c83ab4c0e7b5733dee337c0583010b8 /src/map/storage.c | |
parent | f68366250c523440b972616f61577edfe6d51c04 (diff) | |
download | hercules-036bbfd9ae5a4a77031fb33a87264e58214c2ba0.tar.gz hercules-036bbfd9ae5a4a77031fb33a87264e58214c2ba0.tar.bz2 hercules-036bbfd9ae5a4a77031fb33a87264e58214c2ba0.tar.xz hercules-036bbfd9ae5a4a77031fb33a87264e58214c2ba0.zip |
- Fixed indentation on int_pet.c (how did it got messed up?)
- Added mapflag "loadevent", now load-map script events will ONLY trigger on maps with this mapflag on, rather than every map.
- High Jump can now be used in all versus maps.
- Added Kaite's opt3 value, taken from jA
- Added state dirty == 2 to storages. Signals when a storage was sent for final saving. Said storage is removed from memory after the ack from the char-server, and they are sent to save if the map/char servers reconnect before the act arrives. In short: they are guaranteed to be saved after a char logs out.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7358 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/storage.c')
-rw-r--r-- | src/map/storage.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/map/storage.c b/src/map/storage.c index c420795a1..211bdb9ec 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -82,7 +82,7 @@ static int storage_reconnect_sub(DBKey key,void *data,va_list ap) { //Account Storage
struct storage* stor = (struct storage*) data;
if (stor->dirty && stor->storage_status == 0) //Save closed storages.
- storage_storage_save(stor->account_id);
+ storage_storage_save(stor->account_id, stor->dirty==2?1:0);
}
return 0;
}
@@ -390,16 +390,27 @@ void storage_storage_dirty(struct map_session_data *sd) stor->dirty = 1;
}
-int storage_storage_save(int account_id)
+int storage_storage_save(int account_id, int final)
{
struct storage *stor;
stor=account2storage2(account_id);
- if(stor && stor->dirty)
+ if(!stor) return 0;
+
+ if(stor->dirty)
{
+ if (final) {
+ stor->dirty = 2;
+ stor->storage_status = 0; //To prevent further manipulation of it.
+ }
intif_send_storage(stor);
return 1;
}
+ if (final)
+ { //Clear storage from memory. Nothing to save.
+ storage_delete(account_id);
+ return 1;
+ }
return 0;
}
@@ -409,13 +420,19 @@ int storage_storage_saved(int account_id) {
struct storage *stor;
- if((stor=account2storage2(account_id)) != NULL)
+ if((stor=account2storage2(account_id)) == NULL)
+ return 0;
+
+ if (stor->dirty == 2)
+ { //Final save of storage. Remove from memory.
+ storage_delete(account_id);
+ return 1;
+ }
+
+ if (stor->dirty && stor->storage_status == 0)
{ //Only mark it clean if it's not in use. [Skotlex]
- if (stor->dirty && stor->storage_status == 0)
- {
- stor->dirty = 0;
- sortage_sortitem(stor);
- }
+ stor->dirty = 0;
+ sortage_sortitem(stor);
return 1;
}
return 0;
|