summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2014-10-05 02:11:23 -0300
committershennetsind <ind@henn.et>2014-10-05 02:11:23 -0300
commita46b190764df4cce0b378bc691218ac0814a5673 (patch)
tree37c8e37d62f9f4502640cd685495b9418580cfe6 /src
parentf51106c9312e9f1b434fc4460416d80db56ac547 (diff)
downloadhercules-a46b190764df4cce0b378bc691218ac0814a5673.tar.gz
hercules-a46b190764df4cce0b378bc691218ac0814a5673.tar.bz2
hercules-a46b190764df4cce0b378bc691218ac0814a5673.tar.xz
hercules-a46b190764df4cce0b378bc691218ac0814a5673.zip
Follow up b9b32ac7609e
Fixes issue where kicking a online guild member (on a server with GP_BOUND_ITEMS defined) would render the guilds storage (if not previously loaded during the servers lifespan (since boot)) to be wiped. Special Thanks to Xgear! Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c2
-rw-r--r--src/map/clif.c2
-rw-r--r--src/map/guild.c2
-rw-r--r--src/map/intif.c6
-rw-r--r--src/map/pc.c2
-rw-r--r--src/map/storage.c16
-rw-r--r--src/map/storage.h2
7 files changed, 16 insertions, 16 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 497e46520..68278c345 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -5143,7 +5143,7 @@ ACMD(cleargstorage)
return false;
}
- guild_storage = gstorage->id2storage2(sd->status.guild_id);
+ guild_storage = gstorage->id2storage(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 f6ab3f444..c0ee298a8 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->id2storage2(sd->status.guild_id)) == NULL) {
+ if( (gstor = gstorage->id2storage(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 ac24edeab..19cb1ab70 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->id2storage2(guild_id);
+ struct guild_storage *gstor = gstorage->id2storage(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 fc38e82e3..59c3c71e8 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -1098,7 +1098,7 @@ void intif_parse_LoadGuildStorage(int fd)
return;
}
}
- gstor=gstorage->id2storage(guild_id);
+ gstor=gstorage->ensure(guild_id);
if(!gstor) {
ShowWarning("intif_parse_LoadGuildStorage: error guild_id %d not exist\n",guild_id);
return;
@@ -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->id2storage2(guild_id);
+ struct guild_storage *gstor = gstorage->id2storage(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->id2storage2(guild_id);
+ gstor = gstorage->id2storage(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 d96e69aa5..194ea8264 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -9212,7 +9212,7 @@ int pc_checkitem(struct map_session_data *sd)
}
if (sd->guild) {
- struct guild_storage *guild_storage = gstorage->id2storage2(sd->guild->guild_id);
+ struct guild_storage *guild_storage = gstorage->id2storage(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 217f14a3a..2933008e5 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -351,7 +351,7 @@ DBData create_guildstorage(DBKey key, va_list args)
return DB->ptr2data(gs);
}
-struct guild_storage *guild2storage(int guild_id)
+struct guild_storage *guild2storage_ensure(int guild_id)
{
struct guild_storage *gs = NULL;
if(guild->search(guild_id) != NULL)
@@ -360,7 +360,7 @@ struct guild_storage *guild2storage(int guild_id)
}
//For just locating a storage without creating one. [Skotlex]
-struct guild_storage *guild2storage2(int guild_id) {
+struct guild_storage *guild2storage(int guild_id) {
return (struct guild_storage*)idb_get(gstorage->db,guild_id);
}
@@ -393,7 +393,7 @@ int storage_guild_storageopen(struct map_session_data* sd)
return 1;
}
- if((gstor = gstorage->id2storage2(sd->status.guild_id)) == NULL) {
+ if((gstor = gstorage->id2storage(sd->status.guild_id)) == NULL) {
intif->request_guild_storage(sd->status.account_id,sd->status.guild_id);
return 0;
}
@@ -511,7 +511,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->id2storage2(sd->status.guild_id));
+ nullpo_ret(stor=gstorage->id2storage(sd->status.guild_id));
if( !stor->storage_status || stor->storage_amount > MAX_GUILD_STORAGE )
return 0;
@@ -674,7 +674,7 @@ int storage_guild_storagesaved(int guild_id)
{
struct guild_storage *stor;
- if((stor=gstorage->id2storage2(guild_id)) != NULL) {
+ if((stor=gstorage->id2storage(guild_id)) != NULL) {
if (stor->dirty && stor->storage_status == 0)
{ //Storage has been correctly saved.
stor->dirty = 0;
@@ -689,7 +689,7 @@ int storage_guild_storageclose(struct map_session_data* sd) {
struct guild_storage *stor;
nullpo_ret(sd);
- nullpo_ret(stor=gstorage->id2storage2(sd->status.guild_id));
+ nullpo_ret(stor=gstorage->id2storage(sd->status.guild_id));
clif->storageclose(sd);
if (stor->storage_status) {
@@ -708,7 +708,7 @@ int storage_guild_storage_quit(struct map_session_data* sd, int flag) {
struct guild_storage *stor;
nullpo_ret(sd);
- nullpo_ret(stor=gstorage->id2storage2(sd->status.guild_id));
+ nullpo_ret(stor=gstorage->id2storage(sd->status.guild_id));
if(flag) {
//Only during a guild break flag is 1 (don't save storage)
@@ -765,8 +765,8 @@ void gstorage_defaults(void) {
gstorage->init = do_init_gstorage;
gstorage->final = do_final_gstorage;
/* */
+ gstorage->ensure = guild2storage_ensure;
gstorage->id2storage = guild2storage;
- gstorage->id2storage2 = guild2storage2;
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 186f21263..db782966f 100644
--- a/src/map/storage.h
+++ b/src/map/storage.h
@@ -34,8 +34,8 @@ struct storage_interface *storage;
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);
- struct guild_storage *(*id2storage2) (int guild_id);
/* */
void (*init) (bool minimal);
void (*final) (void);