diff options
Diffstat (limited to 'src/init1.cc')
-rw-r--r-- | src/init1.cc | 383 |
1 files changed, 1 insertions, 382 deletions
diff --git a/src/init1.cc b/src/init1.cc index 1f2023f0..d9ad1ccf 100644 --- a/src/init1.cc +++ b/src/init1.cc @@ -1,9 +1,7 @@ #include "init1.hpp" #include "ability_type.hpp" -#include "alchemist_recipe.hpp" #include "artifact_type.hpp" -#include "artifact_select_flag.hpp" #include "cave.hpp" #include "cave_type.hpp" #include "dungeon_info_type.hpp" @@ -696,7 +694,7 @@ cptr k_info_flags4[] = "LITE2", "LITE3", "FUEL_LITE", - "ART_EXP", + "XXX5", "CURSE_NO_DROP", "NO_RECHARGE" }; @@ -1215,30 +1213,6 @@ d_info_dtypes[] = {NULL, 0} }; -/* Essence names for al_info.txt */ -static const char *essence_names[] = -{ - "No name here", /* can't be matched, sscanf stops at spaces */ - "POISON", - "EXPLOSION", - "TELEPORT", - "COLD", - "FIRE", - "ACID", - "LIFE", - "CONFUSION", - "LITE", - "CHAOS", - "TIME", - "MAGIC", - "EXTRALIFE", - "DARKNESS", - "KNOWLEDGE", - "FORCE", - "LIGHTNING", - "MANA", - "" -}; static const char *activation_names[] = { "NO_ACTIVATION", /* 0*/ @@ -4307,355 +4281,6 @@ errr init_k_info_txt(FILE *fp) return (0); } -/*Get a kind flag, return flag*32+bit number or -1 for unknown*/ - -int get_k_flag(char *what) -{ - int i; - - /* Check flags1 */ - for (i = 0; i < 32; i++) - { - if (streq(what, k_info_flags1[i])) - return i; - if (streq(what, k_info_flags2[i])) - return 1*32 + i; - if (streq(what, k_info_flags2_trap[i])) - return 1*32 + i; - if (streq(what, k_info_flags3[i])) - return 2*32 + i; - if (streq(what, k_info_flags4[i])) - return 3*32 + i; - if (streq(what, k_info_flags5[i])) - return 4*32 + i; - if (streq(what, esp_flags[i])) - return 5*32 + i; - } - - /* Oops */ - msg_format("Unknown object flag '%s'.", what); - - /* Error */ - return ( -1); - -} - -int get_r_flag(char *what) -{ - int i; - - /* Check flags */ - /* this processes all r_info_flag arrays in parallel. - Seemed like a good idea at the time.. - */ - for (i = 0; i < 32; i++) - { - if (streq(what, r_info_flags1[i])) - return i; - if (streq(what, r_info_flags2[i])) - return 1*32 + i; - if (streq(what, r_info_flags3[i])) - return 2*32 + i; - if (streq(what, r_info_flags4[i])) - return 3*32 + i; - if (streq(what, r_info_flags5[i])) - return 4*32 + i; - if (streq(what, r_info_flags6[i])) - return 5*32 + i; - if (streq(what, r_info_flags7[i])) - return 6*32 + i; - if (streq(what, r_info_flags8[i])) - return 7*32 + i; - if (streq(what, r_info_flags9[i])) - return 8*32 + i; - } - - /* Oops */ - msg_format("Unknown race flag '%s'.", what); - - /* Error */ - return ( -1); -} -int init_al_info_essence(char *essence) -{ - int i; - for ( i = 0 ; essence_names[i][0] ; i++) - if (!strncmp(essence_names[i], essence, 9)) - { - return i; - } - return -1; -} -/* - * Initialize the "al_info" array, by parsing an ascii "template" file - */ -errr init_al_info_txt(FILE *fp) -{ - int al_idx = 0, a_idx = 0; - char *s, *t; - struct artifact_select_flag *a_ptr = NULL; - char buf[1024]; - - /* Not ready yet */ - bool_ okay = FALSE; - - /* Just before the first record */ - error_idx = -1; - - /* Just before the first line */ - error_line = -1; - - /* Parse */ - while (0 == my_fgets(fp, buf, 1024)) - { - /* Advance the line number */ - error_line++; - - /* Skip comments and blank lines */ - if (!buf[0] || (buf[0] == '#')) continue; - - /* Verify correct "colon" format */ - if (buf[1] != ':') return (1); - - /* Hack -- Process 'V' for "Version" */ - if (buf[0] == 'V') - { - int v1, v2, v3; - - /* Scan for the values */ - if (3 != sscanf(buf + 2, "%d.%d.%d", &v1, &v2, &v3)) return (2); - - /* Okay to proceed */ - okay = TRUE; - - /* Continue */ - continue; - } - - /* No version yet */ - if (!okay) return (2); - - /* Process 'I' for "Info" (one line only) */ - if (buf[0] == 'I') - { - int tval, sval, qty; - - /* Scan for the values */ - if (3 != sscanf(buf + 2, "%d:%d:%d", - &tval, &sval, &qty)) - { - return (1); - } - - /* ignore everything after the first space. */ - s = strchr(buf, ' '); - if (s != NULL) - *s = 0; - - /* Save the values */ - alchemist_recipes[al_idx].tval = tval; - alchemist_recipes[al_idx].sval = sval; - alchemist_recipes[al_idx].qty = qty; - alchemist_recipes[al_idx].sval_essence = init_al_info_essence(strrchr(buf, ':') + 1); - if (alchemist_recipes[al_idx].sval_essence < 0) - return 5; - - al_idx++; - if (al_idx >= max_al_idx) - return 7; - /* Next... */ - continue; - } - if (buf[0] == 'a') - { - int qty; - if ( 1 != sscanf(buf + 2, "%d", &qty)) - { - return (1); - } - s = strrchr(buf, ':'); - *(s++) = 0; - t = strchr(s, ' '); - *(t++) = 0; - alchemist_recipes[al_idx].tval = 0; - alchemist_recipes[al_idx].sval = get_k_flag(s); - alchemist_recipes[al_idx].qty = qty; - alchemist_recipes[al_idx].sval_essence = init_al_info_essence(t); - if (alchemist_recipes[al_idx].sval_essence < 0) - return 1; - - al_idx++; - if (al_idx >= max_al_idx) - return 7; /* 7 is an 'out of memory' error */ - - continue; - } - if (buf[0] == 'A') - { - int group, level, pval, rtval, rsval, rpval; - long xp; - /*Verify that complete description information is - Recorded for previous Artifact flag - */ - if (a_ptr - && (!a_ptr->group || !a_ptr->desc || !a_ptr->item_desc != !a_ptr->rtval) - ) - return (1); - - a_ptr = &a_select_flags[a_idx++]; - - if ( 7 != sscanf(buf + 2, "%d:%d:%d:%d:%d:%d:%ld", - &group, &rtval, &rsval, &rpval, &pval, &level, &xp)) - return (1); - a_ptr->group = group; - a_ptr->rtval = rtval; - a_ptr->rsval = rsval; - a_ptr->rpval = rpval; - a_ptr->pval = pval; - a_ptr->level = level; - a_ptr->xp = xp; - continue; - } - - /*Anything else here MUST be a artifact flag line*/ - if ( !a_ptr) - return (3); - - if (buf[0] == 'F') - { - /* Get the Item flag associated with this */ - a_ptr->flag = get_k_flag(buf + 2); - if (a_ptr->flag == -1) - return (1); - continue; - } - if (buf[0] == 'x') - { - /* Get the activation name associated with this */ - a_ptr->flag = -get_activation(buf + 2); - if (a_ptr->flag == 1) - return (1); - a_ptr->group = 88; - a_ptr->pval = 0; - continue; - } - /* Get the race flags associated with this */ - if (buf[0] == 'f') - { - char *s, *t; - int idx = 0; - - if ( a_ptr->rflag[0] ) - { - msg_print("duplicate f: entries for one corpse"); - return (5); - } - - if ( a_ptr->rtval != TV_CORPSE ) - { - msg_print("f: section for corpse flags only"); - return (5); - } - if ( a_ptr->rpval ) - { - msg_print("Can't specify r_info.txt index with f: section"); - return (5); - } - - /* Parse every entry textually */ - for (s = buf + 2; *s; ) - { - /* Find the end of this entry */ - for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */; - - /* Nuke and skip any dividers */ - if (*t) - { - *t++ = '\0'; - while ((*t == ' ') || (*t == '|')) t++; - } - - if ( idx > 5 ) - { - msg_print("Limit on race flags is currently 6"); - return (5); - } - - /* Parse this entry */ - a_ptr->rflag[idx] = get_r_flag(s); - if (a_ptr->rflag[idx++] == -1) - return (5); - - /* Start the next entry */ - s = t; - } - - /* Next... */ - continue; - } - - /* Process 'p' for "Plural Description" */ - /* Only valid for flag which depend on pval */ - if (buf[0] == 'p') - { - /* Reject if doesn't depend on pval */ - if (!a_ptr->pval) - return (1); - - /* Acquire the description */ - s = buf + 2; - - /* Copy plural description */ - assert(!a_ptr->item_descp); - a_ptr->item_descp = my_strdup(s); - - /* Next... */ - continue; - } - - /* Process 'D' for "Description" (one line only) */ - if (buf[0] == 'D') - { - /* Acquire the description */ - s = buf + 2; - - /* Copy description */ - assert(!a_ptr->desc); - a_ptr->desc = my_strdup(s); - - /* Next... */ - continue; - } - - /* Process 'd' for "Item Description" (one line only) */ - if (buf[0] == 'd') - { - /* Acquire the name */ - s = buf + 2; - - /* Reject if we already have a description */ - if (a_ptr->item_desc) - return (7); - - /* Copy description */ - assert(!a_ptr->item_desc); - a_ptr->item_desc = my_strdup(s); - - /* Next... */ - continue; - } - - /* Oops */ - return (6); - } - - /* No version yet */ - if (!okay) return (2); - - /* Success */ - return (0); -} - /* * Grab one flag in an artifact_type from a textual string */ @@ -10619,12 +10244,6 @@ static errr process_dungeon_file_aux(char *buf, int *yval, int *xval, int xvalst max_a_idx = atoi(zz[1]); } - /* Maximum al_idx */ - else if (zz[0][0] == 'a') - { - max_al_idx = atoi(zz[1]); - } - /* Maximum e_idx */ else if (zz[0][0] == 'E') { |