|
@@ -12,31 +12,6 @@
|
|
#include "clif.hpp" // clif_open_search_store_info, clif_search_store_info_*
|
|
#include "clif.hpp" // clif_open_search_store_info, clif_search_store_info_*
|
|
#include "pc.hpp" // map_session_data
|
|
#include "pc.hpp" // map_session_data
|
|
|
|
|
|
-/// Failure constants for clif functions
|
|
|
|
-enum e_searchstore_failure
|
|
|
|
-{
|
|
|
|
- SSI_FAILED_NOTHING_SEARCH_ITEM = 0, // "No matching stores were found."
|
|
|
|
- SSI_FAILED_OVER_MAXCOUNT = 1, // "There are too many results. Please enter more detailed search term."
|
|
|
|
- SSI_FAILED_SEARCH_CNT = 2, // "You cannot search anymore."
|
|
|
|
- SSI_FAILED_LIMIT_SEARCH_TIME = 3, // "You cannot search yet."
|
|
|
|
- SSI_FAILED_SSILIST_CLICK_TO_OPEN_STORE = 4, // "No sale (purchase) information available."
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-/// Search type constants
|
|
|
|
-enum e_searchstore_searchtype
|
|
|
|
-{
|
|
|
|
- SEARCHTYPE_VENDING = 0,
|
|
|
|
- SEARCHTYPE_BUYING_STORE = 1,
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-/// Search effect constants
|
|
|
|
-enum e_searchstore_effecttype
|
|
|
|
-{
|
|
|
|
- EFFECTTYPE_NORMAL = 0,
|
|
|
|
- EFFECTTYPE_CASH = 1,
|
|
|
|
- EFFECTTYPE_MAX
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
/// Type for shop search function
|
|
/// Type for shop search function
|
|
typedef bool (*searchstore_search_t)(map_session_data* sd, t_itemid nameid);
|
|
typedef bool (*searchstore_search_t)(map_session_data* sd, t_itemid nameid);
|
|
typedef bool (*searchstore_searchall_t)(map_session_data* sd, const struct s_search_store_search* s);
|
|
typedef bool (*searchstore_searchall_t)(map_session_data* sd, const struct s_search_store_search* s);
|
|
@@ -46,7 +21,7 @@ typedef bool (*searchstore_searchall_t)(map_session_data* sd, const struct s_sea
|
|
* @param type : type of search to conduct
|
|
* @param type : type of search to conduct
|
|
* @return : search type
|
|
* @return : search type
|
|
*/
|
|
*/
|
|
-static searchstore_search_t searchstore_getsearchfunc(unsigned char type)
|
|
|
|
|
|
+static searchstore_search_t searchstore_getsearchfunc(e_searchstore_searchtype type)
|
|
{
|
|
{
|
|
switch( type ) {
|
|
switch( type ) {
|
|
case SEARCHTYPE_VENDING: return &vending_search;
|
|
case SEARCHTYPE_VENDING: return &vending_search;
|
|
@@ -61,7 +36,7 @@ static searchstore_search_t searchstore_getsearchfunc(unsigned char type)
|
|
* @param type : type of search to conduct
|
|
* @param type : type of search to conduct
|
|
* @return : search type
|
|
* @return : search type
|
|
*/
|
|
*/
|
|
-static searchstore_searchall_t searchstore_getsearchallfunc(unsigned char type)
|
|
|
|
|
|
+static searchstore_searchall_t searchstore_getsearchallfunc(e_searchstore_searchtype type)
|
|
{
|
|
{
|
|
switch( type ) {
|
|
switch( type ) {
|
|
case SEARCHTYPE_VENDING: return &vending_searchall;
|
|
case SEARCHTYPE_VENDING: return &vending_searchall;
|
|
@@ -77,11 +52,11 @@ static searchstore_searchall_t searchstore_getsearchallfunc(unsigned char type)
|
|
* @param type : type of search to conduct
|
|
* @param type : type of search to conduct
|
|
* @return : store type
|
|
* @return : store type
|
|
*/
|
|
*/
|
|
-static bool searchstore_hasstore(map_session_data* sd, unsigned char type)
|
|
|
|
|
|
+static bool searchstore_hasstore(map_session_data& sd, e_searchstore_searchtype type)
|
|
{
|
|
{
|
|
switch( type ) {
|
|
switch( type ) {
|
|
- case SEARCHTYPE_VENDING: return sd->state.vending;
|
|
|
|
- case SEARCHTYPE_BUYING_STORE: return sd->state.buyingstore;
|
|
|
|
|
|
+ case SEARCHTYPE_VENDING: return sd.state.vending;
|
|
|
|
+ case SEARCHTYPE_BUYING_STORE: return sd.state.buyingstore;
|
|
}
|
|
}
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -93,11 +68,11 @@ static bool searchstore_hasstore(map_session_data* sd, unsigned char type)
|
|
* @param type : type of search to conduct
|
|
* @param type : type of search to conduct
|
|
* @return : store ID
|
|
* @return : store ID
|
|
*/
|
|
*/
|
|
-static int searchstore_getstoreid(map_session_data* sd, unsigned char type)
|
|
|
|
|
|
+static int searchstore_getstoreid(map_session_data& sd, e_searchstore_searchtype type)
|
|
{
|
|
{
|
|
switch( type ) {
|
|
switch( type ) {
|
|
- case SEARCHTYPE_VENDING: return sd->vender_id;
|
|
|
|
- case SEARCHTYPE_BUYING_STORE: return sd->buyer_id;
|
|
|
|
|
|
+ case SEARCHTYPE_VENDING: return sd.vender_id;
|
|
|
|
+ case SEARCHTYPE_BUYING_STORE: return sd.buyer_id;
|
|
}
|
|
}
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
@@ -110,17 +85,16 @@ static int searchstore_getstoreid(map_session_data* sd, unsigned char type)
|
|
* @param effect : shop type
|
|
* @param effect : shop type
|
|
* @return : true : opened, false : failed to open
|
|
* @return : true : opened, false : failed to open
|
|
*/
|
|
*/
|
|
-bool searchstore_open(map_session_data* sd, unsigned int uses, unsigned short effect)
|
|
|
|
|
|
+bool searchstore_open(map_session_data& sd, uint16 uses, e_searchstore_effecttype effect, int16 mapid)
|
|
{
|
|
{
|
|
- if( !battle_config.feature_search_stores || sd->searchstore.open )
|
|
|
|
|
|
+ if( !battle_config.feature_search_stores || sd.searchstore.open )
|
|
return false;
|
|
return false;
|
|
|
|
|
|
- if( !uses || effect >= EFFECTTYPE_MAX ) // invalid input
|
|
|
|
- return false;
|
|
|
|
|
|
|
|
- sd->searchstore.open = true;
|
|
|
|
- sd->searchstore.uses = uses;
|
|
|
|
- sd->searchstore.effect = effect;
|
|
|
|
|
|
+ sd.searchstore.open = true;
|
|
|
|
+ sd.searchstore.uses = uses;
|
|
|
|
+ sd.searchstore.effect = effect;
|
|
|
|
+ sd.searchstore.mapid = mapid;
|
|
|
|
|
|
clif_open_search_store_info(sd);
|
|
clif_open_search_store_info(sd);
|
|
|
|
|
|
@@ -138,7 +112,7 @@ bool searchstore_open(map_session_data* sd, unsigned int uses, unsigned short ef
|
|
* @param cardlist : list with stored cards (cards attached to items)
|
|
* @param cardlist : list with stored cards (cards attached to items)
|
|
* @param card_count : amount of items in cardlist
|
|
* @param card_count : amount of items in cardlist
|
|
*/
|
|
*/
|
|
-void searchstore_query(map_session_data* sd, unsigned char type, unsigned int min_price, unsigned int max_price, const struct PACKET_CZ_SEARCH_STORE_INFO_item* itemlist, unsigned int item_count, const struct PACKET_CZ_SEARCH_STORE_INFO_item* cardlist, unsigned int card_count)
|
|
|
|
|
|
+void searchstore_query(map_session_data& sd, e_searchstore_searchtype type, unsigned int min_price, unsigned int max_price, const struct PACKET_CZ_SEARCH_STORE_INFO_item* itemlist, unsigned int item_count, const struct PACKET_CZ_SEARCH_STORE_INFO_item* cardlist, unsigned int card_count)
|
|
{
|
|
{
|
|
unsigned int i;
|
|
unsigned int i;
|
|
map_session_data* pl_sd;
|
|
map_session_data* pl_sd;
|
|
@@ -150,22 +124,22 @@ void searchstore_query(map_session_data* sd, unsigned char type, unsigned int mi
|
|
if( !battle_config.feature_search_stores )
|
|
if( !battle_config.feature_search_stores )
|
|
return;
|
|
return;
|
|
|
|
|
|
- if( !sd->searchstore.open )
|
|
|
|
|
|
+ if( !sd.searchstore.open )
|
|
return;
|
|
return;
|
|
|
|
|
|
if( ( store_searchall = searchstore_getsearchallfunc(type) ) == nullptr ) {
|
|
if( ( store_searchall = searchstore_getsearchallfunc(type) ) == nullptr ) {
|
|
- ShowError("searchstore_query: Unknown search type %u (account_id=%d).\n", (unsigned int)type, sd->bl.id);
|
|
|
|
|
|
+ ShowError("searchstore_query: Unknown search type %u (account_id=%d).\n", type, sd.bl.id);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
time(&querytime);
|
|
time(&querytime);
|
|
|
|
|
|
- if( sd->searchstore.nextquerytime > querytime ) {
|
|
|
|
|
|
+ if( sd.searchstore.nextquerytime > querytime ) {
|
|
clif_search_store_info_failed(sd, SSI_FAILED_LIMIT_SEARCH_TIME);
|
|
clif_search_store_info_failed(sd, SSI_FAILED_LIMIT_SEARCH_TIME);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- if( !sd->searchstore.uses ) {
|
|
|
|
|
|
+ if( !sd.searchstore.uses ) {
|
|
clif_search_store_info_failed(sd, SSI_FAILED_SEARCH_CNT);
|
|
clif_search_store_info_failed(sd, SSI_FAILED_SEARCH_CNT);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -189,15 +163,15 @@ void searchstore_query(map_session_data* sd, unsigned char type, unsigned int mi
|
|
if( max_price < min_price )
|
|
if( max_price < min_price )
|
|
std::swap(min_price, max_price);
|
|
std::swap(min_price, max_price);
|
|
|
|
|
|
- sd->searchstore.uses--;
|
|
|
|
- sd->searchstore.type = type;
|
|
|
|
- sd->searchstore.nextquerytime = querytime+battle_config.searchstore_querydelay;
|
|
|
|
|
|
+ sd.searchstore.uses--;
|
|
|
|
+ sd.searchstore.type = type;
|
|
|
|
+ sd.searchstore.nextquerytime = querytime+battle_config.searchstore_querydelay;
|
|
|
|
|
|
// drop previous results
|
|
// drop previous results
|
|
searchstore_clear(sd);
|
|
searchstore_clear(sd);
|
|
|
|
|
|
// search
|
|
// search
|
|
- s.search_sd = sd;
|
|
|
|
|
|
+ s.search_sd = &sd;
|
|
s.itemlist = itemlist;
|
|
s.itemlist = itemlist;
|
|
s.cardlist = cardlist;
|
|
s.cardlist = cardlist;
|
|
s.item_count = item_count;
|
|
s.item_count = item_count;
|
|
@@ -207,8 +181,13 @@ void searchstore_query(map_session_data* sd, unsigned char type, unsigned int mi
|
|
iter = db_iterator((type == SEARCHTYPE_VENDING) ? vending_getdb() : buyingstore_getdb());
|
|
iter = db_iterator((type == SEARCHTYPE_VENDING) ? vending_getdb() : buyingstore_getdb());
|
|
|
|
|
|
for( pl_sd = (map_session_data*)dbi_first(iter); dbi_exists(iter); pl_sd = (map_session_data*)dbi_next(iter) ) {
|
|
for( pl_sd = (map_session_data*)dbi_first(iter); dbi_exists(iter); pl_sd = (map_session_data*)dbi_next(iter) ) {
|
|
- if( sd == pl_sd ) // skip own shop, if any
|
|
|
|
|
|
+ if( &sd == pl_sd ) // skip own shop, if any
|
|
|
|
+ continue;
|
|
|
|
+
|
|
|
|
+ // Skip stores that are not in the map defined by the search
|
|
|
|
+ if (sd.searchstore.mapid != 0 && pl_sd->bl.m != sd.searchstore.mapid) {
|
|
continue;
|
|
continue;
|
|
|
|
+ }
|
|
|
|
|
|
if( !store_searchall(pl_sd, &s) ) { // exceeded result size
|
|
if( !store_searchall(pl_sd, &s) ) { // exceeded result size
|
|
clif_search_store_info_failed(sd, SSI_FAILED_OVER_MAXCOUNT);
|
|
clif_search_store_info_failed(sd, SSI_FAILED_OVER_MAXCOUNT);
|
|
@@ -218,18 +197,18 @@ void searchstore_query(map_session_data* sd, unsigned char type, unsigned int mi
|
|
|
|
|
|
dbi_destroy(iter);
|
|
dbi_destroy(iter);
|
|
|
|
|
|
- if( !sd->searchstore.items.empty() ) {
|
|
|
|
|
|
+ if( !sd.searchstore.items.empty() ) {
|
|
// present results
|
|
// present results
|
|
- clif_search_store_info_ack( *sd );
|
|
|
|
|
|
+ clif_search_store_info_ack( sd );
|
|
|
|
|
|
// one page displayed
|
|
// one page displayed
|
|
- sd->searchstore.pages++;
|
|
|
|
|
|
+ sd.searchstore.pages++;
|
|
} else {
|
|
} else {
|
|
// cleanup
|
|
// cleanup
|
|
searchstore_clear(sd);
|
|
searchstore_clear(sd);
|
|
|
|
|
|
// update uses
|
|
// update uses
|
|
- clif_search_store_info_ack( *sd );
|
|
|
|
|
|
+ clif_search_store_info_ack( sd );
|
|
|
|
|
|
// notify of failure
|
|
// notify of failure
|
|
clif_search_store_info_failed(sd, SSI_FAILED_NOTHING_SEARCH_ITEM);
|
|
clif_search_store_info_failed(sd, SSI_FAILED_NOTHING_SEARCH_ITEM);
|
|
@@ -241,9 +220,9 @@ void searchstore_query(map_session_data* sd, unsigned char type, unsigned int mi
|
|
* @param sd : player requesting
|
|
* @param sd : player requesting
|
|
* @return : true : more items to search, false : no more items
|
|
* @return : true : more items to search, false : no more items
|
|
*/
|
|
*/
|
|
-bool searchstore_querynext(map_session_data* sd)
|
|
|
|
|
|
+bool searchstore_querynext(map_session_data& sd)
|
|
{
|
|
{
|
|
- if( !sd->searchstore.items.empty() && ( sd->searchstore.items.size()-1 )/SEARCHSTORE_RESULTS_PER_PAGE > sd->searchstore.pages )
|
|
|
|
|
|
+ if( !sd.searchstore.items.empty() && ( sd.searchstore.items.size()-1 )/SEARCHSTORE_RESULTS_PER_PAGE > sd.searchstore.pages )
|
|
return true;
|
|
return true;
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -253,41 +232,41 @@ bool searchstore_querynext(map_session_data* sd)
|
|
* Get and display the results for the next page.
|
|
* Get and display the results for the next page.
|
|
* @param sd : player requesting
|
|
* @param sd : player requesting
|
|
*/
|
|
*/
|
|
-void searchstore_next(map_session_data* sd)
|
|
|
|
|
|
+void searchstore_next(map_session_data& sd)
|
|
{
|
|
{
|
|
- if( !battle_config.feature_search_stores || !sd->searchstore.open || sd->searchstore.items.size() <= sd->searchstore.pages*SEARCHSTORE_RESULTS_PER_PAGE ) // nothing (more) to display
|
|
|
|
|
|
+ if( !battle_config.feature_search_stores || !sd.searchstore.open || sd.searchstore.items.size() <= sd.searchstore.pages*SEARCHSTORE_RESULTS_PER_PAGE ) // nothing (more) to display
|
|
return;
|
|
return;
|
|
|
|
|
|
// present results
|
|
// present results
|
|
- clif_search_store_info_ack( *sd );
|
|
|
|
|
|
+ clif_search_store_info_ack( sd );
|
|
|
|
|
|
// one more page displayed
|
|
// one more page displayed
|
|
- sd->searchstore.pages++;
|
|
|
|
|
|
+ sd.searchstore.pages++;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* Prepare to clear information for closing of window.
|
|
* Prepare to clear information for closing of window.
|
|
* @param sd : player requesting
|
|
* @param sd : player requesting
|
|
*/
|
|
*/
|
|
-void searchstore_clear(map_session_data* sd)
|
|
|
|
|
|
+void searchstore_clear(map_session_data& sd)
|
|
{
|
|
{
|
|
searchstore_clearremote(sd);
|
|
searchstore_clearremote(sd);
|
|
|
|
|
|
- sd->searchstore.items.clear();
|
|
|
|
- sd->searchstore.pages = 0;
|
|
|
|
|
|
+ sd.searchstore.items.clear();
|
|
|
|
+ sd.searchstore.pages = 0;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* Close the Search Store window.
|
|
* Close the Search Store window.
|
|
* @param sd : player requesting
|
|
* @param sd : player requesting
|
|
*/
|
|
*/
|
|
-void searchstore_close(map_session_data* sd)
|
|
|
|
|
|
+void searchstore_close(map_session_data& sd)
|
|
{
|
|
{
|
|
- if( sd->searchstore.open ) {
|
|
|
|
|
|
+ if( sd.searchstore.open ) {
|
|
searchstore_clear(sd);
|
|
searchstore_clear(sd);
|
|
|
|
|
|
- sd->searchstore.uses = 0;
|
|
|
|
- sd->searchstore.open = false;
|
|
|
|
|
|
+ sd.searchstore.uses = 0;
|
|
|
|
+ sd.searchstore.open = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -298,20 +277,20 @@ void searchstore_close(map_session_data* sd)
|
|
* @param store_id : store ID created by client
|
|
* @param store_id : store ID created by client
|
|
* @param nameid : item being searched
|
|
* @param nameid : item being searched
|
|
*/
|
|
*/
|
|
-void searchstore_click(map_session_data* sd, uint32 account_id, int store_id, t_itemid nameid)
|
|
|
|
|
|
+void searchstore_click(map_session_data& sd, uint32 account_id, int store_id, t_itemid nameid)
|
|
{
|
|
{
|
|
unsigned int i;
|
|
unsigned int i;
|
|
map_session_data* pl_sd;
|
|
map_session_data* pl_sd;
|
|
searchstore_search_t store_search;
|
|
searchstore_search_t store_search;
|
|
|
|
|
|
- if( !battle_config.feature_search_stores || !sd->searchstore.open || sd->searchstore.items.empty() )
|
|
|
|
|
|
+ if( !battle_config.feature_search_stores || !sd.searchstore.open || sd.searchstore.items.empty() )
|
|
return;
|
|
return;
|
|
|
|
|
|
searchstore_clearremote(sd);
|
|
searchstore_clearremote(sd);
|
|
|
|
|
|
- ARR_FIND( 0, sd->searchstore.items.size(), i, sd->searchstore.items[i]->store_id == store_id && sd->searchstore.items[i]->account_id == account_id && sd->searchstore.items[i]->nameid == nameid );
|
|
|
|
- if( i == sd->searchstore.items.size() ) { // no such result, crafted
|
|
|
|
- ShowWarning("searchstore_click: Received request with item %u of account %d, which is not part of current result set (account_id=%d, char_id=%d).\n", nameid, account_id, sd->bl.id, sd->status.char_id);
|
|
|
|
|
|
+ ARR_FIND( 0, sd.searchstore.items.size(), i, sd.searchstore.items[i]->store_id == store_id && sd.searchstore.items[i]->account_id == account_id && sd.searchstore.items[i]->nameid == nameid );
|
|
|
|
+ if( i == sd.searchstore.items.size() ) { // no such result, crafted
|
|
|
|
+ ShowWarning("searchstore_click: Received request with item %u of account %d, which is not part of current result set (account_id=%d, char_id=%d).\n", nameid, account_id, sd.bl.id, sd.status.char_id);
|
|
clif_search_store_info_failed(sd, SSI_FAILED_SSILIST_CLICK_TO_OPEN_STORE);
|
|
clif_search_store_info_failed(sd, SSI_FAILED_SSILIST_CLICK_TO_OPEN_STORE);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -321,39 +300,39 @@ void searchstore_click(map_session_data* sd, uint32 account_id, int store_id, t_
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- if( !searchstore_hasstore(pl_sd, sd->searchstore.type) || searchstore_getstoreid(pl_sd, sd->searchstore.type) != store_id ) { // no longer vending/buying or not same shop
|
|
|
|
|
|
+ if( !searchstore_hasstore(*pl_sd, sd.searchstore.type) || searchstore_getstoreid(*pl_sd, sd.searchstore.type) != store_id ) { // no longer vending/buying or not same shop
|
|
clif_search_store_info_failed(sd, SSI_FAILED_SSILIST_CLICK_TO_OPEN_STORE);
|
|
clif_search_store_info_failed(sd, SSI_FAILED_SSILIST_CLICK_TO_OPEN_STORE);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- store_search = searchstore_getsearchfunc(sd->searchstore.type);
|
|
|
|
|
|
+ store_search = searchstore_getsearchfunc(sd.searchstore.type);
|
|
|
|
|
|
if( !store_search(pl_sd, nameid) ) {// item no longer being sold/bought
|
|
if( !store_search(pl_sd, nameid) ) {// item no longer being sold/bought
|
|
clif_search_store_info_failed(sd, SSI_FAILED_SSILIST_CLICK_TO_OPEN_STORE);
|
|
clif_search_store_info_failed(sd, SSI_FAILED_SSILIST_CLICK_TO_OPEN_STORE);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- switch( sd->searchstore.effect ) {
|
|
|
|
- case EFFECTTYPE_NORMAL:
|
|
|
|
|
|
+ switch( sd.searchstore.effect ) {
|
|
|
|
+ case SEARCHSTORE_EFFECT_NORMAL:
|
|
// display coords
|
|
// display coords
|
|
- if( sd->bl.m != pl_sd->bl.m ) // not on same map, wipe previous marker
|
|
|
|
|
|
+ if( sd.bl.m != pl_sd->bl.m ) // not on same map, wipe previous marker
|
|
clif_search_store_info_click_ack(sd, -1, -1);
|
|
clif_search_store_info_click_ack(sd, -1, -1);
|
|
else
|
|
else
|
|
clif_search_store_info_click_ack(sd, pl_sd->bl.x, pl_sd->bl.y);
|
|
clif_search_store_info_click_ack(sd, pl_sd->bl.x, pl_sd->bl.y);
|
|
break;
|
|
break;
|
|
- case EFFECTTYPE_CASH:
|
|
|
|
|
|
+ case SEARCHSTORE_EFFECT_REMOTE:
|
|
// open remotely
|
|
// open remotely
|
|
// to bypass range checks
|
|
// to bypass range checks
|
|
- sd->searchstore.remote_id = account_id;
|
|
|
|
|
|
+ sd.searchstore.remote_id = account_id;
|
|
|
|
|
|
- switch( sd->searchstore.type ) {
|
|
|
|
- case SEARCHTYPE_VENDING: vending_vendinglistreq(sd, account_id); break;
|
|
|
|
- case SEARCHTYPE_BUYING_STORE: buyingstore_open(sd, account_id); break;
|
|
|
|
|
|
+ switch( sd.searchstore.type ) {
|
|
|
|
+ case SEARCHTYPE_VENDING: vending_vendinglistreq(&sd, account_id); break;
|
|
|
|
+ case SEARCHTYPE_BUYING_STORE: buyingstore_open(&sd, account_id); break;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
// unknown
|
|
// unknown
|
|
- ShowError("searchstore_click: Unknown search store effect %u (account_id=%d).\n", (unsigned int)sd->searchstore.effect, sd->bl.id);
|
|
|
|
|
|
+ ShowError("searchstore_click: Unknown search store effect %u (account_id=%d).\n", sd.searchstore.effect, sd.bl.id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -363,16 +342,16 @@ void searchstore_click(map_session_data* sd, uint32 account_id, int store_id, t_
|
|
* @param account_id : account ID of owner's shop
|
|
* @param account_id : account ID of owner's shop
|
|
* @return : true : shop opened, false : shop not opened
|
|
* @return : true : shop opened, false : shop not opened
|
|
*/
|
|
*/
|
|
-bool searchstore_queryremote(map_session_data* sd, uint32 account_id)
|
|
|
|
|
|
+bool searchstore_queryremote(map_session_data& sd, uint32 account_id)
|
|
{
|
|
{
|
|
- return (bool)( sd->searchstore.open && !sd->searchstore.items.empty() && sd->searchstore.remote_id == account_id );
|
|
|
|
|
|
+ return (bool)( sd.searchstore.open && !sd.searchstore.items.empty() && sd.searchstore.remote_id == account_id );
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* Removes range-check bypassing for remotely opened stores.
|
|
* Removes range-check bypassing for remotely opened stores.
|
|
* @param sd : player requesting
|
|
* @param sd : player requesting
|
|
*/
|
|
*/
|
|
-void searchstore_clearremote(map_session_data* sd)
|
|
|
|
|
|
+void searchstore_clearremote(map_session_data& sd)
|
|
{
|
|
{
|
|
- sd->searchstore.remote_id = 0;
|
|
|
|
|
|
+ sd.searchstore.remote_id = 0;
|
|
}
|
|
}
|