}
for (const auto &kind : store_regular_sale_table.at(sst)) {
- auto k_idx = lookup_kind(kind.tval, kind.sval);
+ auto k_idx = lookup_kind(kind.type_value, kind.subtype_value);
store_ptr->regular.push_back(k_idx);
}
for (const auto &kind : store_sale_table.at(sst)) {
- auto k_idx = lookup_kind(kind.tval, kind.sval);
+ auto k_idx = lookup_kind(kind.type_value, kind.subtype_value);
store_ptr->table.push_back(k_idx);
}
}
#include "store/articles-on-sale.h"
+#include "object/tval-types.h"
+#include "store/store-owners.h"
#include "sv-definition/sv-amulet-types.h"
#include "sv-definition/sv-armor-types.h"
#include "sv-definition/sv-bow-types.h"
#include "sv-definition/sv-staff-types.h"
#include "sv-definition/sv-wand-types.h"
#include "sv-definition/sv-weapon-types.h"
+#include "system/baseitem-info-definition.h"
/*!
* @brief 店舗で常時販売するオブジェクトを定義する
#pragma once
-#include "object/tval-types.h"
-#include "store/store-owners.h"
-#include "store/store.h"
-#include "system/angband.h"
#include <map>
+#include <vector>
-struct BaseitemKey {
- ItemKindType tval;
- OBJECT_SUBTYPE_VALUE sval;
-};
-
+enum class StoreSaleType;
+class BaseitemKey;
extern const std::map<StoreSaleType, std::vector<BaseitemKey>> store_regular_sale_table;
extern const std::map<StoreSaleType, std::vector<BaseitemKey>> store_sale_table;
*/
#include "system/baseitem-info-definition.h"
-#include "system/object-type-definition.h"
+#include "object/tval-types.h"
+
+BaseitemKey::BaseitemKey(ItemKindType type_value, int subtype_value)
+ : type_value(type_value)
+ , subtype_value(subtype_value)
+{
+}
+
+bool BaseitemKey::operator==(const BaseitemKey &other) const
+{
+ return (this->type_value == other.type_value) && (this->subtype_value == other.subtype_value);
+}
+
+// @details type_valueに大小があればそれを判定し、同一ならばsubtype_valueの大小を判定する.
+bool BaseitemKey::operator<(const BaseitemKey &other) const
+{
+ if (this->type_value < other.type_value) {
+ return true;
+ }
+
+ if (this->type_value > other.type_value) {
+ return false;
+ }
+
+ return this->subtype_value < other.subtype_value;
+}
+
+ItemKindType BaseitemKey::tval() const
+{
+ return this->type_value;
+}
+
+int BaseitemKey::sval() const
+{
+ return this->subtype_value;
+}
-/*
- * The object kind arrays
- */
std::vector<BaseItemInfo> baseitems_info;
#include "object-enchant/trg-types.h"
#include "system/angband.h"
#include "util/flag-group.h"
+#include <optional>
#include <string>
#include <vector>
enum class ItemKindType : short;
+class BaseitemKey {
+public:
+ BaseitemKey(ItemKindType type_value, int subtype_value);
+ bool operator==(const BaseitemKey &other) const;
+ bool operator!=(const BaseitemKey &other) const
+ {
+ return !(*this == other);
+ }
+
+ bool operator<(const BaseitemKey &other) const;
+ bool operator>(const BaseitemKey &other) const
+ {
+ return other < *this;
+ }
+
+ bool operator<=(const BaseitemKey &other) const
+ {
+ return !(*this > other);
+ }
+
+ bool operator>=(const BaseitemKey &other) const
+ {
+ return !(*this < other);
+ }
+
+ ItemKindType tval() const;
+ int sval() const;
+
+ /*
+ * @todo アクセシビリティによるコンパイルエラーを避けるための一時的措置.
+ * @details svalは後でoptionalにする.
+ */
+ ItemKindType type_value;
+ int subtype_value;
+
+private:
+};
+
+enum class ItemKindType : short;
enum class RandomArtActType : short;
class BaseItemInfo {
public: