summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/init2.cc12
-rw-r--r--src/town_type.hpp18
2 files changed, 14 insertions, 16 deletions
diff --git a/src/init2.cc b/src/init2.cc
index eefed7ca..93982bcc 100644
--- a/src/init2.cc
+++ b/src/init2.cc
@@ -678,14 +678,9 @@ static errr init_misc(void)
*/
static errr init_towns(void)
{
- int i = 0, j = 0;
+ town_info = new town_type[max_towns];
- /*** Prepare the Towns ***/
-
- /* Allocate the towns */
- town_info = make_array<town_type>(max_towns);
-
- for (i = 1; i < max_towns; i++)
+ for (std::size_t i = 1; i < max_towns; i++)
{
if (i <= max_real_towns) town_info[i].flags |= (TOWN_REAL);
@@ -693,7 +688,7 @@ static errr init_towns(void)
town_info[i].store = new store_type[max_st_idx];
/* Fill in each store */
- for (j = 0; j < max_st_idx; j++)
+ for (std::size_t j = 0; j < max_st_idx; j++)
{
/* Access the store */
store_type *st_ptr = &town_info[i].store[j];
@@ -705,6 +700,7 @@ static errr init_towns(void)
st_ptr->stock_size = 0;
}
}
+
return 0;
}
diff --git a/src/town_type.hpp b/src/town_type.hpp
index f8458c60..7758f7fd 100644
--- a/src/town_type.hpp
+++ b/src/town_type.hpp
@@ -8,14 +8,16 @@
*/
struct town_type
{
- cptr name;
- u32b seed; /* Seed for RNG */
- store_type *store; /* The stores [max_st_idx] */
- byte numstores;
+ cptr name = nullptr;
- byte flags; /* Town flags */
- /* Left this for the sake of compatibility */
- bool_ stocked; /* Is the town actualy stocked ? */
+ u32b seed = 0; /* Seed for RNG */
- bool_ destroyed; /* Is the town destroyed? */
+ store_type *store = nullptr; /* The stores [max_st_idx] */
+ byte numstores = 0;
+
+ byte flags = 0; /* Town flags */
+
+ bool_ stocked = FALSE; /* Is the town actualy stocked ? */
+
+ bool_ destroyed = FALSE; /* Is the town destroyed? */
};