static void decide_activation_level(ae_type *ae_ptr)
{
if (ae_ptr->o_ptr->is_fixed_artifact()) {
- ae_ptr->lev = a_info[enum2i(ae_ptr->o_ptr->fixed_artifact_idx)].level;
+ ae_ptr->lev = a_info.at(ae_ptr->o_ptr->fixed_artifact_idx).level;
return;
}
return act_idx.value();
}
- const auto fixed_art_id = enum2i(o_ptr->fixed_artifact_idx);
- if (o_ptr->is_fixed_artifact() && a_info[fixed_art_id].flags.has(TR_ACTIVATE)) {
- return a_info[fixed_art_id].act_idx;
+ const auto &fixed_artifact = a_info.at(o_ptr->fixed_artifact_idx);
+ if (o_ptr->is_fixed_artifact() && fixed_artifact.flags.has(TR_ACTIVATE)) {
+ return fixed_artifact.act_idx;
}
if (o_ptr->is_ego() && e_info[o_ptr->ego_idx].flags.has(TR_ACTIVATE)) {
*/
std::unique_ptr<ArtifactType> apply_artifact(PlayerType *player_ptr, ObjectType *o_ptr)
{
- auto a_ptr = std::make_unique<ArtifactType>(a_info[enum2i(o_ptr->fixed_artifact_idx)]);
+ auto a_ptr = std::make_unique<ArtifactType>(a_info.at(o_ptr->fixed_artifact_idx));
o_ptr->pval = a_ptr->pval;
o_ptr->ac = a_ptr->ac;
o_ptr->dd = a_ptr->dd;
*/
bool create_named_art(PlayerType *player_ptr, FixedArtifactId a_idx, POSITION y, POSITION x)
{
- auto a_ptr = &a_info[enum2i(a_idx)];
+ auto a_ptr = &a_info.at(a_idx);
if (a_ptr->name.empty()) {
return false;
}
return false;
}
- for (const auto &a_ref : a_info) {
+ for (const auto &[a_idx, a_ref] : a_info) {
if (a_ref.name.empty()) {
continue;
}
continue;
}
- o_ptr->fixed_artifact_idx = a_ref.idx;
+ o_ptr->fixed_artifact_idx = a_idx;
return true;
}
}
/*! @note 全固定アーティファクト中からIDの若い順に生成対象とその確率を走査する / Check the artifact list (just the "specials") */
- for (const auto &a_ref : a_info) {
+ for (const auto &[a_idx, a_ref] : a_info) {
/*! @note アーティファクト名が空の不正なデータは除外する / Skip "empty" artifacts */
if (a_ref.name.empty()) {
continue;
continue;
}
- /*! @note アーティファクト生成階が現在に対して足りない場合は高確率で1/(不足階層*2)を満たさないと生成リストに加えられない /
- * XXX XXX Enforce minimum "depth" (loosely) */
+ /*! @note アーティファクト生成階が現在に対して足りない場合は高確率で1/(不足階層*2)を満たさないと生成リストに加えられない */
if (a_ref.level > floor_ptr->object_level) {
/* @note / Acquire the "out-of-depth factor". Roll for out-of-depth creation. */
int d = (a_ref.level - floor_ptr->object_level) * 2;
continue;
}
- /*! @note INSTA_ART型固定アーティファクトのベースアイテムもチェック対象とする。ベースアイテムの生成階層が足りない場合1/(不足階層*5)
- * を満たさないと除外される。 / Find the base object. XXX XXX Enforce minimum "object" level (loosely). Acquire the "out-of-depth factor". Roll for
- * out-of-depth creation. */
+ /*!
+ * @note INSTA_ART型固定アーティファクトのベースアイテムもチェック対象とする。
+ * ベースアイテムの生成階層が足りない場合1/(不足階層*5)を満たさないと除外される。
+ */
k_idx = lookup_kind(a_ref.tval, a_ref.sval);
if (k_info[k_idx].level > floor_ptr->object_level) {
int d = (k_info[k_idx].level - floor_ptr->object_level) * 5;
* Assign the template. Mega-Hack -- mark the item as an artifact. Hack: Some artifacts get random extra powers. Success. */
o_ptr->prep(k_idx);
- o_ptr->fixed_artifact_idx = a_ref.idx;
+ o_ptr->fixed_artifact_idx = a_idx;
return true;
}
(&player_ptr->inventory_list[i])->wipe();
}
- for (auto &a_ref : a_info) {
+ for (auto &[a_idx, a_ref] : a_info) {
a_ref.is_generated = false;
}
if (!o_idx) {
msg_format(_("%sはどこかへ行った。", "The %s went somewhere."), o_name);
if (q_ptr->is_fixed_artifact()) {
- const auto fixed_artifact_idx = enum2i(j_ptr->fixed_artifact_idx);
- a_info[fixed_artifact_idx].is_generated = false;
+ a_info.at(j_ptr->fixed_artifact_idx).is_generated = false;
}
return;
}
quest_list[QuestId::TOWER1].complev = player_ptr->lev;
break;
case QuestKindType::FIND_ARTIFACT:
- a_info[enum2i(q_ptr->reward_artifact_idx)].gen_flags.reset(ItemGenerationTraitType::QUESTITEM);
+ a_info.at(q_ptr->reward_artifact_idx).gen_flags.reset(ItemGenerationTraitType::QUESTITEM);
break;
case QuestKindType::RANDOM:
r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
flgs.reset(k_ptr->flags);
if (o_ptr->is_fixed_artifact()) {
- auto *a_ptr = &a_info[enum2i(o_ptr->fixed_artifact_idx)];
- flgs.reset(a_ptr->flags);
+ const auto &a_ref = a_info.at(o_ptr->fixed_artifact_idx);
+ flgs.reset(a_ref.flags);
}
if (o_ptr->is_ego()) {
return;
}
- const auto fixed_art_id = enum2i(flavor_ptr->o_ptr->fixed_artifact_idx);
- flavor_ptr->basenm = (flavor_ptr->known && flavor_ptr->o_ptr->is_fixed_artifact() && !any_bits(flavor_ptr->mode, OD_BASE_NAME)) ? a_info[fixed_art_id].name.c_str() : flavor_ptr->kindname;
+ const auto fixed_art_id = flavor_ptr->o_ptr->fixed_artifact_idx;
+ const auto is_known_artifact = flavor_ptr->known && flavor_ptr->o_ptr->is_fixed_artifact() && none_bits(flavor_ptr->mode, OD_BASE_NAME);
+ flavor_ptr->basenm = is_known_artifact ? a_info.at(fixed_art_id).name.c_str() : flavor_ptr->kindname;
}
#ifdef JP
}
if (flavor_ptr->o_ptr->is_fixed_artifact() && flavor_ptr->tr_flags.has_not(TR_FULL_NAME)) {
- auto *a_ptr = &a_info[enum2i(flavor_ptr->o_ptr->fixed_artifact_idx)];
+ const auto &a_ref = a_info.at(flavor_ptr->o_ptr->fixed_artifact_idx);
/* '『' から始まらない伝説のアイテムの名前は最初に付加する */
- if (a_ptr->name.find("『", 0, 2) != 0) {
- flavor_ptr->t = object_desc_str(flavor_ptr->t, a_ptr->name.c_str());
+ if (a_ref.name.find("『", 0, 2) != 0) {
+ flavor_ptr->t = object_desc_str(flavor_ptr->t, a_ref.name.c_str());
}
return;
}
if (flavor_ptr->o_ptr->is_fixed_artifact()) {
- auto *a_ptr = &a_info[enum2i(flavor_ptr->o_ptr->fixed_artifact_idx)];
- if (a_ptr->name.find("『", 0, 2) == 0) {
- flavor_ptr->t = object_desc_str(flavor_ptr->t, a_ptr->name.c_str());
+ const auto &a_ref = a_info.at(flavor_ptr->o_ptr->fixed_artifact_idx);
+ if (a_ref.name.find("『", 0, 2) == 0) {
+ flavor_ptr->t = object_desc_str(flavor_ptr->t, a_ref.name.c_str());
}
return;
}
/*!
- * @brief 0個、1個、2個以上の時に個数を書き分ける処理 / Process to write the number when there are 0, 1, or 2 or more.
- * @param flavor_ptr アイテム表記への参照ポインタ / Reference pointer to item's flavor
- * @return 1個ならFALSE、0または2個以上ならTRUE / If the number of items is 1, then FALE is returned, and if 0 or 2 or more, then TRUE is returned
- * @details 1個なら後続処理実行 / If the number of items is 1, then the continuous process will be run.
+ * @brief Process to write the number of items when there are 0, 1, or 2 or more.
+ * @param flavor_ptr Reference pointer to item's flavor
+ * @return If the number of items is 1, then FALE is returned, and if 0 or 2 or more, then TRUE is returned
+ * @details If the number of items is 1, then the continuous process will be run.
*/
static bool describe_prefix_en(flavor_type *flavor_ptr)
{
}
const auto corpse_r_idx = i2enum<MonsterRaceId>(flavor_ptr->o_ptr->pval);
- if ((flavor_ptr->known && flavor_ptr->o_ptr->is_artifact()) || ((flavor_ptr->o_ptr->tval == ItemKindType::CORPSE) && r_info[corpse_r_idx].kind_flags.has(MonsterKindType::UNIQUE))) {
+ auto is_unique_corpse = flavor_ptr->o_ptr->tval == ItemKindType::CORPSE;
+ is_unique_corpse &= r_info[corpse_r_idx].kind_flags.has(MonsterKindType::UNIQUE);
+ if ((flavor_ptr->known && flavor_ptr->o_ptr->is_artifact()) || is_unique_corpse) {
flavor_ptr->t = object_desc_str(flavor_ptr->t, "The ");
return;
}
}
if (flavor_ptr->o_ptr->is_fixed_artifact()) {
- auto *a_ptr = &a_info[enum2i(flavor_ptr->o_ptr->fixed_artifact_idx)];
+ const auto &a_ref = a_info.at(flavor_ptr->o_ptr->fixed_artifact_idx);
flavor_ptr->t = object_desc_chr(flavor_ptr->t, ' ');
- flavor_ptr->t = object_desc_str(flavor_ptr->t, a_ptr->name.c_str());
+ flavor_ptr->t = object_desc_str(flavor_ptr->t, a_ref.name.c_str());
return;
}
return;
}
- const auto int_artifact_index = enum2i(artifact_index);
- if (!a_info[int_artifact_index].is_generated && create_named_art(player_ptr, artifact_index, *qtwg_ptr->y, *qtwg_ptr->x)) {
- a_info[int_artifact_index].is_generated = true;
+ auto &fixed_artifact = a_info.at(artifact_index);
+ if (!fixed_artifact.is_generated && create_named_art(player_ptr, artifact_index, *qtwg_ptr->y, *qtwg_ptr->x)) {
+ fixed_artifact.is_generated = true;
return;
}
return true;
}
- monster_race *r_ptr;
- ArtifactType *a_ptr;
-
if (num < 9) {
return true;
}
q_ptr->max_num = (MONSTER_NUMBER)atoi(zz[5]);
q_ptr->level = (DEPTH)atoi(zz[6]);
q_ptr->r_idx = i2enum<MonsterRaceId>(atoi(zz[7]));
- q_ptr->reward_artifact_idx = i2enum<FixedArtifactId>(atoi(zz[8]));
+ const auto a_idx = i2enum<FixedArtifactId>(atoi(zz[8]));
+ q_ptr->reward_artifact_idx = a_idx;
q_ptr->dungeon = (DUNGEON_IDX)atoi(zz[9]);
if (num > 10) {
q_ptr->flags = atoi(zz[10]);
}
- r_ptr = &r_info[q_ptr->r_idx];
- if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE)) {
- r_ptr->flags1 |= RF1_QUESTOR;
+ auto &r_ref = r_info[q_ptr->r_idx];
+ if (r_ref.kind_flags.has(MonsterKindType::UNIQUE)) {
+ r_ref.flags1 |= RF1_QUESTOR;
+ }
+
+ if (a_idx == FixedArtifactId::NONE) {
+ return true;
+ }
+
+ // @note 半分デッドコード。reward_artifact_idx が定義されているクエストが1つもない.
+ if (const auto it = a_info.find(a_idx); it == a_info.end()) {
+ return true;
}
- a_ptr = &a_info[enum2i(q_ptr->reward_artifact_idx)];
- a_ptr->gen_flags.set(ItemGenerationTraitType::QUESTITEM);
+ auto &a_ref = a_info.at(q_ptr->reward_artifact_idx);
+ a_ref.gen_flags.set(ItemGenerationTraitType::QUESTITEM);
return true;
}
continue;
}
- if (a_info[enum2i(a_idx)].is_generated) {
+ if (a_info.at(a_idx).is_generated) {
continue;
}
if (reward_idx != FixedArtifactId::NONE) {
q_ptr->reward_artifact_idx = reward_idx;
- a_info[enum2i(reward_idx)].gen_flags.set(ItemGenerationTraitType::QUESTITEM);
+ a_info.at(reward_idx).gen_flags.set(ItemGenerationTraitType::QUESTITEM);
} else {
q_ptr->type = QuestKindType::KILL_ALL;
}
}
if (o_ptr->is_fixed_artifact()) {
- a_info[enum2i(o_ptr->fixed_artifact_idx)].floor_id = cur_floor_id;
+ a_info.at(o_ptr->fixed_artifact_idx).floor_id = cur_floor_id;
}
}
}
continue;
}
- const auto fixed_artifact_idx = enum2i(o_ptr->fixed_artifact_idx);
- if (a_info[fixed_artifact_idx].floor_id == new_floor_id) {
- a_info[fixed_artifact_idx].is_generated = true;
+ auto &fixed_artifact = a_info.at(o_ptr->fixed_artifact_idx);
+ if (fixed_artifact.floor_id == new_floor_id) {
+ fixed_artifact.is_generated = true;
} else {
delete_object_idx(player_ptr, i);
}
}
if (o_ptr->is_fixed_artifact()) {
- a_info[enum2i(o_ptr->fixed_artifact_idx)].floor_id = 0;
+ a_info.at(o_ptr->fixed_artifact_idx).floor_id = 0;
}
}
}
if (preserve_mode) {
if (j_ptr->is_fixed_artifact() && !j_ptr->is_known()) {
- const auto fixed_artifact_idx = enum2i(j_ptr->fixed_artifact_idx);
- a_info[fixed_artifact_idx].is_generated = false;
+ a_info.at(j_ptr->fixed_artifact_idx).is_generated = false;
}
}
}
if (j_ptr->is_fixed_artifact()) {
- const auto fixed_artifact_idx = enum2i(j_ptr->fixed_artifact_idx);
- a_info[fixed_artifact_idx].is_generated = false;
+ a_info.at(j_ptr->fixed_artifact_idx).is_generated = false;
}
return 0;
/* Hack -- Preserve unknown artifacts */
if (o_ptr->is_fixed_artifact()) {
- a_info[enum2i(o_ptr->fixed_artifact_idx)].is_generated = false;
+ a_info.at(o_ptr->fixed_artifact_idx).is_generated = false;
if (cheat_peek) {
GAME_TEXT o_name[MAX_NLEN];
if (!w_ptr->character_dungeon || preserve_mode) {
if (o_ptr->is_fixed_artifact() && !o_ptr->is_known()) {
- a_info[enum2i(o_ptr->fixed_artifact_idx)].is_generated = false;
+ a_info.at(o_ptr->fixed_artifact_idx).is_generated = false;
}
}
OBJECT_IDX o_idx = o_pop(floor_ptr);
if (o_idx == 0) {
if (q_ptr->is_fixed_artifact()) {
- const auto fixed_artifact_idx = enum2i(q_ptr->fixed_artifact_idx);
- a_info[fixed_artifact_idx].is_generated = false;
+ a_info.at(q_ptr->fixed_artifact_idx).is_generated = false;
}
return;
#include "info-reader/artifact-reader.h"
+#include "artifact/fixed-art-types.h"
#include "artifact/random-art-effects.h"
#include "info-reader/info-reader-util.h"
#include "info-reader/kind-info-tokens-table.h"
* @param buf テキスト列
* @param head ヘッダ構造体
* @return エラーコード
+ * @todo static ArtifactType *a_ptr は設計変更で不要にできるかもしれない (mapの最終要素を取り出せば良い)
*/
errr parse_a_info(std::string_view buf, angband_header *)
{
return PARSE_ERROR_GENERIC;
}
- auto i = std::stoi(tokens[1]);
- if (i < error_idx) {
+ const auto int_idx = std::stoi(tokens[1]);
+ const auto a_idx = i2enum<FixedArtifactId>(int_idx);
+ if (int_idx < error_idx) {
return PARSE_ERROR_NON_SEQUENTIAL_RECORDS;
}
- if (i >= static_cast<int>(a_info.size())) {
- a_info.resize(i + 1);
- }
- error_idx = i;
- a_ptr = &a_info[i];
- a_ptr->idx = i2enum<FixedArtifactId>(i);
+ error_idx = int_idx;
+ ArtifactType artifact;
+ a_info.emplace(a_idx, artifact);
+ a_ptr = &a_info.at(a_idx);
a_ptr->flags.set(TR_IGNORE_ACID);
a_ptr->flags.set(TR_IGNORE_ELEC);
a_ptr->flags.set(TR_IGNORE_FIRE);
a_ptr->flags.set(TR_IGNORE_COLD);
-
#ifdef JP
a_ptr->name = tokens[2];
#endif
const auto &quest_list = QuestList::get_instance();
const auto a_idx = quest_list[floor_ptr->quest_number].reward_artifact_idx;
if (a_idx != FixedArtifactId::NONE) {
- const auto *a_ptr = &a_info[enum2i(a_idx)];
- if (a_ptr->gen_flags.has_not(ItemGenerationTraitType::INSTA_ART)) {
- letter[index].object = lookup_kind(a_ptr->tval, a_ptr->sval);
+ const auto &a_ref = a_info.at(a_idx);
+ if (a_ref.gen_flags.has_not(ItemGenerationTraitType::INSTA_ART)) {
+ letter[index].object = lookup_kind(a_ref.tval, a_ref.sval);
}
}
}
okay.emplace(i2enum<FixedArtifactId>(i), false);
}
- for (const auto &a_ref : a_info) {
+ for (const auto &[a_idx, a_ref] : a_info) {
if (a_ref.name.empty()) {
continue;
}
continue;
}
- okay[a_ref.idx] = true;
+ okay[a_idx] = true;
}
for (POSITION y = 0; y < player_ptr->current_floor_ptr->height; y++) {
}
std::vector<FixedArtifactId> whats;
- for (const auto &a_ref : a_info) {
- if (okay[a_ref.idx]) {
- whats.push_back(a_ref.idx);
+ for (const auto &[a_idx, a_ref] : a_info) {
+ if (okay[a_idx]) {
+ whats.push_back(a_idx);
}
}
uint16_t why = 3;
ang_sort(player_ptr, whats.data(), &why, whats.size(), ang_sort_art_comp, ang_sort_art_swap);
for (auto a_idx : whats) {
- auto *a_ptr = &a_info[enum2i(a_idx)];
+ const auto &a_ref = a_info.at(a_idx);
GAME_TEXT base_name[MAX_NLEN];
strcpy(base_name, _("未知の伝説のアイテム", "Unknown Artifact"));
- const auto z = lookup_kind(a_ptr->tval, a_ptr->sval);
+ const auto z = lookup_kind(a_ref.tval, a_ref.sval);
if (z != 0) {
ObjectType forge;
ObjectType *q_ptr;
case QuestKindType::FIND_ARTIFACT:
if (q_ref.reward_artifact_idx != FixedArtifactId::NONE) {
- auto *a_ptr = &a_info[enum2i(q_ref.reward_artifact_idx)];
+ const auto &a_ref = a_info.at(q_ref.reward_artifact_idx);
ObjectType forge;
auto *o_ptr = &forge;
- KIND_OBJECT_IDX k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
+ KIND_OBJECT_IDX k_idx = lookup_kind(a_ref.tval, a_ref.sval);
o_ptr->prep(k_idx);
o_ptr->fixed_artifact_idx = q_ref.reward_artifact_idx;
o_ptr->ident = IDENT_STORE;
#include "load/item/item-loader-base.h"
+#include "artifact/fixed-art-types.h"
#include "load/angband-version-comparer.h"
#include "load/load-util.h"
#include "object/object-kind.h"
#include "system/artifact-type-definition.h"
#include "util/bit-flags-calculator.h"
+#include "util/enum-converter.h"
/*!
* @brief アイテムオブジェクトの鑑定情報をロードする.
*/
void ItemLoaderBase::load_artifact(void)
{
- auto loading_max_a_idx = rd_u16b();
ArtifactType dummy;
+ auto loading_max_a_idx = rd_u16b();
for (auto i = 0U; i < loading_max_a_idx; i++) {
- auto *a_ptr = i < a_info.size() ? &a_info[i] : &dummy;
- a_ptr->is_generated = rd_bool();
+ const auto a_idx = i2enum<FixedArtifactId>(i);
+ const auto it = a_info.find(a_idx);
+ auto &artifact = it != a_info.end() ? it->second : dummy;
+ artifact.is_generated = rd_bool();
if (h_older_than(1, 5, 0, 0)) {
- a_ptr->floor_id = 0;
+ artifact.floor_id = 0;
strip_bytes(3);
} else {
- a_ptr->floor_id = rd_s16b();
+ artifact.floor_id = rd_s16b();
}
}
o_ptr->curse_flags.set(CurseTraitType::PERMA_CURSE);
}
if (o_ptr->is_fixed_artifact()) {
- auto *a_ptr = &a_info[enum2i(o_ptr->fixed_artifact_idx)];
- if (a_ptr->gen_flags.has(ItemGenerationTraitType::HEAVY_CURSE)) {
+ const auto &a_ref = a_info.at(o_ptr->fixed_artifact_idx);
+ if (a_ref.gen_flags.has(ItemGenerationTraitType::HEAVY_CURSE)) {
o_ptr->curse_flags.set(CurseTraitType::HEAVY_CURSE);
}
- if (a_ptr->gen_flags.has(ItemGenerationTraitType::PERMA_CURSE)) {
+ if (a_ref.gen_flags.has(ItemGenerationTraitType::PERMA_CURSE)) {
o_ptr->curse_flags.set(CurseTraitType::PERMA_CURSE);
}
} else if (o_ptr->is_ego()) {
- auto *e_ptr = &e_info[o_ptr->ego_idx];
- if (e_ptr->gen_flags.has(ItemGenerationTraitType::HEAVY_CURSE)) {
+ const auto &e_ref = e_info[o_ptr->ego_idx];
+ if (e_ref.gen_flags.has(ItemGenerationTraitType::HEAVY_CURSE)) {
o_ptr->curse_flags.set(CurseTraitType::HEAVY_CURSE);
}
- if (e_ptr->gen_flags.has(ItemGenerationTraitType::PERMA_CURSE)) {
+ if (e_ref.gen_flags.has(ItemGenerationTraitType::PERMA_CURSE)) {
o_ptr->curse_flags.set(CurseTraitType::PERMA_CURSE);
}
}
}
if (o_ptr->is_fixed_artifact()) {
- const auto *a_ptr = &a_info[enum2i(o_ptr->fixed_artifact_idx)];
- if (a_ptr->name.empty()) {
+ const auto &a_ref = a_info.at(o_ptr->fixed_artifact_idx);
+ if (a_ref.name.empty()) {
o_ptr->fixed_artifact_idx = FixedArtifactId::NONE;
}
}
if (o_ptr->is_ego()) {
- auto *e_ptr = &e_info[o_ptr->ego_idx];
- if (e_ptr->name.empty()) {
+ const auto &e_ref = e_info[o_ptr->ego_idx];
+ if (e_ref.name.empty()) {
o_ptr->ego_idx = EgoType::NONE;
}
}
}
q_ptr->reward_artifact_idx = i2enum<FixedArtifactId>(rd_s16b());
if (q_ptr->reward_artifact_idx != FixedArtifactId::NONE) {
- a_info[enum2i(q_ptr->reward_artifact_idx)].gen_flags.set(ItemGenerationTraitType::QUESTITEM);
+ a_info.at(q_ptr->reward_artifact_idx).gen_flags.set(ItemGenerationTraitType::QUESTITEM);
}
q_ptr->flags = rd_byte();
*/
bool drop_single_artifact(PlayerType *player_ptr, monster_death_type *md_ptr, FixedArtifactId a_idx)
{
- auto *a_ptr = &a_info[enum2i(a_idx)];
- if (a_ptr->is_generated) {
+ auto &a_ref = a_info.at(a_idx);
+ if (a_ref.is_generated) {
return false;
}
if (create_named_art(player_ptr, a_idx, md_ptr->md_y, md_ptr->md_x)) {
- a_ptr->is_generated = true;
+ a_ref.is_generated = true;
if (w_ptr->character_dungeon) {
- a_ptr->floor_id = player_ptr->floor_id;
+ a_ref.floor_id = player_ptr->floor_id;
}
if (!preserve_mode) {
- a_ptr->is_generated = true;
+ a_ref.is_generated = true;
}
return true;
}
a_idx = d_info[player_ptr->dungeon_idx].final_artifact;
- auto *a_ptr = &a_info[enum2i(a_idx)];
- if (a_ptr->is_generated) {
+ auto &a_ref = a_info.at(a_idx);
+ if (a_ref.is_generated) {
return k_idx;
}
if (create_named_art(player_ptr, a_idx, md_ptr->md_y, md_ptr->md_x)) {
- a_ptr->is_generated = true;
+ a_ref.is_generated = true;
if (w_ptr->character_dungeon) {
- a_ptr->floor_id = player_ptr->floor_id;
+ a_ref.floor_id = player_ptr->floor_id;
}
} else if (!preserve_mode) {
- a_ptr->is_generated = true;
+ a_ref.is_generated = true;
}
return d_info[player_ptr->dungeon_idx].final_object ? k_idx : 0;
break;
}
- a_ptr = &a_info[enum2i(a_idx)];
+ a_ptr = &a_info.at(a_idx);
} while (a_ptr->is_generated);
if (create_named_art(player_ptr, a_idx, md_ptr->md_y, md_ptr->md_x)) {
return false;
}
- auto *a_ptr = &a_info[enum2i(a_idx)];
- if (a_ptr->gen_flags.has(ItemGenerationTraitType::INSTA_ART)) {
+ const auto &a_ref = a_info.at(a_idx);
+ if (a_ref.gen_flags.has(ItemGenerationTraitType::INSTA_ART)) {
return false;
}
- return (o_ptr->tval == a_ptr->tval) && (o_ptr->sval == a_ptr->sval);
+ return (o_ptr->tval == a_ref.tval) && (o_ptr->sval == a_ref.sval);
}
auto flgs = k_ptr->flags;
if (o_ptr->is_fixed_artifact()) {
- flgs = a_info[enum2i(o_ptr->fixed_artifact_idx)].flags;
+ flgs = a_info.at(o_ptr->fixed_artifact_idx).flags;
}
object_flags_lite(o_ptr, flgs);
object_flags_lite(o_ptr, flgs);
if (spoil || o_ptr->is_fully_known()) {
if (o_ptr->is_fixed_artifact()) {
- flgs = a_info[enum2i(o_ptr->fixed_artifact_idx)].flags;
+ flgs = a_info.at(o_ptr->fixed_artifact_idx).flags;
}
/* Random artifact ! */
flgs.reset(k_ptr->flags);
if (o_ptr->is_fixed_artifact()) {
- auto *a_ptr = &a_info[enum2i(o_ptr->fixed_artifact_idx)];
- flgs.reset(a_ptr->flags);
+ const auto &a_ref = a_info.at(o_ptr->fixed_artifact_idx);
+ flgs.reset(a_ref.flags);
} else if (o_ptr->is_ego()) {
- auto *e_ptr = &e_info[o_ptr->ego_idx];
- flgs.reset(e_ptr->flags);
+ const auto &e_ref = e_info[o_ptr->ego_idx];
+ flgs.reset(e_ref.flags);
}
/*
PRICE value = k_info[o_ptr->k_idx].cost;
auto flgs = object_flags(o_ptr);
if (o_ptr->is_fixed_artifact()) {
- auto *a_ptr = &a_info[enum2i(o_ptr->fixed_artifact_idx)];
- if (!a_ptr->cost) {
+ const auto &a_ref = a_info.at(o_ptr->fixed_artifact_idx);
+ if (!a_ref.cost) {
return 0;
}
- value = a_ptr->cost;
+ value = a_ref.cost;
value += flag_cost(o_ptr, o_ptr->pval);
return value;
} else if (o_ptr->is_ego()) {
- auto *e_ptr = &e_info[o_ptr->ego_idx];
- if (!e_ptr->cost) {
+ const auto &e_ref = e_info[o_ptr->ego_idx];
+ if (!e_ref.cost) {
return 0;
}
- value += e_ptr->cost;
+ value += e_ref.cost;
value += flag_cost(o_ptr, o_ptr->pval);
} else {
if (o_ptr->art_flags.any()) {
int trivial_info = 0;
auto flgs = object_flags(o_ptr);
- shape_buffer(o_ptr->is_fixed_artifact() ? a_info[enum2i(o_ptr->fixed_artifact_idx)].text.c_str() : k_info[o_ptr->k_idx].text.c_str(), 77 - 15, temp, sizeof(temp));
+ const auto item_text = o_ptr->is_fixed_artifact() ? a_info.at(o_ptr->fixed_artifact_idx).text.c_str() : k_info[o_ptr->k_idx].text.c_str();
+ shape_buffer(item_text, 77 - 15, temp, sizeof(temp));
int i = 0;
for (int j = 0; temp[j]; j += 1 + strlen(&temp[j])) {
q_ptr->curse_flags.clear();
if (o_ptr->is_fixed_artifact()) {
- const auto fixed_artifact_idx = enum2i(o_ptr->fixed_artifact_idx);
- level = (level + std::max(a_info[fixed_artifact_idx].level - 8, 5)) / 2;
- level += std::min(20, a_info[fixed_artifact_idx].rarity / (a_info[fixed_artifact_idx].gen_flags.has(ItemGenerationTraitType::INSTA_ART) ? 10 : 3));
+ const auto &fixed_artifact = a_info.at(o_ptr->fixed_artifact_idx);
+ level = (level + std::max(fixed_artifact.level - 8, 5)) / 2;
+ level += std::min(20, fixed_artifact.rarity / (fixed_artifact.gen_flags.has(ItemGenerationTraitType::INSTA_ART) ? 10 : 3));
} else if (o_ptr->is_ego()) {
level += std::max(3, (e_info[o_ptr->ego_idx].rating - 5) / 2);
} else if (o_ptr->art_name) {
#include "util/angband-files.h"
#include "view/display-messages.h"
#include "world/world.h"
+#include <algorithm>
/*!
* @brief セーブデータの書き込み /
}
}
- tmp16u = static_cast<uint16_t>(a_info.size());
+ std::vector<short> a_nums;
+ for (const auto &[a_idx, a_ref] : a_info) {
+ a_nums.push_back(enum2i(a_idx));
+ }
+
+ auto max_a_num = *std::max_element(a_nums.begin(), a_nums.end());
+ tmp16u = max_a_num + 1;
wr_u16b(tmp16u);
- for (int i = 0; i < tmp16u; i++) {
- auto *a_ptr = &a_info[i];
- wr_bool(a_ptr->is_generated);
- wr_s16b(a_ptr->floor_id);
+ ArtifactType dummy;
+ for (auto i = 0U; i < tmp16u; i++) {
+ const auto a_idx = i2enum<FixedArtifactId>(i);
+ const auto it = a_info.find(a_idx);
+ const auto &a_ref = it != a_info.end() ? a_info.at(a_idx) : dummy;
+ wr_bool(a_ref.is_generated);
+ wr_s16b(a_ref.floor_id);
}
wr_u32b(w_ptr->sf_play_time);
*/
void get_bloody_moon_flags(ObjectType *o_ptr)
{
- o_ptr->art_flags = a_info[enum2i(FixedArtifactId::BLOOD)].flags;
+ o_ptr->art_flags = a_info.at(FixedArtifactId::BLOOD).flags;
int dummy = randint1(2) + randint1(2);
for (int i = 0; i < dummy; i++) {
/* Hack -- Preserve unknown artifacts */
if (o_ptr->is_fixed_artifact() && (!o_ptr->is_known() || in_generate)) {
- a_info[enum2i(o_ptr->fixed_artifact_idx)].is_generated = false;
+ a_info.at(o_ptr->fixed_artifact_idx).is_generated = false;
if (in_generate && cheat_peek) {
GAME_TEXT o_name[MAX_NLEN];
static std::optional<FixedArtifactId> sweep_amusement_artifact(const bool insta_art, const short k_idx)
{
- for (const auto &a_ref : a_info) {
- if (a_ref.idx == FixedArtifactId::NONE) {
+ for (const auto &[a_idx, a_ref] : a_info) {
+ if (a_idx == FixedArtifactId::NONE) {
continue;
}
continue;
}
- return a_ref.idx;
+ return a_idx;
}
return std::nullopt;
while (true) {
a_idx = i2enum<FixedArtifactId>(rumor_num(zz[1], static_cast<IDX>(a_info.size())));
- a_ptr = &a_info[enum2i(a_idx)];
+ a_ptr = &a_info.at(a_idx);
if (!a_ptr->name.empty()) {
break;
}
/*
* The artifact arrays
*/
-std::vector<ArtifactType> a_info;
+std::map<FixedArtifactId, ArtifactType> a_info;
#include "object-enchant/trg-types.h"
#include "system/object-type-definition.h"
#include "util/flag-group.h"
+#include <map>
#include <string>
-#include <vector>
/*!
* @class ArtifactType
* @brief 固定アーティファクト情報の構造体 / Artifact structure.
- * @details is_generated フィールドのみセーブファイルへの保存対象
+ * @details is_generated ã\81¨floor_id ã\83\95ã\82£ã\83¼ã\83«ã\83\89ã\81®ã\81¿ã\82»ã\83¼ã\83\96ã\83\95ã\82¡ã\82¤ã\83«ã\81¸ã\81®ä¿\9då\98対象
*/
enum class FixedArtifactId : short;
enum class RandomArtActType : short;
class ArtifactType {
public:
ArtifactType() = default;
- FixedArtifactId idx{};
std::string name; /*!< アーティファクト名 / Name */
std::string text; /*!< アーティファクト解説 / Text */
RandomArtActType act_idx{}; /*! 発動能力ID / Activative ability index */
};
-extern std::vector<ArtifactType> a_info;
+extern std::map<FixedArtifactId, ArtifactType> a_info;
#include "util/sort.h"
+#include "artifact/fixed-art-types.h"
#include "dungeon/quest.h"
#include "grid/feature.h"
#include "grid/grid.h"
uint16_t *who = (uint16_t *)(u);
uint16_t *why = (uint16_t *)(v);
- int w1 = who[a];
- int w2 = who[b];
+ const auto w1 = i2enum<FixedArtifactId>(who[a]);
+ const auto w2 = i2enum<FixedArtifactId>(who[b]);
- int z1, z2;
+ int z1;
+ int z2;
/* Sort by total kills */
if (*why >= 3) {
/* Extract total kills */
- z1 = enum2i(a_info[w1].tval);
- z2 = enum2i(a_info[w2].tval);
+ z1 = enum2i(a_info.at(w1).tval);
+ z2 = enum2i(a_info.at(w2).tval);
/* Compare total kills */
if (z1 < z2) {
/* Sort by monster level */
if (*why >= 2) {
/* Extract levels */
- z1 = a_info[w1].sval;
- z2 = a_info[w2].sval;
+ z1 = a_info.at(w1).sval;
+ z2 = a_info.at(w2).sval;
/* Compare levels */
if (z1 < z2) {
/* Sort by monster experience */
if (*why >= 1) {
/* Extract experience */
- z1 = a_info[w1].level;
- z2 = a_info[w2].level;
+ z1 = a_info.at(w1).level;
+ z2 = a_info.at(w2).level;
/* Compare experience */
if (z1 < z2) {
*/
static void analyze_addition(ObjectType *o_ptr, char *addition)
{
- auto *a_ptr = &a_info[enum2i(o_ptr->fixed_artifact_idx)];
+ const auto &a_ref = a_info.at(o_ptr->fixed_artifact_idx);
strcpy(addition, "");
- if (a_ptr->gen_flags.has_all_of({ ItemGenerationTraitType::XTRA_POWER, ItemGenerationTraitType::XTRA_H_RES })) {
+ if (a_ref.gen_flags.has_all_of({ ItemGenerationTraitType::XTRA_POWER, ItemGenerationTraitType::XTRA_H_RES })) {
strcat(addition, _("能力and耐性", "Ability and Resistance"));
- } else if (a_ptr->gen_flags.has(ItemGenerationTraitType::XTRA_POWER)) {
+ } else if (a_ref.gen_flags.has(ItemGenerationTraitType::XTRA_POWER)) {
strcat(addition, _("能力", "Ability"));
- if (a_ptr->gen_flags.has(ItemGenerationTraitType::XTRA_RES_OR_POWER)) {
+ if (a_ref.gen_flags.has(ItemGenerationTraitType::XTRA_RES_OR_POWER)) {
strcat(addition, _("(1/2でand耐性)", "(plus Resistance about 1/2)"));
}
- } else if (a_ptr->gen_flags.has(ItemGenerationTraitType::XTRA_H_RES)) {
+ } else if (a_ref.gen_flags.has(ItemGenerationTraitType::XTRA_H_RES)) {
strcat(addition, _("耐性", "Resistance"));
- if (a_ptr->gen_flags.has(ItemGenerationTraitType::XTRA_RES_OR_POWER)) {
+ if (a_ref.gen_flags.has(ItemGenerationTraitType::XTRA_RES_OR_POWER)) {
strcat(addition, _("(1/2でand能力)", "(plus Ability about 1/2)"));
}
- } else if (a_ptr->gen_flags.has(ItemGenerationTraitType::XTRA_RES_OR_POWER)) {
+ } else if (a_ref.gen_flags.has(ItemGenerationTraitType::XTRA_RES_OR_POWER)) {
strcat(addition, _("能力or耐性", "Ability or Resistance"));
}
- if (a_ptr->gen_flags.has(ItemGenerationTraitType::XTRA_DICE)) {
+ if (a_ref.gen_flags.has(ItemGenerationTraitType::XTRA_DICE)) {
if (strlen(addition) > 0) {
strcat(addition, _("、", ", "));
}
*/
static void analyze_misc(ObjectType *o_ptr, char *misc_desc)
{
- auto *a_ptr = &a_info[enum2i(o_ptr->fixed_artifact_idx)];
- sprintf(misc_desc, _("レベル %d, 希少度 %u, %d.%d kg, $%ld", "Level %d, Rarity %u, %d.%d lbs, %ld Gold"), (int)a_ptr->level, a_ptr->rarity,
- _(lb_to_kg_integer(a_ptr->weight), a_ptr->weight / 10), _(lb_to_kg_fraction(a_ptr->weight), a_ptr->weight % 10), (long int)a_ptr->cost);
+ const auto &a_ref = a_info.at(o_ptr->fixed_artifact_idx);
+ sprintf(misc_desc, _("レベル %d, 希少度 %u, %d.%d kg, $%ld", "Level %d, Rarity %u, %d.%d lbs, %ld Gold"), (int)a_ref.level, a_ref.rarity,
+ _(lb_to_kg_integer(a_ref.weight), a_ref.weight / 10), _(lb_to_kg_fraction(a_ref.weight), a_ref.weight % 10), (long int)a_ref.cost);
}
/*!
*/
static bool make_fake_artifact(ObjectType *o_ptr, FixedArtifactId fixed_artifact_idx)
{
- auto *a_ptr = &a_info[enum2i(fixed_artifact_idx)];
- if (a_ptr->name.empty()) {
+ auto &a_ref = a_info.at(fixed_artifact_idx);
+ if (a_ref.name.empty()) {
return false;
}
- OBJECT_IDX i = lookup_kind(a_ptr->tval, a_ptr->sval);
+ OBJECT_IDX i = lookup_kind(a_ref.tval, a_ref.sval);
if (!i) {
return false;
}
o_ptr->prep(i);
o_ptr->fixed_artifact_idx = fixed_artifact_idx;
- o_ptr->pval = a_ptr->pval;
- o_ptr->ac = a_ptr->ac;
- o_ptr->dd = a_ptr->dd;
- o_ptr->ds = a_ptr->ds;
- o_ptr->to_a = a_ptr->to_a;
- o_ptr->to_h = a_ptr->to_h;
- o_ptr->to_d = a_ptr->to_d;
- o_ptr->weight = a_ptr->weight;
+ o_ptr->pval = a_ref.pval;
+ o_ptr->ac = a_ref.ac;
+ o_ptr->dd = a_ref.dd;
+ o_ptr->ds = a_ref.ds;
+ o_ptr->to_a = a_ref.to_a;
+ o_ptr->to_h = a_ref.to_h;
+ o_ptr->to_d = a_ref.to_d;
+ o_ptr->weight = a_ref.weight;
return true;
}
spoiler_blanklines(1);
for (auto tval : tval_list) {
- for (const auto &a_ref : a_info) {
+ for (const auto &[a_idx, a_ref] : a_info) {
if (a_ref.tval != tval) {
continue;
}
ObjectType obj;
obj.wipe();
- if (!make_fake_artifact(&obj, a_ref.idx)) {
+ if (!make_fake_artifact(&obj, a_idx)) {
continue;
}
return;
}
- auto *a_ptr = &a_info[int_a_idx];
- a_ptr->is_generated = aware;
+ auto reset_artifact_idx = i2enum<FixedArtifactId>(int_a_idx);
+ a_info.at(reset_artifact_idx).is_generated = aware;
msg_print(aware ? "Modified." : "Restored.");
}
concptr p = "Enter number of items to roll: ";
char tmp_val[80];
- const auto o_fixed_artifact_idx = enum2i(o_ptr->fixed_artifact_idx);
if (o_ptr->is_fixed_artifact()) {
- a_info[o_fixed_artifact_idx].is_generated = false;
+ a_info.at(o_ptr->fixed_artifact_idx).is_generated = false;
}
uint32_t i, matches, better, worse, other, correct;
auto *q_ptr = &forge;
q_ptr->wipe();
make_object(player_ptr, q_ptr, mode);
- const auto q_fixed_artifact_idx = enum2i(q_ptr->fixed_artifact_idx);
if (q_ptr->is_fixed_artifact()) {
- a_info[q_fixed_artifact_idx].is_generated = false;
+ a_info.at(q_ptr->fixed_artifact_idx).is_generated = false;
}
if ((o_ptr->tval != q_ptr->tval) || (o_ptr->sval != q_ptr->sval)) {
}
correct++;
- if ((q_ptr->pval == o_ptr->pval) && (q_ptr->to_a == o_ptr->to_a) && (q_ptr->to_h == o_ptr->to_h) && (q_ptr->to_d == o_ptr->to_d) && (q_fixed_artifact_idx == o_fixed_artifact_idx)) {
+ const auto is_same_fixed_artifact_idx = q_ptr->fixed_artifact_idx == o_ptr->fixed_artifact_idx;
+ if ((q_ptr->pval == o_ptr->pval) && (q_ptr->to_a == o_ptr->to_a) && (q_ptr->to_h == o_ptr->to_h) && (q_ptr->to_d == o_ptr->to_d) && is_same_fixed_artifact_idx) {
matches++;
} else if ((q_ptr->pval >= o_ptr->pval) && (q_ptr->to_a >= o_ptr->to_a) && (q_ptr->to_h >= o_ptr->to_h) && (q_ptr->to_d >= o_ptr->to_d)) {
better++;
}
if (o_ptr->is_fixed_artifact()) {
- a_info[o_fixed_artifact_idx].is_generated = true;
+ a_info.at(o_ptr->fixed_artifact_idx).is_generated = true;
}
}
bool changed = false;
while (true) {
wiz_display_item(player_ptr, q_ptr);
- const auto int_fixed_artifact_idx = enum2i(q_ptr->fixed_artifact_idx);
if (!get_com("[a]ccept, [w]orthless, [c]ursed, [n]ormal, [g]ood, [e]xcellent, [s]pecial? ", &ch, false)) {
if (q_ptr->is_fixed_artifact()) {
- a_info[int_fixed_artifact_idx].is_generated = false;
+ a_info.at(q_ptr->fixed_artifact_idx).is_generated = false;
q_ptr->fixed_artifact_idx = FixedArtifactId::NONE;
}
}
if (q_ptr->is_fixed_artifact()) {
- a_info[int_fixed_artifact_idx].is_generated = false;
+ a_info.at(q_ptr->fixed_artifact_idx).is_generated = false;
q_ptr->fixed_artifact_idx = FixedArtifactId::NONE;
}
int len;
int mlen = 0;
- for (const auto &a_ref : a_info) {
- if (a_ref.idx == FixedArtifactId::NONE || a_ref.name.empty()) {
+ for (const auto &[a_idx, a_ref] : a_info) {
+ if (a_idx == FixedArtifactId::NONE || a_ref.name.empty()) {
continue;
}
}
o_ptr->prep(k_idx);
- o_ptr->fixed_artifact_idx = a_ref.idx;
+ o_ptr->fixed_artifact_idx = a_idx;
describe_flavor(player_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY | OD_STORE));
#ifndef JP
#endif
if (cheat_xtra) {
- msg_format("Matching artifact No.%d %s(%s)", a_ref.idx, a_desc, _(&o_name[2], o_name));
+ msg_format("Matching artifact No.%d %s(%s)", a_idx, a_desc, _(&o_name[2], o_name));
}
std::vector<const char *> l = { a_str, a_ref.name.c_str(), _(&o_name[2], o_name) };
if (!strcmp(str, l.at(c))) {
len = strlen(l.at(c));
if (len > mlen) {
- a_ids.push_back(a_ref.idx);
+ a_ids.push_back(a_idx);
mlen = len;
}
}
if (a_ids.size() == 1) {
const auto a_idx = a_ids.back();
- const auto int_a_idx = enum2i(a_idx);
- if (must || (ok_art && !a_info[int_a_idx].is_generated)) {
+ auto &a_ref = a_info.at(a_idx);
+ if (must || (ok_art && !a_ref.is_generated)) {
create_named_art(player_ptr, a_idx, player_ptr->y, player_ptr->x);
if (!w_ptr->wizard) {
- a_info[int_a_idx].is_generated = true;
+ a_ref.is_generated = true;
}
} else {
wishing_puff_of_smoke();
KIND_OBJECT_IDX k_idx = k_ids.back();
auto *k_ptr = &k_info[k_idx];
- ArtifactType *a_ptr;
FixedArtifactId a_idx = FixedArtifactId::NONE;
if (k_ptr->gen_flags.has(ItemGenerationTraitType::INSTA_ART)) {
- for (const auto &a_ref : a_info) {
- if (a_ref.idx == FixedArtifactId::NONE || a_ref.tval != k_ptr->tval || a_ref.sval != k_ptr->sval) {
+ for (const auto &[a_idx_loop, a_ref_loop] : a_info) {
+ if (a_idx_loop == FixedArtifactId::NONE || a_ref_loop.tval != k_ptr->tval || a_ref_loop.sval != k_ptr->sval) {
continue;
}
- a_idx = a_ref.idx;
+ a_idx = a_idx_loop;
break;
}
}
if (a_idx != FixedArtifactId::NONE) {
- const auto int_a_idx = enum2i(a_idx);
- a_ptr = &a_info[int_a_idx];
- if (must || (ok_art && !a_ptr->is_generated)) {
+ auto &a_ref = a_info.at(a_idx);
+ if (must || (ok_art && !a_ref.is_generated)) {
create_named_art(player_ptr, a_idx, player_ptr->y, player_ptr->x);
if (!w_ptr->wizard) {
- a_info[int_a_idx].is_generated = true;
+ a_ref.is_generated = true;
}
} else {
wishing_puff_of_smoke();
}
if (k_info[k_idx].gen_flags.has(ItemGenerationTraitType::INSTA_ART)) {
- for (const auto &a_ref : a_info) {
- if ((a_ref.idx == FixedArtifactId::NONE) || (a_ref.tval != k_info[k_idx].tval) || (a_ref.sval != k_info[k_idx].sval)) {
+ for (const auto &[a_idx, a_ref] : a_info) {
+ if ((a_idx == FixedArtifactId::NONE) || (a_ref.tval != k_info[k_idx].tval) || (a_ref.sval != k_info[k_idx].sval)) {
continue;
}
- (void)create_named_art(player_ptr, a_ref.idx, player_ptr->y, player_ptr->x);
+ (void)create_named_art(player_ptr, a_idx, player_ptr->y, player_ptr->x);
msg_print("Allocated(INSTA_ART).");
return;
}
*/
static std::string wiz_make_named_artifact_desc(PlayerType *player_ptr, FixedArtifactId a_idx)
{
- const auto &a_ref = a_info[enum2i(a_idx)];
+ const auto &a_ref = a_info.at(a_idx);
ObjectType obj;
obj.prep(lookup_kind(a_ref.tval, a_ref.sval));
obj.fixed_artifact_idx = a_idx;
const auto &[tval_list, name] = group_artifact;
std::vector<FixedArtifactId> a_idx_list;
for (auto tval : tval_list) {
- for (const auto &a_ref : a_info) {
+ for (const auto &[a_idx, a_ref] : a_info) {
if (a_ref.tval == tval) {
- a_idx_list.push_back(a_ref.idx);
+ a_idx_list.push_back(a_idx);
}
}
}