From a675e06c38ec4e31a2758435a582b58a2199cfc4 Mon Sep 17 00:00:00 2001 From: Haru Date: Thu, 28 Jun 2018 03:17:32 +0200 Subject: Change functions to static where possible (Part 4 - map) This fixes issues with plugins defining symbols with the same names Signed-off-by: Haru --- src/map/buyingstore.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'src/map/buyingstore.c') 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; - } -- cgit v1.2.3-60-g2f50