summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cmd7.cc12
-rw-r--r--src/externs.h3
-rw-r--r--src/init1.cc55
-rw-r--r--src/init2.cc11
-rw-r--r--src/types.h6
-rw-r--r--src/variable.cc2
-rw-r--r--src/wizard1.cc4
7 files changed, 26 insertions, 67 deletions
diff --git a/src/cmd7.cc b/src/cmd7.cc
index 36d8e8f9..ab152bd2 100644
--- a/src/cmd7.cc
+++ b/src/cmd7.cc
@@ -1227,11 +1227,11 @@ int show_flags(byte group, int pval)
{
sprintf(ttt, "%c) %s",
(items < 26) ? I2A(items) : ('0' + items - 26),
- al_name + a_select_flags[i].desc);
+ a_select_flags[i].desc);
if ( wizard || alchemist_has_stone())
sprintf(ttt, "%c) %s (exp " FMTu32b ")",
(items < 26) ? I2A(items) : ('0' + items - 26),
- al_name + a_select_flags[i].desc,
+ a_select_flags[i].desc,
a_select_flags[i].xp);
/* Note: Somebody is VERY clever, and it wasn't me. Text printed as
@@ -1549,9 +1549,9 @@ static int check_artifact_items(int pval, int oldpval, int mode)
*/
if ( mode == 0 )
{
- char *o_name = al_name + a_select_flags[i].item_desc;
+ char *o_name = a_select_flags[i].item_desc;
if (orqty > 1 && a_select_flags[i].pval && a_select_flags[i].item_descp)
- o_name = al_name + a_select_flags[i].item_descp;
+ o_name = a_select_flags[i].item_descp;
if ( rqty )
{
@@ -1750,7 +1750,7 @@ void display_activation_info(int num)
c_prt(TERM_WHITE, " ", 5, 5);
c_prt(TERM_WHITE, format(" Level:%d ", a_select_flags[i].level), 6, 5);
c_prt(TERM_WHITE, format(" Exp :%d ", a_select_flags[i].xp), 7, 5);
- c_prt(TERM_WHITE, format(" Item :%s ", al_name + a_select_flags[i].item_desc), 8, 5);
+ c_prt(TERM_WHITE, format(" Item :%s ", a_select_flags[i].item_desc), 8, 5);
c_prt(TERM_WHITE, " ", 9, 5);
c_prt(TERM_WHITE, format(" %s ", activation_aux(&forge, 0, 0)), 9, 5);
c_prt(TERM_WHITE, " ", 10, 5);
@@ -1784,7 +1784,7 @@ void select_an_activation(void)
if (a_select_flags[i].group == 88 && a_select_flags[i].level <= lev )
{
act_ref[max] = -a_select_flags[i].flag; /* Activation number */
- act_list[max++] = al_name + a_select_flags[i].desc; /* Description */
+ act_list[max++] = a_select_flags[i].desc; /* Description */
}
/* Select from that list, using the util.c function display_list to display the scrolled list */
diff --git a/src/externs.h b/src/externs.h
index 3c69928c..bea4a842 100644
--- a/src/externs.h
+++ b/src/externs.h
@@ -307,8 +307,7 @@ extern alchemist_recipe *alchemist_recipes;
extern u32b alchemist_known_artifacts[6];
extern u32b alchemist_gained;
extern s16b player_hp[PY_MAX_LEVEL];
-extern header *al_head;
-extern char *al_name;
+
extern artifact_select_flag *a_select_flags;
extern ability_type *ab_info;
diff --git a/src/init1.cc b/src/init1.cc
index 109ec2be..b4180a88 100644
--- a/src/init1.cc
+++ b/src/init1.cc
@@ -4509,10 +4509,6 @@ errr init_al_info_txt(FILE *fp, char *buf)
/* Just before the first line */
error_line = -1;
- /* Fun! */
- al_head->name_size = 0;
- *al_name = 0;
-
/* Parse */
fp_stack_init(fp);
while (0 == my_fgets_dostack(buf, 1024))
@@ -4715,71 +4711,47 @@ errr init_al_info_txt(FILE *fp, char *buf)
if (buf[0] == 'p')
{
/* Reject if doesn't depend on pval */
-
if (!a_ptr->pval)
return (1);
/* Acquire the description */
s = buf + 2;
- /* Hack -- Verify space */
- if (al_head->name_size + strlen(s) + 8 > FAKE_NAME_SIZE) return (7);
-
- /* Advance and Save the name index */
- a_ptr->item_descp = ++al_head->name_size;
-
- /* Append chars to the name */
- strcpy(al_name + al_head->name_size, s);
-
- /* Advance the index */
- al_head->name_size += strlen(s);
+ /* Copy plural description */
+ assert(!a_ptr->item_descp);
+ a_ptr->item_descp = my_strdup(s);
/* Next... */
continue;
}
- /* Process 'D' for "Description" */
+ /* Process 'D' for "Description" (one line only) */
if (buf[0] == 'D')
{
/* Acquire the description */
s = buf + 2;
- /* Hack -- Verify space */
- if (al_head->name_size + strlen(s) + 8 > FAKE_NAME_SIZE) return (7);
-
- /* Advance and Save the name index */
- a_ptr->desc = ++al_head->name_size;
-
- /* Append chars to the name */
- strcpy(al_name + al_head->name_size, s);
-
- /* Advance the index */
- al_head->name_size += strlen(s);
+ /* Copy description */
+ assert(!a_ptr->desc);
+ a_ptr->desc = my_strdup(s);
/* Next... */
continue;
}
- /* Process 'd' for "Item Description" */
+ /* Process 'd' for "Item Description" (one line only) */
if (buf[0] == 'd')
{
/* Acquire the name */
s = buf + 2;
- /* Hack -- Verify space */
- if (al_head->name_size + strlen(s) + 8 > FAKE_NAME_SIZE) return (7);
-
+ /* Reject if we already have a description */
if (a_ptr->item_desc)
return (7);
- /* Advance and Save the name index */
- a_ptr->item_desc = ++al_head->name_size;
-
- /* Append chars to the name */
- strcpy(al_name + al_head->name_size, s);
-
- /* Advance the index */
- al_head->name_size += strlen(s);
+ /* Copy description */
+ assert(!a_ptr->item_desc);
+ a_ptr->item_desc = my_strdup(s);
/* Next... */
continue;
@@ -4792,9 +4764,6 @@ errr init_al_info_txt(FILE *fp, char *buf)
/* No version yet */
if (!okay) return (2);
- /* Hack - set the al_head->text_size to byte size of array */
- al_head->text_size = (a_idx + 1) * sizeof(artifact_select_flag);
-
/* Success */
return (0);
}
diff --git a/src/init2.cc b/src/init2.cc
index 126d9934..c50cd428 100644
--- a/src/init2.cc
+++ b/src/init2.cc
@@ -1347,15 +1347,8 @@ errr init_al_info(void)
/* General buffer */
char buf[1024];
- /*** Make the header ***/
- al_head = make_header(max_al_idx);
-
-
- /* Allocate the "al_info" array */
- alchemist_recipes = make_array<alchemist_recipe>(al_head->info_num);
-
- /* Allocate the fake arrays */
- al_name = make_array<char>(FAKE_NAME_SIZE);
+ /* Allocate the arrays */
+ alchemist_recipes = make_array<alchemist_recipe>(max_al_idx);
a_select_flags = make_array<artifact_select_flag>(max_al_idx);
/*** Load the ascii template file ***/
diff --git a/src/types.h b/src/types.h
index 2c4bd505..2e9602dc 100644
--- a/src/types.h
+++ b/src/types.h
@@ -1875,11 +1875,11 @@ struct artifact_select_flag {
byte group; /* Flag group to display it in */
int flag; /* item flag to set */
byte level; /* Player skill level to start at */
- int desc; /* Display this description to select flag */
+ char *desc; /* Display this description to select flag */
u32b xp; /* xp cost for this flag */
bool_ pval; /* indicates this flag benifits from pval */
- int item_desc; /* Description of required item */
- int item_descp; /* Description of required item */
+ char *item_desc; /* Description of required item */
+ char *item_descp; /* Description of required item; plural */
byte rtval; /* Required items' tval */
byte rsval; /* Required items' sval */
int rpval; /* Required items' pval (zero for no req) */
diff --git a/src/variable.cc b/src/variable.cc
index d7352054..3689bc5c 100644
--- a/src/variable.cc
+++ b/src/variable.cc
@@ -589,9 +589,7 @@ s16b player_hp[PY_MAX_LEVEL];
/*
* The alchemy recipe arrays
*/
-header *al_head;
alchemist_recipe *alchemist_recipes;
-char *al_name;
artifact_select_flag *a_select_flags;
/*
diff --git a/src/wizard1.cc b/src/wizard1.cc
index 818cbe99..f28cdea1 100644
--- a/src/wizard1.cc
+++ b/src/wizard1.cc
@@ -2474,8 +2474,8 @@ static void spoil_bateries(cptr fname)
spoil_out(format("%-2d %8d %-24s %s\n",
a_select_flags[i].level,
a_select_flags[i].xp,
- al_name + a_select_flags[i].desc,
- al_name + a_select_flags[i].item_desc));
+ a_select_flags[i].desc,
+ a_select_flags[i].item_desc));
/* cycle through all alchemist_recipies*/
for ( j = 0 ; j < max_al_idx ; j++ )
{