summaryrefslogtreecommitdiff
path: root/src/init1.cc
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
commit3f59d3d407cd743f4e4b27791c4fe13785f8669d (patch)
treee5d4feaa3583e057a48de8c5b6c012c9fa954e52 /src/init1.cc
parentde5ee3b24f035efe3da8260687200109302f350a (diff)
Remove ab_head, ab_name, ab_text
Diffstat (limited to 'src/init1.cc')
-rw-r--r--src/init1.cc56
1 files changed, 11 insertions, 45 deletions
diff --git a/src/init1.cc b/src/init1.cc
index 5dc7358..8cf7c3f 100644
--- a/src/init1.cc
+++ b/src/init1.cc
@@ -6003,7 +6003,7 @@ errr init_ab_info_txt(FILE *fp, char *buf)
i = atoi(buf + 2);
/* Verify information */
- if (i >= ab_head->info_num) return (2);
+ if (i >= max_ab_idx) return (2);
/* Save the index */
error_idx = i;
@@ -6011,17 +6011,9 @@ errr init_ab_info_txt(FILE *fp, char *buf)
/* Point at the "info" */
ab_ptr = &ab_info[i];
- /* Hack -- Verify space */
- if (ab_head->name_size + strlen(s) + 8 > FAKE_NAME_SIZE) return (7);
-
- /* Advance and Save the name index */
- if (!ab_ptr->name) ab_ptr->name = ++ab_head->name_size;
-
- /* Append chars to the name */
- strcpy(ab_name + ab_head->name_size, s);
-
- /* Advance the index */
- ab_head->name_size += strlen(s);
+ /* Copy name */
+ assert(!ab_ptr->name);
+ ab_ptr->name = my_strdup(s);
/* Init */
ab_ptr->action_mkey = 0;
@@ -6050,27 +6042,14 @@ errr init_ab_info_txt(FILE *fp, char *buf)
/* Acquire the text */
s = buf + 2;
- /* Hack -- Verify space */
- if (ab_head->text_size + strlen(s) + 8 > FAKE_TEXT_SIZE) return (7);
-
- /* Advance and Save the text index */
+ /* Append description */
if (!ab_ptr->desc)
{
- ab_ptr->desc = ++ab_head->text_size;
-
- /* Append chars to the name */
- strcpy(ab_text + ab_head->text_size, s);
-
- /* Advance the index */
- ab_head->text_size += strlen(s);
+ ab_ptr->desc = my_strdup(s);
}
else
{
- /* Append chars to the name */
- strcpy(ab_text + ab_head->text_size, format("\n%s", s));
-
- /* Advance the index */
- ab_head->text_size += strlen(s) + 1;
+ strappend(&ab_ptr->desc, format("\n%s", s));
}
/* Next... */
@@ -6089,19 +6068,13 @@ errr init_ab_info_txt(FILE *fp, char *buf)
*txt = '\0';
txt++;
- /* Hack -- Verify space */
- if (ab_head->text_size + strlen(txt) + 8 > FAKE_TEXT_SIZE) return (7);
-
- /* Advance and Save the text index */
- if (!ab_ptr->action_desc) ab_ptr->action_desc = ++ab_head->text_size;
+ /* Copy name */
+ assert(!ab_ptr->action_desc);
+ ab_ptr->action_desc = my_strdup(txt);
- /* Append chars to the name */
- strcpy(ab_text + ab_head->text_size, txt);
+ /* Set mkey */
ab_ptr->action_mkey = atoi(s);
- /* Advance the index */
- ab_head->text_size += strlen(txt);
-
/* Next... */
continue;
}
@@ -6249,16 +6222,9 @@ errr init_ab_info_txt(FILE *fp, char *buf)
return (6);
}
-
- /* Complete the "name" and "text" sizes */
- ++ab_head->name_size;
- ++ab_head->text_size;
-
-
/* No version yet */
if (!okay) return (2);
-
/* Success */
return (0);
}