diff options
author | Bardur Arantsson <bardur@scientician.net> | 2016-09-17 09:58:13 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2016-09-17 09:58:13 +0200 |
commit | cb9fde0cde82d4122c8bd9836309720294dee77f (patch) | |
tree | 2d36dff617bf0144fce0c7e0992eb6ef9544a560 /src/init1.cc | |
parent | 347afc50368137901a989ac4a4fc9298056c7377 (diff) |
Rework store_info_type::owners to std::vector<>
Diffstat (limited to 'src/init1.cc')
-rw-r--r-- | src/init1.cc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/init1.cc b/src/init1.cc index 6fef9561..3dec9b6e 100644 --- a/src/init1.cc +++ b/src/init1.cc @@ -5900,13 +5900,23 @@ errr init_st_info_txt(FILE *fp) /* Scan for the values */ if (4 != sscanf(buf + 2, "%d:%d:%d:%d", - &a1, &a2, &a3, &a4)) return (1); + &a1, &a2, &a3, &a4)) + { + return 1; + } + + /* Get a reference to the owners */ + auto owners = &st_ptr->owners; /* Save the values */ - st_ptr->owners[0] = a1; - st_ptr->owners[1] = a2; - st_ptr->owners[2] = a3; - st_ptr->owners[3] = a4; + owners->push_back(a1); + owners->push_back(a2); + owners->push_back(a3); + owners->push_back(a4); + + /* Sort and remove duplicates */ + std::sort(owners->begin(), owners->end()); + owners->erase(std::unique(owners->begin(), owners->end()), owners->end()); /* Next... */ continue; |