summaryrefslogtreecommitdiff
path: root/src/files.cc
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2016-10-05 18:45:08 +0200
committerBardur Arantsson <bardur@scientician.net>2016-10-05 18:49:38 +0200
commitb9fca0267b1d6a32d57e1fb4387f52c19d1c3fa6 (patch)
treed8c7c6c1df4b2ead1ca4cf200b771245bcd7d3ca /src/files.cc
parent0c2f30b56c221a826ba64f0ec864c29d0f717644 (diff)
Move f_info into GameEditData
Diffstat (limited to 'src/files.cc')
-rw-r--r--src/files.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/files.cc b/src/files.cc
index cfd80362..42d1bed3 100644
--- a/src/files.cc
+++ b/src/files.cc
@@ -220,6 +220,7 @@ errr process_pref_file_aux(char *buf)
auto &st_info = game->edit_data.st_info;
auto &re_info = game->edit_data.re_info;
auto &r_info = game->edit_data.r_info;
+ auto &f_info = game->edit_data.f_info;
int i, j, n1, n2;
@@ -377,13 +378,18 @@ errr process_pref_file_aux(char *buf)
{
if (tokenize(buf + 2, 3, zz, ':', '/') == 3)
{
- feature_type *f_ptr;
- i = (huge)strtol(zz[0], NULL, 0);
+ std::size_t f_idx = strtoul(zz[0], NULL, 0);
n1 = strtol(zz[1], NULL, 0);
n2 = strtol(zz[2], NULL, 0);
- if (i >= max_f_idx) return (1);
- f_ptr = &f_info[i];
- if (n1) f_ptr->x_attr = n1;
+
+ if (f_idx >= f_info.size()) return (1);
+
+ auto f_ptr = &f_info[f_idx];
+
+ if (n1)
+ {
+ f_ptr->x_attr = n1;
+ }
if (n2)
{
f_ptr->x_char = n2;