OSDN Git Service

8578d4be4dd03e140a9986d3b792af8e2cf7d3d6
[hengband/hengband.git] / src / market / black-market.c
1 #include "angband.h"
2 #include "floor/floor-town.h"
3 #include "object-hook.h"
4 #include "market/black-market.h"
5 #include "market/store-owners.h"
6 #include "market/store-util.h"
7
8 /*!
9  * @brief ブラックマーケット用の無価値品の排除判定 /
10  * This function will keep 'crap' out of the black market.
11  * @param player_ptr プレーヤーへの参照ポインタ
12  * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
13  * @return ブラックマーケットにとって無価値な品ならばTRUEを返す
14  * @details
15  * <pre>
16  * Crap is defined as any item that is "available" elsewhere
17  * Based on a suggestion by "Lee Vogt" <lvogt@cig.mcel.mot.com>
18  * </pre>
19  */
20 bool black_market_crap(player_type *player_ptr, object_type *o_ptr)
21 {
22         if (object_is_ego(o_ptr)) return FALSE;
23
24         if (o_ptr->to_a > 0) return FALSE;
25         if (o_ptr->to_h > 0) return FALSE;
26         if (o_ptr->to_d > 0) return FALSE;
27
28         for (int i = 0; i < MAX_STORES; i++)
29         {
30                 if (i == STORE_HOME) continue;
31                 if (i == STORE_MUSEUM) continue;
32
33                 for (int j = 0; j < town_info[player_ptr->town_num].store[i].stock_num; j++)
34                 {
35                         object_type *j_ptr = &town_info[player_ptr->town_num].store[i].stock[j];
36                         if (o_ptr->k_idx == j_ptr->k_idx) return TRUE;
37                 }
38         }
39
40         return FALSE;
41 }