summaryrefslogtreecommitdiff
path: root/src/map/storage.c
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-12-18 15:20:31 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-12-18 15:20:31 +0000
commit9d7d036456ad886c3a60aa73c4db37822923bf60 (patch)
tree24da1b6036d6015426ffd8b55604f86115c3c569 /src/map/storage.c
parent2ce4ea3324da64930c77076194e2e8b2b8ab2e49 (diff)
downloadhercules-9d7d036456ad886c3a60aa73c4db37822923bf60.tar.gz
hercules-9d7d036456ad886c3a60aa73c4db37822923bf60.tar.bz2
hercules-9d7d036456ad886c3a60aa73c4db37822923bf60.tar.xz
hercules-9d7d036456ad886c3a60aa73c4db37822923bf60.zip
* Fixed character storage no longer being sorted (bugreport:1982, since r12950).
- Guild storage is now sorted before being displayed rather than after being saved... - Merged storage_gsortitem into storage_sortitem. - Added option 'client_sort_storage' to control storage sorting. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14605 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/storage.c')
-rw-r--r--src/map/storage.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/map/storage.c b/src/map/storage.c
index 2e668f08d..e2749bfd9 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -42,17 +42,15 @@ static int storage_comp_item(const void *_i1, const void *_i2)
return -1;
return i1->nameid - i2->nameid;
}
-/* In case someone wants to use it in the future.
-static void storage_sortitem(struct storage_data* stor)
-{
- nullpo_retv(stor);
- qsort(stor->items, MAX_STORAGE, sizeof(struct item), storage_comp_item);
-}
-*/
-static void storage_gsortitem(struct guild_storage* gstor)
+
+static void storage_sortitem(struct item* items, unsigned int size)
{
- nullpo_retv(gstor);
- qsort(gstor->storage_, MAX_GUILD_STORAGE, sizeof(struct item), storage_comp_item);
+ nullpo_retv(items);
+
+ if( battle_config.client_sort_storage )
+ {
+ qsort(items, size, sizeof(struct item), storage_comp_item);
+ }
}
/*==========================================
@@ -104,6 +102,7 @@ int storage_storageopen(struct map_session_data *sd)
}
sd->state.storage_flag = 1;
+ storage_sortitem(sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items));
clif_storagelist(sd, sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items));
clif_updatestorageamount(sd,sd->status.storage.storage_amount);
return 0;
@@ -380,6 +379,7 @@ int storage_guild_storageopen(struct map_session_data* sd)
gstor->storage_status = 1;
sd->state.storage_flag = 2;
+ storage_sortitem(gstor->storage_, ARRAYLENGTH(gstor->storage_));
clif_storagelist(sd, gstor->storage_, ARRAYLENGTH(gstor->storage_));
clif_updateguildstorageamount(sd,gstor->storage_amount);
return 0;
@@ -584,7 +584,6 @@ int storage_guild_storagesaved(int guild_id)
if (stor->dirty && stor->storage_status == 0)
{ //Storage has been correctly saved.
stor->dirty = 0;
- storage_gsortitem(stor);
}
return 1;
}