diff options
author | Bardur Arantsson <bardur@scientician.net> | 2018-03-25 20:07:30 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2018-03-25 20:07:30 +0200 |
commit | a9e8ef4434fd505a4db627d9156919952586e209 (patch) | |
tree | 9a5ddc477d54dcc241cef96f0ffa1950fcd02046 /src/init1.cc | |
parent | 7040407bdea291f1c6c0bd0dcca69a475240f93a (diff) |
Change k_info to an unordered_map<>
Diffstat (limited to 'src/init1.cc')
-rw-r--r-- | src/init1.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/init1.cc b/src/init1.cc index 2224bc25..65372dbe 100644 --- a/src/init1.cc +++ b/src/init1.cc @@ -2285,8 +2285,8 @@ errr init_k_info_txt(FILE *fp) /* Save the index */ error_idx = i; - /* Point at the "info" */ - k_ptr = &expand_to_fit_index(k_info, i); + /* Point at the "info"; automatically creates an entry */ + k_ptr = &k_info[i]; /* Advance and Save the name index */ assert(!k_ptr->name); @@ -5354,7 +5354,12 @@ errr init_st_info_txt(FILE *fp) /* Add to items array */ auto chance = atoi(buf + 2); int k_idx = test_item_name(s); - assert(k_idx >= 0); + + if (k_idx < 0) + { + msg_format("Unknown k_info entry: [%s].", s); + return 1; + } st_ptr->items.emplace_back( store_item::k_idx(k_idx, chance)); |