summaryrefslogtreecommitdiff
path: root/src/map/storage.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-02 13:46:11 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-02 13:46:11 +0000
commit37cc17c1b9a2dd29e1623a46cfc332e1aeb76751 (patch)
tree6f8dd05942422f043ef2df9e9364dd954a826bb3 /src/map/storage.c
parent5758d3649f0bf74677b3f470acb4e17a98910100 (diff)
downloadhercules-37cc17c1b9a2dd29e1623a46cfc332e1aeb76751.tar.gz
hercules-37cc17c1b9a2dd29e1623a46cfc332e1aeb76751.tar.bz2
hercules-37cc17c1b9a2dd29e1623a46cfc332e1aeb76751.tar.xz
hercules-37cc17c1b9a2dd29e1623a46cfc332e1aeb76751.zip
* Some source code cleaning
- Fixed the badly worded messages during mapserver startup - Cleaned up socket config reading - Split resolve_hostbyname() into 2 separate functions for clarity - Moved the probably obsolete LOWER/UPPER macros to db.c (TODO: remove) - Moved the badly placed compare_item() function to storage.c (see r779) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10119 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/storage.c')
-rw-r--r--src/map/storage.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/map/storage.c b/src/map/storage.c
index 4d652903b..12d5b5696 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -41,13 +41,13 @@ int storage_comp_item(const void *_i1, const void *_i2)
return i1->nameid - i2->nameid;
}
-void sortage_sortitem (struct storage *stor)
+void storage_sortitem (struct storage *stor)
{
nullpo_retv(stor);
qsort(stor->storage_, MAX_STORAGE, sizeof(struct item), storage_comp_item);
}
-void sortage_gsortitem (struct guild_storage* gstor)
+void storage_gsortitem (struct guild_storage* gstor)
{
nullpo_retv(gstor);
qsort(gstor->storage_, MAX_GUILD_STORAGE, sizeof(struct item), storage_comp_item);
@@ -158,6 +158,21 @@ int storage_storageopen(struct map_session_data *sd)
return 0;
}
+// helper function
+int compare_item(struct item *a, struct item *b) {
+
+ if (a->nameid == b->nameid &&
+ a->identify == b->identify &&
+ a->refine == b->refine &&
+ a->attribute == b->attribute)
+ {
+ int i;
+ for (i = 0; i < MAX_SLOTS && (a->card[i] == b->card[i]); i++);
+ return (i == MAX_SLOTS);
+ }
+ return 0;
+}
+
/*==========================================
* Internal add-item function.
*------------------------------------------
@@ -452,7 +467,7 @@ int storage_storage_saved(int account_id)
if (stor->dirty && stor->storage_status == 0)
{ //Only mark it clean if it's not in use. [Skotlex]
stor->dirty = 0;
- sortage_sortitem(stor);
+ storage_sortitem(stor);
return 1;
}
return 0;
@@ -716,7 +731,7 @@ int storage_guild_storagesaved(int guild_id)
if (stor->dirty && stor->storage_status == 0)
{ //Storage has been correctly saved.
stor->dirty = 0;
- sortage_gsortitem(stor);
+ storage_gsortitem(stor);
}
return 1;
}