summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c31
-rw-r--r--src/map/chrif.c4
-rw-r--r--src/map/clif.c29
-rw-r--r--src/map/guild.c6
-rw-r--r--src/map/intif.c6
-rw-r--r--src/map/map.c10
-rw-r--r--src/map/script.c10
-rw-r--r--src/map/storage.c76
-rw-r--r--src/map/storage.h69
-rw-r--r--src/map/trade.h7
-rw-r--r--src/map/unit.c4
11 files changed, 149 insertions, 103 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index b6a9e42ee..52192ebdc 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -816,8 +816,7 @@ ACMD(storage)
if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading || sd->state.storage_flag)
return false;
- if (storage_storageopen(sd) == 1)
- { //Already open.
+ if (storage->open(sd) == 1) { //Already open.
clif->message(fd, msg_txt(250));
return false;
}
@@ -853,7 +852,7 @@ ACMD(guildstorage)
return false;
}
- storage_guild_storageopen(sd);
+ gstorage->open(sd);
clif->message(fd, msg_txt(920)); // Guild storage opened.
return true;
}
@@ -5233,7 +5232,7 @@ ACMD(storeall)
if (sd->state.storage_flag != 1)
{ //Open storage.
- if( storage_storageopen(sd) == 1 ) {
+ if( storage->open(sd) == 1 ) {
clif->message(fd, msg_txt(1161)); // You currently cannot open your storage.
return false;
}
@@ -5243,10 +5242,10 @@ ACMD(storeall)
if (sd->status.inventory[i].amount) {
if(sd->status.inventory[i].equip != 0)
pc->unequipitem(sd, i, 3);
- storage_storageadd(sd, i, sd->status.inventory[i].amount);
+ storage->add(sd, i, sd->status.inventory[i].amount);
}
}
- storage_storageclose(sd);
+ storage->close(sd);
clif->message(fd, msg_txt(1162)); // All items stored.
return true;
@@ -5264,9 +5263,9 @@ ACMD(clearstorage)
j = sd->status.storage.storage_amount;
for (i = 0; i < j; ++i) {
- storage_delitem(sd, i, sd->status.storage.items[i].amount);
+ storage->delitem(sd, i, sd->status.storage.items[i].amount);
}
- storage_storageclose(sd);
+ storage->close(sd);
clif->message(fd, msg_txt(1394)); // Your storage was cleaned.
return true;
@@ -5276,7 +5275,7 @@ ACMD(cleargstorage)
{
int i, j;
struct guild *g;
- struct guild_storage *gstorage;
+ struct guild_storage *guild_storage;
nullpo_retr(-1, sd);
g = sd->guild;
@@ -5296,18 +5295,18 @@ ACMD(cleargstorage)
return false;
}
- gstorage = guild2storage2(sd->status.guild_id);
- if (gstorage == NULL) {// Doesn't have opened @gstorage yet, so we skip the deletion since *shouldn't* have any item there.
+ guild_storage = gstorage->id2storage2(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;
}
- j = gstorage->storage_amount;
- gstorage->lock = 1; // Lock @gstorage: do not allow any item to be retrieved or stored from any guild member
+ j = guild_storage->storage_amount;
+ guild_storage->lock = 1; // Lock @gstorage: do not allow any item to be retrieved or stored from any guild member
for (i = 0; i < j; ++i) {
- guild_storage_delitem(sd, gstorage, i, gstorage->items[i].amount);
+ gstorage->delitem(sd, guild_storage, i, guild_storage->items[i].amount);
}
- storage_guild_storageclose(sd);
- gstorage->lock = 0; // Cleaning done, release lock
+ gstorage->close(sd);
+ guild_storage->lock = 0; // Cleaning done, release lock
clif->message(fd, msg_txt(1395)); // Your guild storage was cleaned.
return true;
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 6e076e6d8..a95193363 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -286,7 +286,7 @@ int chrif_save(struct map_session_data *sd, int flag) {
//For data sync
if (sd->state.storage_flag == 2)
- storage_guild_storagesave(sd->status.account_id, sd->status.guild_id, flag);
+ gstorage->save(sd->status.account_id, sd->status.guild_id, flag);
if (flag)
sd->state.storage_flag = 0; //Force close it.
@@ -526,7 +526,7 @@ void chrif_on_ready(void) {
auth_db->foreach(auth_db,chrif_reconnect);
//Re-save any storages that were modified in the disconnection time. [Skotlex]
- do_reconnect_storage();
+ storage->reconnect();
//Re-save any guild castles that were modified in the disconnection time.
guild->castle_reconnect(-1, 0, 0);
diff --git a/src/map/clif.c b/src/map/clif.c
index 82b0601a8..00e395709 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -11849,10 +11849,9 @@ void clif_parse_MoveToKafra(int fd, struct map_session_data *sd)
return;
if (sd->state.storage_flag == 1)
- storage_storageadd(sd, item_index, item_amount);
- else
- if (sd->state.storage_flag == 2)
- storage_guild_storageadd(sd, item_index, item_amount);
+ storage->add(sd, item_index, item_amount);
+ else if (sd->state.storage_flag == 2)
+ gstorage->add(sd, item_index, item_amount);
}
@@ -11868,9 +11867,9 @@ void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd)
item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]);
if (sd->state.storage_flag == 1)
- storage_storageget(sd, item_index, item_amount);
+ storage->get(sd, item_index, item_amount);
else if(sd->state.storage_flag == 2)
- storage_guild_storageget(sd, item_index, item_amount);
+ gstorage->get(sd, item_index, item_amount);
}
@@ -11884,10 +11883,9 @@ void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd)
return;
if (sd->state.storage_flag == 1)
- storage_storageaddfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4));
- else
- if (sd->state.storage_flag == 2)
- storage_guild_storageaddfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4));
+ storage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4));
+ else if (sd->state.storage_flag == 2)
+ gstorage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4));
}
@@ -11901,10 +11899,9 @@ void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd)
return;
if (sd->state.storage_flag == 1)
- storage_storagegettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4));
- else
- if (sd->state.storage_flag == 2)
- storage_guild_storagegettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4));
+ storage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4));
+ else if (sd->state.storage_flag == 2)
+ gstorage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4));
}
@@ -11913,9 +11910,9 @@ void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd)
void clif_parse_CloseKafra(int fd, struct map_session_data *sd)
{
if( sd->state.storage_flag == 1 )
- storage_storageclose(sd);
+ storage->close(sd);
else if( sd->state.storage_flag == 2 )
- storage_guild_storageclose(sd);
+ gstorage->close(sd);
}
diff --git a/src/map/guild.c b/src/map/guild.c
index b28c14db7..e093fdf92 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -921,7 +921,7 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c
if(sd != NULL && sd->status.guild_id == guild_id) {
// do stuff that needs the guild_id first, BEFORE we wipe it
if (sd->state.storage_flag == 2) //Close the guild storage.
- storage_guild_storageclose(sd);
+ gstorage->close(sd);
guild->send_dot_remove(sd);
if( hChSys.ally ) {
clif->chsys_quitg(sd);
@@ -1752,7 +1752,7 @@ int guild_broken(int guild_id,int flag)
for(i=0;i<g->max_member;i++){ // Destroy all relationships
if((sd=g->member[i].sd)!=NULL){
if(sd->state.storage_flag == 2)
- storage_guild_storage_quit(sd,1);
+ gstorage->pc_quit(sd,1);
sd->status.guild_id=0;
sd->guild = NULL;
clif->guild_broken(g->member[i].sd,0);
@@ -1762,7 +1762,7 @@ int guild_broken(int guild_id,int flag)
guild_db->foreach(guild_db,guild_broken_sub,guild_id);
castle_db->foreach(castle_db,castle_guild_broken_sub,guild_id);
- guild_storage_delete(guild_id);
+ gstorage->delete(guild_id);
if( hChSys.ally ) {
if( g->channel != NULL ) {
clif->chsys_delete(( struct hChSysCh * )g->channel);
diff --git a/src/map/intif.c b/src/map/intif.c
index f3931e79e..e364f5c25 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -1011,7 +1011,7 @@ int intif_parse_LoadGuildStorage(int fd)
ShowError("intif_parse_LoadGuildStorage: user not found %d\n",RFIFOL(fd,4));
return 1;
}
- gstor=guild2storage(guild_id);
+ gstor=gstorage->id2storage(guild_id);
if(!gstor) {
ShowWarning("intif_parse_LoadGuildStorage: error guild_id %d not exist\n",guild_id);
return 1;
@@ -1031,14 +1031,14 @@ int intif_parse_LoadGuildStorage(int fd)
}
memcpy(gstor,RFIFOP(fd,12),sizeof(struct guild_storage));
- storage_guild_storageopen(sd);
+ gstorage->open(sd);
return 0;
}
// ACK guild_storage saved
int intif_parse_SaveGuildStorage(int fd)
{
- storage_guild_storagesaved(/*RFIFOL(fd,2), */RFIFOL(fd,6));
+ gstorage->saved(/*RFIFOL(fd,2), */RFIFOL(fd,6));
return 0;
}
diff --git a/src/map/map.c b/src/map/map.c
index 5f86286e9..fbdb7a9f9 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -5031,7 +5031,7 @@ void do_final(void)
do_final_npc();
script->final();
do_final_itemdb();
- do_final_storage();
+ storage->final();
guild->final();
party->do_final_party();
pc->do_final_pc();
@@ -5235,7 +5235,9 @@ void map_hp_symbols(void) {
HPM->share(buyingstore,"buyingstore");
HPM->share(clif,"clif");
HPM->share(guild,"guild");
+ HPM->share(gstorage,"gstorage");
HPM->share(homun,"homun");
+ HPM->share(iMap,"iMap");
HPM->share(ircbot,"ircbot");
HPM->share(itemdb,"itemdb");
HPM->share(logs,"logs");
@@ -5246,8 +5248,8 @@ void map_hp_symbols(void) {
HPM->share(vending,"vending");
HPM->share(pc,"pc");
HPM->share(party,"party");
+ HPM->share(storage,"storage");
HPM->share(trade,"trade");
- HPM->share(iMap,"iMap");
/* partial */
HPM->share(mapit,"mapit");
/* sql link */
@@ -5266,6 +5268,7 @@ void load_defaults(void) {
buyingstore_defaults();
clif_defaults();
guild_defaults();
+ gstorage_defaults();
homunculus_defaults();
instance_defaults();
ircbot_defaults();
@@ -5279,6 +5282,7 @@ void load_defaults(void) {
vending_defaults();
pc_defaults();
party_defaults();
+ storage_defaults();
trade_defaults();
}
int do_init(int argc, char *argv[])
@@ -5470,7 +5474,7 @@ int do_init(int argc, char *argv[])
do_init_status();
party->do_init_party();
guild->init();
- do_init_storage();
+ storage->init();
do_init_pet();
homun->init();
do_init_mercenary();
diff --git a/src/map/script.c b/src/map/script.c
index 682faa42b..f65c0c21c 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -8179,20 +8179,18 @@ BUILDIN(gettimestr)
/*==========================================
* Open player storage
*------------------------------------------*/
-BUILDIN(openstorage)
-{
+BUILDIN(openstorage) {
TBL_PC* sd;
sd = script_rid2sd(st);
if( sd == NULL )
return true;
- storage_storageopen(sd);
+ storage->open(sd);
return true;
}
-BUILDIN(guildopenstorage)
-{
+BUILDIN(guildopenstorage) {
TBL_PC* sd;
int ret;
@@ -8200,7 +8198,7 @@ BUILDIN(guildopenstorage)
if( sd == NULL )
return true;
- ret = storage_guild_storageopen(sd);
+ ret = gstorage->open(sd);
script_pushint(st,ret);
return true;
}
diff --git a/src/map/storage.c b/src/map/storage.c
index ea30f6c0f..49cb18cbe 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -1,5 +1,6 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
+// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// See the LICENSE file
+// Portions Copyright (c) Athena Dev Teams
#include "../common/cbasetypes.h"
#include "../common/db.h"
@@ -75,14 +76,13 @@ static int storage_reconnect_sub(DBKey key, DBData *data, va_list ap)
{
struct guild_storage *stor = DB->data2ptr(data);
if (stor->dirty && stor->storage_status == 0) //Save closed storages.
- storage_guild_storagesave(0, stor->guild_id,0);
+ gstorage->save(0, stor->guild_id,0);
return 0;
}
//Function to be invoked upon server reconnection to char. To save all 'dirty' storages [Skotlex]
-void do_reconnect_storage(void)
-{
+void do_reconnect_storage(void) {
guild_storage_db->foreach(guild_storage_db, storage_reconnect_sub);
}
@@ -253,7 +253,7 @@ int storage_storageget(struct map_session_data* sd, int index, int amount)
return 0;
if( (flag = pc->additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE)) == 0 )
- storage_delitem(sd,index,amount);
+ storage->delitem(sd,index,amount);
else
clif->additem(sd,0,0,flag);
@@ -310,7 +310,7 @@ int storage_storagegettocart(struct map_session_data* sd, int index, int amount)
return 0;
if( pc->cart_additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE) == 0 )
- storage_delitem(sd,index,amount);
+ storage->delitem(sd,index,amount);
return 1;
}
@@ -399,7 +399,7 @@ int storage_guild_storageopen(struct map_session_data* sd)
return 1;
}
- if((gstor = guild2storage2(sd->status.guild_id)) == NULL) {
+ if((gstor = gstorage->id2storage2(sd->status.guild_id)) == NULL) {
intif_request_guild_storage(sd->status.account_id,sd->status.guild_id);
return 0;
}
@@ -512,7 +512,7 @@ int storage_guild_storageadd(struct map_session_data* sd, int index, int amount)
struct guild_storage *stor;
nullpo_ret(sd);
- nullpo_ret(stor=guild2storage2(sd->status.guild_id));
+ nullpo_ret(stor=gstorage->id2storage2(sd->status.guild_id));
if( !stor->storage_status || stor->storage_amount > MAX_GUILD_STORAGE )
return 0;
@@ -527,11 +527,11 @@ int storage_guild_storageadd(struct map_session_data* sd, int index, int amount)
return 0;
if( stor->lock ) {
- storage_guild_storageclose(sd);
+ gstorage->close(sd);
return 0;
}
- if(guild_storage_additem(sd,stor,&sd->status.inventory[index],amount)==0)
+ if(gstorage->additem(sd,stor,&sd->status.inventory[index],amount)==0)
pc->delitem(sd,index,amount,0,4,LOG_TYPE_GSTORAGE);
return 1;
@@ -565,12 +565,12 @@ int storage_guild_storageget(struct map_session_data* sd, int index, int amount)
return 0;
if( stor->lock ) {
- storage_guild_storageclose(sd);
+ gstorage->close(sd);
return 0;
}
if((flag = pc->additem(sd,&stor->items[index],amount,LOG_TYPE_GSTORAGE)) == 0)
- guild_storage_delitem(sd,stor,index,amount);
+ gstorage->delitem(sd,stor,index,amount);
else //inform fail
clif->additem(sd,0,0,flag);
// log_fromstorage(sd, index, 1);
@@ -604,7 +604,7 @@ int storage_guild_storageaddfromcart(struct map_session_data* sd, int index, int
if( amount < 1 || amount > sd->status.cart[index].amount )
return 0;
- if(guild_storage_additem(sd,stor,&sd->status.cart[index],amount)==0)
+ if(gstorage->additem(sd,stor,&sd->status.cart[index],amount)==0)
pc->cart_delitem(sd,index,amount,0,LOG_TYPE_GSTORAGE);
return 1;
@@ -637,7 +637,7 @@ int storage_guild_storagegettocart(struct map_session_data* sd, int index, int a
return 0;
if(pc->cart_additem(sd,&stor->items[index],amount,LOG_TYPE_GSTORAGE)==0)
- guild_storage_delitem(sd,stor,index,amount);
+ gstorage->delitem(sd,stor,index,amount);
return 1;
}
@@ -673,7 +673,7 @@ int storage_guild_storagesaved(int guild_id)
{
struct guild_storage *stor;
- if((stor=guild2storage2(guild_id)) != NULL) {
+ if((stor=gstorage->id2storage2(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=guild2storage2(sd->status.guild_id));
+ nullpo_ret(stor=gstorage->id2storage2(sd->status.guild_id));
clif->storageclose(sd);
if (stor->storage_status)
@@ -697,7 +697,7 @@ int storage_guild_storageclose(struct map_session_data* sd)
if (iMap->save_settings&4)
chrif_save(sd, 0); //This one also saves the storage. [Skotlex]
else
- storage_guild_storagesave(sd->status.account_id, sd->status.guild_id,0);
+ gstorage->save(sd->status.account_id, sd->status.guild_id,0);
stor->storage_status=0;
}
sd->state.storage_flag = 0;
@@ -710,7 +710,7 @@ int storage_guild_storage_quit(struct map_session_data* sd, int flag)
struct guild_storage *stor;
nullpo_ret(sd);
- nullpo_ret(stor=guild2storage2(sd->status.guild_id));
+ nullpo_ret(stor=gstorage->id2storage2(sd->status.guild_id));
if(flag)
{ //Only during a guild break flag is 1 (don't save storage)
@@ -726,10 +726,46 @@ int storage_guild_storage_quit(struct map_session_data* sd, int flag)
if (iMap->save_settings&4)
chrif_save(sd,0);
else
- storage_guild_storagesave(sd->status.account_id,sd->status.guild_id,1);
+ gstorage->save(sd->status.account_id,sd->status.guild_id,1);
}
sd->state.storage_flag = 0;
stor->storage_status = 0;
return 0;
}
+void storage_defaults(void) {
+ storage = &storage_s;
+
+ /* */
+ storage->init = do_init_storage;
+ storage->final = do_final_storage;
+ /* */
+ storage->reconnect = do_reconnect_storage;
+ /* */
+ storage->delitem = storage_delitem;
+ storage->open = storage_storageopen;
+ storage->add = storage_storageadd;
+ storage->get = storage_storageget;
+ storage->addfromcart = storage_storageaddfromcart;
+ storage->gettocart = storage_storagegettocart;
+ storage->close = storage_storageclose;
+ storage->pc_quit = storage_storage_quit;
+}
+void gstorage_defaults(void) {
+ gstorage = &gstorage_s;
+
+ gstorage->id2storage = guild2storage;
+ gstorage->id2storage2 = guild2storage2;
+ gstorage->delete = guild_storage_delete;
+ gstorage->open = storage_guild_storageopen;
+ gstorage->additem = guild_storage_additem;
+ gstorage->delitem = guild_storage_delitem;
+ gstorage->add = storage_guild_storageadd;
+ gstorage->get = storage_guild_storageget;
+ gstorage->addfromcart = storage_guild_storageaddfromcart;
+ gstorage->gettocart = storage_guild_storagegettocart;
+ gstorage->close = storage_guild_storageclose;
+ gstorage->pc_quit = storage_guild_storage_quit;
+ gstorage->save = storage_guild_storagesave;
+ gstorage->saved = storage_guild_storagesaved;
+} \ No newline at end of file
diff --git a/src/map/storage.h b/src/map/storage.h
index c08ec81cb..058b980b1 100644
--- a/src/map/storage.h
+++ b/src/map/storage.h
@@ -1,41 +1,52 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
+// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// See the LICENSE file
+// Portions Copyright (c) Athena Dev Teams
#ifndef _STORAGE_H_
#define _STORAGE_H_
-//#include "../common/mmo.h"
struct storage_data;
struct guild_storage;
struct item;
-//#include "map.h"
struct map_session_data;
-int storage_delitem(struct map_session_data* sd, int n, int amount);
-int storage_storageopen(struct map_session_data *sd);
-int storage_storageadd(struct map_session_data *sd,int index,int amount);
-int storage_storageget(struct map_session_data *sd,int index,int amount);
-int storage_storageaddfromcart(struct map_session_data *sd,int index,int amount);
-int storage_storagegettocart(struct map_session_data *sd,int index,int amount);
-void storage_storageclose(struct map_session_data *sd);
-int do_init_storage(void);
-void do_final_storage(void);
-void do_reconnect_storage(void);
-void storage_storage_quit(struct map_session_data *sd, int flag);
+struct storage_interface {
+ int (*init) (void);
+ void (*final) (void);
+ /* */
+ void (*reconnect) (void);
+ /* */
+ int (*delitem) (struct map_session_data* sd, int n, int amount);
+ int (*open) (struct map_session_data *sd);
+ int (*add) (struct map_session_data *sd,int index,int amount);
+ int (*get) (struct map_session_data *sd,int index,int amount);
+ int (*addfromcart) (struct map_session_data *sd,int index,int amount);
+ int (*gettocart) (struct map_session_data *sd,int index,int amount);
+ void (*close) (struct map_session_data *sd);
+ void (*pc_quit) (struct map_session_data *sd, int flag);
+} storage_s;
+struct storage_interface *storage;
-struct guild_storage* guild2storage(int guild_id);
-struct guild_storage *guild2storage2(int guild_id);
-int guild_storage_delete(int guild_id);
-int storage_guild_storageopen(struct map_session_data *sd);
-int guild_storage_additem(struct map_session_data *sd,struct guild_storage *stor,struct item *item_data,int amount);
-int guild_storage_delitem(struct map_session_data *sd,struct guild_storage *stor,int n,int amount);
-int storage_guild_storageadd(struct map_session_data *sd,int index,int amount);
-int storage_guild_storageget(struct map_session_data *sd,int index,int amount);
-int storage_guild_storageaddfromcart(struct map_session_data *sd,int index,int amount);
-int storage_guild_storagegettocart(struct map_session_data *sd,int index,int amount);
-int storage_guild_storageclose(struct map_session_data *sd);
-int storage_guild_storage_quit(struct map_session_data *sd,int flag);
-int storage_guild_storagesave(int account_id, int guild_id, int flag);
-int storage_guild_storagesaved(int guild_id); //Ack from char server that guild store was saved.
+struct guild_storage_interface {
+ struct guild_storage *(*id2storage) (int guild_id);
+ struct guild_storage *(*id2storage2) (int guild_id);
+ int (*delete) (int guild_id);
+ int (*open) (struct map_session_data *sd);
+ int (*additem) (struct map_session_data *sd,struct guild_storage *stor,struct item *item_data,int amount);
+ int (*delitem) (struct map_session_data *sd,struct guild_storage *stor,int n,int amount);
+ int (*add) (struct map_session_data *sd,int index,int amount);
+ int (*get) (struct map_session_data *sd,int index,int amount);
+ int (*addfromcart) (struct map_session_data *sd,int index,int amount);
+ int (*gettocart) (struct map_session_data *sd,int index,int amount);
+ int (*close) (struct map_session_data *sd);
+ int (*pc_quit) (struct map_session_data *sd,int flag);
+ int (*save) (int account_id, int guild_id, int flag);
+ int (*saved) (int guild_id); //Ack from char server that guild store was saved.
+} gstorage_s;
+
+struct guild_storage_interface *gstorage;
+
+void storage_defaults(void);
+void gstorage_defaults(void);
#endif /* _STORAGE_H_ */
diff --git a/src/map/trade.h b/src/map/trade.h
index f66c70525..8bf918ad2 100644
--- a/src/map/trade.h
+++ b/src/map/trade.h
@@ -1,10 +1,10 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
+// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// See the LICENSE file
+// Portions Copyright (c) Athena Dev Teams
#ifndef _TRADE_H_
#define _TRADE_H_
-//#include "map.h"
struct map_session_data;
struct trade_interface {
@@ -20,6 +20,7 @@ struct trade_interface {
} trade_s;
struct trade_interface *trade;
+
void trade_defaults(void);
#endif /* _TRADE_H_ */
diff --git a/src/map/unit.c b/src/map/unit.c
index 021859bba..5e836dc2e 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -2108,9 +2108,9 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
buyingstore->close(sd);
searchstore->close(sd);
if(sd->state.storage_flag == 1)
- storage_storage_quit(sd,0);
+ storage->pc_quit(sd,0);
else if (sd->state.storage_flag == 2)
- storage_guild_storage_quit(sd,0);
+ gstorage->pc_quit(sd,0);
sd->state.storage_flag = 0; //Force close it when being warped.
if(sd->party_invite>0)
party->reply_invite(sd,sd->party_invite,0);