diff options
author | Bardur Arantsson <bardur@scientician.net> | 2016-10-05 18:45:08 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2016-10-05 18:49:38 +0200 |
commit | 1bbed63b66c0f69809e698576a51501150f06bba (patch) | |
tree | f458361c0c2e7dac2502b1aace63d83d5dbd15b4 /src/util.cc | |
parent | b9fca0267b1d6a32d57e1fb4387f52c19d1c3fa6 (diff) |
Move k_info into GameEditData
Diffstat (limited to 'src/util.cc')
-rw-r--r-- | src/util.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/util.cc b/src/util.cc index 9351dce1..ccc61143 100644 --- a/src/util.cc +++ b/src/util.cc @@ -3363,18 +3363,20 @@ int test_mego_name(cptr needle) * returned. Case doesn't matter. -DG- */ -int test_item_name(cptr name) +int test_item_name(cptr needle) { - int i; + auto const &k_info = game->edit_data.k_info; - /* Scan the items */ - for (i = 1; i < max_k_idx; i++) + for (std::size_t i = 0; i < k_info.size(); i++) { - object_kind *k_ptr = &k_info[i]; - /* If name matches, give us the number */ - if (k_ptr->name && iequals(name, k_ptr->name)) return (i); + auto const &name = k_info[i].name; + if (name && iequals(needle, name)) + { + return i; + } } - return (0); + + return 0; } /* |