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 | e20d50a1b347d52d9b6e2c2570fe97f196c2c069 (patch) | |
tree | 622bd9b383cc39efe7a646e1a980a6c1c604c8d9 /src/init1.cc | |
parent | 58e8024f17446bf3b1a36985d746f6de330874c0 (diff) |
Remove al_head, al_name
Diffstat (limited to 'src/init1.cc')
-rw-r--r-- | src/init1.cc | 55 |
1 files changed, 12 insertions, 43 deletions
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); } |