summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2015-02-23 09:11:58 +0100
committerBardur Arantsson <bardur@scientician.net>2015-02-23 09:11:58 +0100
commite2b5157f29e66cb0ccb151bfd46ee43c8c745fe7 (patch)
treeb2e4117434f1c6c944231de9a4d707fb18d7bf3b
parentd56f3fcfdb6e166118d869290723320891c5c878 (diff)
Remove v_name, v_text, v_head
-rw-r--r--src/externs.h5
-rw-r--r--src/generate.cc4
-rw-r--r--src/init1.cc54
-rw-r--r--src/init2.cc17
-rw-r--r--src/types.h3
-rw-r--r--src/variable.cc3
6 files changed, 18 insertions, 68 deletions
diff --git a/src/externs.h b/src/externs.h
index 88ca9d8e..4c0c2154 100644
--- a/src/externs.h
+++ b/src/externs.h
@@ -321,10 +321,7 @@ extern skill_type *s_info;
extern char *s_name;
extern char *s_text;
-extern header *v_head;
extern vault_type *v_info;
-extern char *v_name;
-extern char *v_text;
extern header *f_head;
extern feature_type *f_info;
extern char *f_name;
@@ -832,7 +829,7 @@ extern errr init_player_info_txt(FILE *fp, char *buf);
extern errr init_ab_info_txt(FILE *fp, char *buf);
extern errr init_s_info_txt(FILE *fp, char *buf);
extern errr init_set_info_txt(FILE *fp, char *buf);
-extern errr init_v_info_txt(FILE *fp, char *buf, bool_ start);
+extern errr init_v_info_txt(FILE *fp, char *buf);
extern errr init_f_info_txt(FILE *fp, char *buf);
extern errr init_k_info_txt(FILE *fp, char *buf);
extern errr init_a_info_txt(FILE *fp, char *buf);
diff --git a/src/generate.cc b/src/generate.cc
index c2ab72e2..ada0a15f 100644
--- a/src/generate.cc
+++ b/src/generate.cc
@@ -3833,7 +3833,7 @@ static void build_type7(int by0, int bx0)
}
/* Hack -- Build the vault */
- build_vault(yval, xval, v_ptr->hgt, v_ptr->wid, v_text + v_ptr->text);
+ build_vault(yval, xval, v_ptr->hgt, v_ptr->wid, v_ptr->data);
}
@@ -3889,7 +3889,7 @@ static void build_type8(int by0, int bx0)
}
/* Hack -- Build the vault */
- build_vault(yval, xval, v_ptr->hgt, v_ptr->wid, v_text + v_ptr->text);
+ build_vault(yval, xval, v_ptr->hgt, v_ptr->wid, v_ptr->data);
}
/*
diff --git a/src/init1.cc b/src/init1.cc
index 770ae4d0..2c89736b 100644
--- a/src/init1.cc
+++ b/src/init1.cc
@@ -3463,7 +3463,7 @@ errr init_player_info_txt(FILE *fp, char *buf)
/*
* Initialize the "v_info" array, by parsing an ascii "template" file
*/
-errr init_v_info_txt(FILE *fp, char *buf, bool_ start)
+errr init_v_info_txt(FILE *fp, char *buf)
{
int i;
char *s;
@@ -3474,18 +3474,11 @@ errr init_v_info_txt(FILE *fp, char *buf, bool_ start)
/* Current entry */
vault_type *v_ptr = NULL;
- if (start)
- {
- /* Just before the first record */
- error_idx = -1;
-
- /* Just before the first line */
- error_line = -1;
+ /* Just before the first record */
+ error_idx = -1;
- /* Prepare the "fake" stuff */
- v_head->name_size = 0;
- v_head->text_size = 0;
- }
+ /* Just before the first line */
+ error_line = -1;
/* Parse */
fp_stack_init(fp);
@@ -3549,7 +3542,7 @@ errr init_v_info_txt(FILE *fp, char *buf, bool_ start)
if (i <= error_idx) return (4);
/* Verify information */
- if (i >= v_head->info_num) return (2);
+ if (i >= max_v_idx) return (2);
/* Save the index */
error_idx = i;
@@ -3557,17 +3550,9 @@ errr init_v_info_txt(FILE *fp, char *buf, bool_ start)
/* Point at the "info" */
v_ptr = &v_info[i];
- /* Hack -- Verify space */
- if (v_head->name_size + strlen(s) + 8 > FAKE_NAME_SIZE) return (7);
-
- /* Advance and Save the name index */
- if (!v_ptr->name) v_ptr->name = ++v_head->name_size;
-
- /* Append chars to the name */
- strcpy(v_name + v_head->name_size, s);
-
- /* Advance the index */
- v_head->name_size += strlen(s);
+ /* Initialize data -- we ignore the name, it's not
+ * used for anything */
+ v_ptr->data = my_strdup("");
/* Next... */
continue;
@@ -3582,17 +3567,8 @@ errr init_v_info_txt(FILE *fp, char *buf, bool_ start)
/* Acquire the text */
s = buf + 2;
- /* Hack -- Verify space */
- if (v_head->text_size + strlen(s) + 8 > FAKE_TEXT_SIZE) return (7);
-
- /* Advance and Save the text index */
- if (!v_ptr->text) v_ptr->text = ++v_head->text_size;
-
- /* Append chars to the name */
- strcpy(v_text + v_head->text_size, s);
-
- /* Advance the index */
- v_head->text_size += strlen(s);
+ /* Append data */
+ strappend(&v_ptr->data, s);
/* Next... */
continue;
@@ -3659,14 +3635,6 @@ errr init_v_info_txt(FILE *fp, char *buf, bool_ start)
}
- /* Complete the "name" and "text" sizes */
- if (!start)
- {
- ++v_head->name_size;
- ++v_head->text_size;
- }
-
-
/* No version yet */
if (!okay) return (2);
diff --git a/src/init2.cc b/src/init2.cc
index caf1bf27..aff86014 100644
--- a/src/init2.cc
+++ b/src/init2.cc
@@ -1529,19 +1529,8 @@ errr init_v_info(void)
char buf[1024];
- /*** Make the header ***/
- v_head = make_header(max_v_idx);
-
-
- /*** Make the fake arrays ***/
-
- /* Allocate the "k_info" array */
- v_info = make_array<vault_type>(v_head->info_num);
-
- /* Hack -- make "fake" arrays */
- v_name = make_array<char>(FAKE_NAME_SIZE);
- v_text = make_array<char>(FAKE_TEXT_SIZE);
-
+ /* Allocate the "v_info" array */
+ v_info = make_array<vault_type>(max_v_idx);
/*** Load the ascii template file ***/
@@ -1555,7 +1544,7 @@ errr init_v_info(void)
if (!fp) quit("Cannot open 'v_info.txt' file.");
/* Parse the file */
- err = init_v_info_txt(fp, buf, TRUE);
+ err = init_v_info_txt(fp, buf);
/* Close it */
my_fclose(fp);
diff --git a/src/types.h b/src/types.h
index 48c07671..08d5c318 100644
--- a/src/types.h
+++ b/src/types.h
@@ -598,8 +598,7 @@ typedef struct vault_type vault_type;
struct vault_type
{
- u32b name; /* Name (offset) */
- u32b text; /* Text (offset) */
+ char *data; /* Vault data */
byte typ; /* Vault type */
diff --git a/src/variable.cc b/src/variable.cc
index 35251954..27ebb364 100644
--- a/src/variable.cc
+++ b/src/variable.cc
@@ -597,10 +597,7 @@ artifact_select_flag *a_select_flags;
/*
* The vault generation arrays
*/
-header *v_head;
vault_type *v_info;
-char *v_name;
-char *v_text;
/*
* The terrain feature arrays