summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/birth.cc3
-rw-r--r--src/init2.cc11
-rw-r--r--src/loadsave.cc2
-rw-r--r--src/town_type.hpp5
4 files changed, 10 insertions, 11 deletions
diff --git a/src/birth.cc b/src/birth.cc
index 41a7cc9b..dd66e11f 100644
--- a/src/birth.cc
+++ b/src/birth.cc
@@ -3051,9 +3051,6 @@ void init_town(int t_idx)
/* Generation seed for the town */
t_ptr->seed = randint(0x10000000);
-
- /* Total hack and not even used */
- t_ptr->numstores = 8;
}
/*
diff --git a/src/init2.cc b/src/init2.cc
index fca7473a..5a4662a0 100644
--- a/src/init2.cc
+++ b/src/init2.cc
@@ -682,15 +682,16 @@ static errr init_towns(void)
for (std::size_t i = 1; i < max_towns; i++)
{
- if (i <= max_real_towns) town_info[i].flags |= (TOWN_REAL);
-
- /* Allocate the stores */
- town_info[i].store = new store_type[max_st_idx];
+ if (i <= max_real_towns)
+ {
+ town_info[i].flags |= TOWN_REAL;
+ }
/* Fill in each store */
for (std::size_t j = 0; j < max_st_idx; j++)
{
- /* Access the store */
+ /* Create the store */
+ town_info[i].store.emplace_back(store_type());
store_type *st_ptr = &town_info[i].store[j];
/* Know who we are */
diff --git a/src/loadsave.cc b/src/loadsave.cc
index 4c924527..8d63abf9 100644
--- a/src/loadsave.cc
+++ b/src/loadsave.cc
@@ -2351,7 +2351,7 @@ static bool_ do_savefile_aux(ls_flag_t flag)
if (i >= TOWN_RANDOM)
{
do_u32b(&town_info[i].seed, flag);
- do_byte(&town_info[i].numstores, flag);
+ do_byte(&tmp8u, flag);
do_byte(&town_info[i].flags, flag);
/* If the town is realy used create a sock */
diff --git a/src/town_type.hpp b/src/town_type.hpp
index 7758f7fd..e119968b 100644
--- a/src/town_type.hpp
+++ b/src/town_type.hpp
@@ -3,6 +3,8 @@
#include "h-basic.h"
#include "store_type_fwd.hpp"
+#include <vector>
+
/**
* Town descriptor.
*/
@@ -12,8 +14,7 @@ struct town_type
u32b seed = 0; /* Seed for RNG */
- store_type *store = nullptr; /* The stores [max_st_idx] */
- byte numstores = 0;
+ std::vector<store_type> store; /* The stores [max_st_idx] */
byte flags = 0; /* Town flags */