diff options
author | Bardur Arantsson <bardur@scientician.net> | 2015-02-23 09:11:58 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2015-02-23 09:11:58 +0100 |
commit | 11056413f0457bca511ad6f875219e031a2c3503 (patch) | |
tree | 79b3c49932a59162d207148cfa89561a3574cc3a | |
parent | daede88ba01cc86d982ff2f2f40fdf517cb90ab0 (diff) |
Remove ow_head, ow_name
-rw-r--r-- | src/externs.h | 2 | ||||
-rw-r--r-- | src/init1.cc | 27 | ||||
-rw-r--r-- | src/init2.cc | 13 | ||||
-rw-r--r-- | src/store.cc | 4 | ||||
-rw-r--r-- | src/types.h | 2 | ||||
-rw-r--r-- | src/variable.cc | 2 |
6 files changed, 7 insertions, 43 deletions
diff --git a/src/externs.h b/src/externs.h index 40bb2cc3..e40470cf 100644 --- a/src/externs.h +++ b/src/externs.h @@ -336,9 +336,7 @@ extern wilderness_type_info *wf_info; extern int wildc2i[256]; extern store_info_type *st_info; extern store_action_type *ba_info; -extern header *ow_head; extern owner_type *ow_info; -extern char *ow_name; extern set_type *set_info; extern cptr ANGBAND_SYS; diff --git a/src/init1.cc b/src/init1.cc index 8ce1524a..79ae95f8 100644 --- a/src/init1.cc +++ b/src/init1.cc @@ -9740,18 +9740,12 @@ errr init_ow_info_txt(FILE *fp, char *buf) /* Current entry */ owner_type *ow_ptr = NULL; - /* Just before the first record */ error_idx = -1; /* Just before the first line */ error_line = -1; - - /* Start the "fake" stuff */ - ow_head->name_size = 0; - ow_head->text_size = 0; - /* Parse */ fp_stack_init(fp); while (0 == my_fgets_dostack(buf, 1024)) @@ -9813,7 +9807,7 @@ errr init_ow_info_txt(FILE *fp, char *buf) if (i < error_idx) return (4); /* Verify information */ - if (i >= ow_head->info_num) return (2); + if (i >= max_ow_idx) return (2); /* Save the index */ error_idx = i; @@ -9821,17 +9815,9 @@ errr init_ow_info_txt(FILE *fp, char *buf) /* Point at the "info" */ ow_ptr = &ow_info[i]; - /* Hack -- Verify space */ - if (ow_head->name_size + strlen(s) + 8 > FAKE_NAME_SIZE) return (7); - - /* Advance and Save the name index */ - if (!ow_ptr->name) ow_ptr->name = ++ow_head->name_size; - - /* Append chars to the name */ - strcpy(ow_name + ow_head->name_size, s); - - /* Advance the index */ - ow_head->name_size += strlen(s); + /* Copy name */ + assert(!ow_ptr->name); + ow_ptr->name = my_strdup(s); /* Next... */ continue; @@ -9933,11 +9919,6 @@ errr init_ow_info_txt(FILE *fp, char *buf) return (6); } - - /* Complete the "name" and "text" sizes */ - ++ow_head->name_size; - ++ow_head->text_size; - /* No version yet */ if (!okay) return (2); diff --git a/src/init2.cc b/src/init2.cc index 6dd866d5..e6033907 100644 --- a/src/init2.cc +++ b/src/init2.cc @@ -1073,19 +1073,8 @@ static errr init_ow_info(void) /* General buffer */ char buf[1024]; - - /*** Make the header ***/ - ow_head = make_header(max_ow_idx); - - - /*** Make the fake arrays ***/ - /* Allocate the "ow_info" array */ - ow_info = make_array<owner_type>(ow_head->info_num); - - /* Hack -- make "fake" arrays */ - ow_name = make_array<char>(FAKE_NAME_SIZE); - + ow_info = make_array<owner_type>(max_ow_idx); /*** Load the ascii template file ***/ diff --git a/src/store.cc b/src/store.cc index e948c094..aef29160 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1598,10 +1598,8 @@ void display_store(void) /* Normal stores */ else { - cptr owner_name = (ow_name + ot_ptr->name); - /* Put the owner name and race */ - strnfmt(buf, 80, "%s", owner_name); + strnfmt(buf, 80, "%s", ot_ptr->name); put_str(buf, 3, 10); /* Show the max price in the store (above prices) */ diff --git a/src/types.h b/src/types.h index 472c481f..326cebf6 100644 --- a/src/types.h +++ b/src/types.h @@ -933,7 +933,7 @@ typedef struct owner_type owner_type; struct owner_type { - u32b name; /* Name (offset) */ + const char *name; /* Name */ s16b max_cost; /* Purse limit */ diff --git a/src/variable.cc b/src/variable.cc index b6fe3edb..988aa2e9 100644 --- a/src/variable.cc +++ b/src/variable.cc @@ -695,9 +695,7 @@ store_action_type *ba_info; /* * The owner types arrays */ -header *ow_head; owner_type *ow_info; -char *ow_name; /* * Hack -- The special Angband "System Suffix" |