diff --git a/src/map/cashshop.c b/src/map/cashshop.c index 3f6dc6266c..9906da36e2 100644 --- a/src/map/cashshop.c +++ b/src/map/cashshop.c @@ -12,6 +12,7 @@ #include // atoi struct cash_item_db cash_shop_items[CASHSHOP_TAB_SEARCH]; +bool cash_shop_defined = false; extern char item_cash_db_db[32]; extern char item_cash_db2_db[32]; @@ -51,7 +52,7 @@ static int cashshop_parse_dbrow( char** str, const char* source, int line ){ cid->nameid = nameid; cid->price = price; - + cash_shop_defined = true; return 1; }else{ ShowWarning( "cashshop_parse_dbrow: Invalid ID %hu in line %d of \"%s\", skipping...\n", nameid, line, source ); @@ -201,7 +202,7 @@ bool cashshop_buylist( struct map_session_data* sd, uint32 kafrapoints, int n, u uint32 totalweight = 0; int i,new_; - if( sd == NULL || item_list == NULL ){ + if( sd == NULL || item_list == NULL || !cash_shop_defined){ clif_cashshop_result( sd, 0, CASHSHOP_RESULT_ERROR_UNKNOWN ); return false; }else if( sd->state.trading ){ @@ -329,5 +330,6 @@ void do_final_cashshop( void ){ * 0 : success */ void do_init_cashshop( void ){ + cash_shop_defined = false; cashshop_read_db(); } diff --git a/src/map/cashshop.h b/src/map/cashshop.h index e06c33f3ba..801f2852b4 100644 --- a/src/map/cashshop.h +++ b/src/map/cashshop.h @@ -55,5 +55,6 @@ struct cash_item_db{ }; extern struct cash_item_db cash_shop_items[CASHSHOP_TAB_SEARCH]; +extern bool cash_shop_defined; #endif /* _CASHSHOP_H_ */ diff --git a/src/map/clif.c b/src/map/clif.c index 25109c010d..c89a181786 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -15351,7 +15351,7 @@ void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) { info = &packet_db[sd->packet_ver][cmd]; - if( sd->state.trading || !sd->npc_shopid ) { + if( sd->state.trading || !sd->npc_shopid || !cash_shop_defined) { clif_cashshop_ack(sd,1); return; } else {