summaryrefslogtreecommitdiff
path: root/src/map/buyingstore.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2018-06-28 03:17:32 +0200
committerHaru <haru@dotalux.com>2018-07-01 21:09:26 +0200
commita675e06c38ec4e31a2758435a582b58a2199cfc4 (patch)
treea4bf91c20da434eef97f55f7427ccbf034c5e285 /src/map/buyingstore.c
parentb7e6439f0c788ceacc567fbb017d3c7f09913f78 (diff)
downloadhercules-a675e06c38ec4e31a2758435a582b58a2199cfc4.tar.gz
hercules-a675e06c38ec4e31a2758435a582b58a2199cfc4.tar.bz2
hercules-a675e06c38ec4e31a2758435a582b58a2199cfc4.tar.xz
hercules-a675e06c38ec4e31a2758435a582b58a2199cfc4.zip
Change functions to static where possible (Part 4 - map)
This fixes issues with plugins defining symbols with the same names Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/buyingstore.c')
-rw-r--r--src/map/buyingstore.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c
index 16c35ff2a..ade2c5bf2 100644
--- a/src/map/buyingstore.c
+++ b/src/map/buyingstore.c
@@ -35,15 +35,16 @@
#include "common/socket.h" // RBUF*
#include "common/strlib.h" // safestrncpy
-struct buyingstore_interface buyingstore_s;
+static struct buyingstore_interface buyingstore_s;
struct buyingstore_interface *buyingstore;
/// Returns unique buying store id
-unsigned int buyingstore_getuid(void) {
+static unsigned int buyingstore_getuid(void)
+{
return buyingstore->nextid++;
}
-bool buyingstore_setup(struct map_session_data* sd, unsigned char slots)
+static bool buyingstore_setup(struct map_session_data *sd, unsigned char slots)
{
nullpo_retr(false, sd);
if( !battle_config.feature_buying_store || sd->state.vending || sd->state.buyingstore || sd->state.trading || slots == 0 )
@@ -80,7 +81,7 @@ bool buyingstore_setup(struct map_session_data* sd, unsigned char slots)
return true;
}
-void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned char result, const char* storename, const uint8* itemlist, unsigned int count)
+static void buyingstore_create(struct map_session_data *sd, int zenylimit, unsigned char result, const char *storename, const uint8 *itemlist, unsigned int count)
{
unsigned int i, weight, listidx;
@@ -196,7 +197,7 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha
clif->buyingstore_entry(sd);
}
-void buyingstore_close(struct map_session_data* sd)
+static void buyingstore_close(struct map_session_data *sd)
{
nullpo_retv(sd);
if (sd->state.buyingstore)
@@ -210,7 +211,7 @@ void buyingstore_close(struct map_session_data* sd)
}
}
-void buyingstore_open(struct map_session_data* sd, int account_id)
+static void buyingstore_open(struct map_session_data *sd, int account_id)
{
struct map_session_data* pl_sd;
@@ -240,8 +241,7 @@ void buyingstore_open(struct map_session_data* sd, int account_id)
clif->buyingstore_itemlist(sd, pl_sd);
}
-
-void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int buyer_id, const uint8* itemlist, unsigned int count)
+static void buyingstore_trade(struct map_session_data *sd, int account_id, unsigned int buyer_id, const uint8 *itemlist, unsigned int count)
{
int zeny = 0;
unsigned int i, weight, listidx, k;
@@ -415,9 +415,8 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
}
}
-
/// Checks if an item is being bought in given player's buying store.
-bool buyingstore_search(struct map_session_data* sd, unsigned short nameid)
+static bool buyingstore_search(struct map_session_data *sd, unsigned short nameid)
{
unsigned int i;
@@ -436,10 +435,9 @@ bool buyingstore_search(struct map_session_data* sd, unsigned short nameid)
return true;
}
-
/// Searches for all items in a buyingstore, that match given ids, price and possible cards.
/// @return Whether or not the search should be continued.
-bool buyingstore_searchall(struct map_session_data* sd, const struct s_search_store_search* s)
+static bool buyingstore_searchall(struct map_session_data *sd, const struct s_search_store_search *s)
{
unsigned int i, idx;
struct s_buyingstore_item* it;
@@ -484,7 +482,9 @@ bool buyingstore_searchall(struct map_session_data* sd, const struct s_search_st
return true;
}
-void buyingstore_defaults(void) {
+
+void buyingstore_defaults(void)
+{
buyingstore = &buyingstore_s;
buyingstore->nextid = 0;
@@ -499,5 +499,4 @@ void buyingstore_defaults(void) {
buyingstore->search = buyingstore_search;
buyingstore->searchall = buyingstore_searchall;
buyingstore->getuid = buyingstore_getuid;
-
}