From a6c4c6384398a250099c86a1605d63f83f108905 Mon Sep 17 00:00:00 2001
From: shennetsind <ind@henn.et>
Date: Sun, 5 Oct 2014 02:37:50 -0300
Subject: Follow up a46b190764df4cce0b378bc691218ac0814a5673

Dropped id2storage entirely, replaced with idb_get (1) it was redundant 2) the rename on a46b190764df4cce0b378bc691218ac0814a5673 was a very poor choice as plugins using the previous version would be calling the other).

Signed-off-by: shennetsind <ind@henn.et>
---
 src/map/atcommand.c |  2 +-
 src/map/clif.c      |  2 +-
 src/map/guild.c     |  2 +-
 src/map/intif.c     |  4 ++--
 src/map/pc.c        |  4 ++--
 src/map/storage.c   | 24 +++++++++---------------
 src/map/storage.h   |  1 -
 7 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 68278c345..049adf1fc 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -5143,7 +5143,7 @@ ACMD(cleargstorage)
 		return false;
 	}
 	
-	guild_storage = gstorage->id2storage(sd->status.guild_id);
+	guild_storage = idb_get(gstorage->db,sd->status.guild_id);
 	if (guild_storage == NULL) {// Doesn't have opened @gstorage yet, so we skip the deletion since *shouldn't* have any item there.
 		return false;
 	}
diff --git a/src/map/clif.c b/src/map/clif.c
index c0ee298a8..b9b5a8419 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -8443,7 +8443,7 @@ void clif_refresh_storagewindow( struct map_session_data *sd ) {
 	// remain locked forever and nobody will be able to access it
 	if( sd->state.storage_flag == 2 ) {
 		struct guild_storage *gstor;
-		if( (gstor = gstorage->id2storage(sd->status.guild_id)) == NULL) {
+		if( (gstor = idb_get(gstorage->db,sd->status.guild_id)) == NULL) {
 			// Shouldn't happen... The information should already be at the map-server
 			intif->request_guild_storage(sd->status.account_id,sd->status.guild_id);
 		} else {
diff --git a/src/map/guild.c b/src/map/guild.c
index 19cb1ab70..595711755 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -928,7 +928,7 @@ void guild_retrieveitembound(int char_id,int aid,int guild_id) {
 	if(sd){ //Character is online
 		pc->bound_clear(sd,IBT_GUILD);
 	} else { //Character is offline, ask char server to do the job
-		struct guild_storage *gstor = gstorage->id2storage(guild_id);
+		struct guild_storage *gstor = idb_get(gstorage->db,guild_id);
 		if(gstor && gstor->storage_status == 1) { //Someone is in guild storage, close them
 			struct s_mapiterator* iter = mapit_getallusers();
 			for( sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); sd = (TBL_PC*)mapit->next(iter) ) {
diff --git a/src/map/intif.c b/src/map/intif.c
index 59c3c71e8..c20905bcf 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -2165,7 +2165,7 @@ void intif_parse_MessageToFD(int fd) {
  *------------------------------------------*/
 void intif_itembound_req(int char_id,int aid,int guild_id) {
 #ifdef GP_BOUND_ITEMS
-	struct guild_storage *gstor = gstorage->id2storage(guild_id);
+	struct guild_storage *gstor = idb_get(gstorage->db,guild_id);
 	WFIFOHEAD(inter_fd,12);
 	WFIFOW(inter_fd,0) = 0x3056;
 	WFIFOL(inter_fd,2) = char_id;
@@ -2183,7 +2183,7 @@ void intif_parse_Itembound_ack(int fd) {
 	struct guild_storage *gstor;
 	int guild_id = RFIFOW(fd,6);
 
-	gstor = gstorage->id2storage(guild_id);
+	gstor = idb_get(gstorage->db,guild_id);
 	if(gstor)
 		gstor->lock = 0; //Unlock now that operation is completed
 #endif
diff --git a/src/map/pc.c b/src/map/pc.c
index 194ea8264..697a24507 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4728,7 +4728,7 @@ void pc_bound_clear(struct map_session_data *sd, enum e_item_bound_type type) {
 			ShowError("Helllo! You reached pc_bound_clear for IBT_ACCOUNT, unfortunately no scenario was expected for this!\n");
 			break;
 		case IBT_GUILD: {
-				struct guild_storage *gstor = gstorage->id2storage(sd->status.guild_id);
+				struct guild_storage *gstor = idb_get(gstorage->db,sd->status.guild_id);
 				
 				for( i = 0; i < MAX_INVENTORY; i++ ){
 					if(sd->status.inventory[i].bound == type) {
@@ -9212,7 +9212,7 @@ int pc_checkitem(struct map_session_data *sd)
 		}
 		
 		if (sd->guild) {
-			struct guild_storage *guild_storage = gstorage->id2storage(sd->guild->guild_id);
+			struct guild_storage *guild_storage = idb_get(gstorage->db,sd->guild->guild_id);
 			if (guild_storage) {
 				for( i = 0; i < MAX_GUILD_STORAGE; i++ ) {
 					id = guild_storage->items[i].nameid;
diff --git a/src/map/storage.c b/src/map/storage.c
index 2933008e5..523f64cc8 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -359,11 +359,6 @@ struct guild_storage *guild2storage_ensure(int guild_id)
 	return gs;
 }
 
-//For just locating a storage without creating one. [Skotlex]
-struct guild_storage *guild2storage(int guild_id) {
-	return (struct guild_storage*)idb_get(gstorage->db,guild_id);
-}
-
 int guild_storage_delete(int guild_id) {
 	idb_remove(gstorage->db,guild_id);
 	return 0;
@@ -393,7 +388,7 @@ int storage_guild_storageopen(struct map_session_data* sd)
 		return 1;
 	}
 
-	if((gstor = gstorage->id2storage(sd->status.guild_id)) == NULL) {
+	if((gstor = idb_get(gstorage->db,sd->status.guild_id)) == NULL) {
 		intif->request_guild_storage(sd->status.account_id,sd->status.guild_id);
 		return 0;
 	}
@@ -511,7 +506,7 @@ int storage_guild_storageadd(struct map_session_data* sd, int index, int amount)
 	struct guild_storage *stor;
 
 	nullpo_ret(sd);
-	nullpo_ret(stor=gstorage->id2storage(sd->status.guild_id));
+	nullpo_ret(stor=idb_get(gstorage->db,sd->status.guild_id));
 		
 	if( !stor->storage_status || stor->storage_amount > MAX_GUILD_STORAGE )
 		return 0;
@@ -551,7 +546,7 @@ int storage_guild_storageget(struct map_session_data* sd, int index, int amount)
 	int flag;
 
 	nullpo_ret(sd);
-	nullpo_ret(stor=guild2storage2(sd->status.guild_id));
+	nullpo_ret(stor=idb_get(gstorage->db,sd->status.guild_id));
 
 	if(!stor->storage_status)
   		return 0;
@@ -591,7 +586,7 @@ int storage_guild_storageaddfromcart(struct map_session_data* sd, int index, int
 	struct guild_storage *stor;
 
 	nullpo_ret(sd);
-	nullpo_ret(stor=guild2storage2(sd->status.guild_id));
+	nullpo_ret(stor=idb_get(gstorage->db,sd->status.guild_id));
 
 	if( !stor->storage_status || stor->storage_amount > MAX_GUILD_STORAGE )
 		return 0;
@@ -623,7 +618,7 @@ int storage_guild_storagegettocart(struct map_session_data* sd, int index, int a
 	struct guild_storage *stor;
 
 	nullpo_ret(sd);
-	nullpo_ret(stor=guild2storage2(sd->status.guild_id));
+	nullpo_ret(stor=idb_get(gstorage->db,sd->status.guild_id));
 
 	if(!stor->storage_status)
 	  	return 0;
@@ -651,7 +646,7 @@ int storage_guild_storagegettocart(struct map_session_data* sd, int index, int a
  *------------------------------------------*/
 int storage_guild_storagesave(int account_id, int guild_id, int flag)
 {
-	struct guild_storage *stor = guild2storage2(guild_id);
+	struct guild_storage *stor = idb_get(gstorage->db,guild_id);
 
 	if(stor)
 	{
@@ -674,7 +669,7 @@ int storage_guild_storagesaved(int guild_id)
 {
 	struct guild_storage *stor;
 
-	if((stor=gstorage->id2storage(guild_id)) != NULL) {
+	if((stor=idb_get(gstorage->db,guild_id)) != NULL) {
 		if (stor->dirty && stor->storage_status == 0)
 		{	//Storage has been correctly saved.
 			stor->dirty = 0;
@@ -689,7 +684,7 @@ int storage_guild_storageclose(struct map_session_data* sd) {
 	struct guild_storage *stor;
 
 	nullpo_ret(sd);
-	nullpo_ret(stor=gstorage->id2storage(sd->status.guild_id));
+	nullpo_ret(stor=idb_get(gstorage->db,sd->status.guild_id));
 
 	clif->storageclose(sd);
 	if (stor->storage_status) {
@@ -708,7 +703,7 @@ int storage_guild_storage_quit(struct map_session_data* sd, int flag) {
 	struct guild_storage *stor;
 
 	nullpo_ret(sd);
-	nullpo_ret(stor=gstorage->id2storage(sd->status.guild_id));
+	nullpo_ret(stor=idb_get(gstorage->db,sd->status.guild_id));
 	
 	if(flag) {
 		//Only during a guild break flag is 1 (don't save storage)
@@ -766,7 +761,6 @@ void gstorage_defaults(void) {
 	gstorage->final = do_final_gstorage;
 	/* */
 	gstorage->ensure = guild2storage_ensure;
-	gstorage->id2storage = guild2storage;
 	gstorage->delete = guild_storage_delete;
 	gstorage->open = storage_guild_storageopen;
 	gstorage->additem = guild_storage_additem;
diff --git a/src/map/storage.h b/src/map/storage.h
index db782966f..fcf9a52e4 100644
--- a/src/map/storage.h
+++ b/src/map/storage.h
@@ -35,7 +35,6 @@ struct guild_storage_interface {
 	struct DBMap* db; // int guild_id -> struct guild_storage*
 	/* */
 	struct guild_storage *(*ensure) (int guild_id);
-	struct guild_storage *(*id2storage) (int guild_id);
 	/* */
 	void (*init) (bool minimal);
 	void (*final) (void);
-- 
cgit v1.2.3-70-g09d2