cptr prev_ptr, ptr, old_ptr;
int prev_flg;
- if (str[1] == ':') switch (str[0])
+ if (str[0] && str[1] == ':') switch (str[0])
{
case '?': case '%':
case 'A': case 'P': case 'C':
entry->flag[0] = entry->flag[1] = 0L;
entry->dice = 0;
+ entry->bonus = 0;
act = DO_AUTOPICK | DO_DISPLAY;
while (TRUE)
{
/* Ego objects */
if (object_is_ego(o_ptr))
-
{
if (object_is_weapon_armour_ammo(o_ptr))
{
/* Don't use the object description */
name = FALSE;
- if (object_is_weapon_armour_ammo(o_ptr))
- {
- /* Restrict to 'common' equipments */
- if (!object_is_rare(o_ptr)) ADD_FLG(FLG_COMMON);
- }
+ /* Restrict to 'common' equipments */
+ if (!object_is_rare(o_ptr)) ADD_FLG(FLG_COMMON);
}
ADD_FLG(FLG_EGO);
{
string_free(entry->name);
string_free(entry->insc);
+ entry->name = NULL;
+ entry->insc = NULL;
}
return format("%s.prf", namebase);
case PT_WITH_PNAME:
- return format("%s-%s.prf", namebase, player_name);
+ return format("%s-%s.prf", namebase, player_base);
default:
return NULL;
C_MAKE(autopick_list, max_max_autopick, autopick_type);
/* Copy from old list to new list */
- C_COPY(autopick_list, old_autopick_list, old_max_max_autopick, autopick_type);
+ (void)C_COPY(autopick_list, old_autopick_list, old_max_max_autopick, autopick_type);
/* Kill old list */
- C_FREE(old_autopick_list, old_max_max_autopick, autopick_type);
+ C_KILL(old_autopick_list, old_max_max_autopick, autopick_type);
}
/* Add one line */
&& entry->flag[0] == autopick_list[i].flag[0]
&& entry->flag[1] == autopick_list[i].flag[1]
&& entry->dice == autopick_list[i].dice
- && entry->bonus == autopick_list[i].bonus) return 0;
+ && entry->bonus == autopick_list[i].bonus)
+ {
+ autopick_free_entry(entry);
+ return 0;
+ }
add_autopick_list(entry);
return 0;
/* Require boosted dice */
if ((o_ptr->dd == k_ptr->dd) && (o_ptr->ds == k_ptr->ds))
return FALSE;
+
+ /* In Vault Quest, Dice must be hide.*/
+ if(!object_is_known(o_ptr) && object_is_quest_target(o_ptr))
+ {
+ return FALSE;
+ }
}
/*** Weapons which dd*ds is more than nn ***/
/* Known to be worthless? */
if (leave_worth)
if (object_value(o_ptr) > 0) return FALSE;
-
+
if (leave_equip)
if (object_is_weapon_armour_ammo(o_ptr)) return FALSE;
-
+
if (leave_chest)
if ((o_ptr->tval == TV_CHEST) && o_ptr->pval) return FALSE;
-
+
if (leave_wanted)
{
if (object_is_shoukinkubi(o_ptr)) return FALSE;
}
-
+
if (leave_corpse)
if (o_ptr->tval == TV_CORPSE) return FALSE;
-
+
if (leave_junk)
if ((o_ptr->tval == TV_SKELETON) || (o_ptr->tval == TV_BOTTLE) || (o_ptr->tval == TV_JUNK) || (o_ptr->tval == TV_STATUE)) return FALSE;
else if (p_ptr->pclass == CLASS_NINJA)
{
if (o_ptr->tval == TV_LITE &&
- o_ptr->name2 == EGO_LITE_DARKNESS)
+ o_ptr->name2 == EGO_LITE_DARKNESS && object_is_known(o_ptr))
return FALSE;
}
else if (p_ptr->pclass == CLASS_BEASTMASTER ||
p_ptr->pclass == CLASS_CAVALRY)
{
if (o_ptr->tval == TV_WAND &&
- o_ptr->sval == SV_WAND_HEAL_MONSTER)
+ o_ptr->sval == SV_WAND_HEAL_MONSTER && object_is_aware(o_ptr))
return FALSE;
}
}
-
+
if (o_ptr->tval == TV_GOLD) return FALSE;
-
+
return TRUE;
}
}
/* Record name of destroyed item */
- COPY(&autopick_last_destroyed_object, o_ptr, object_type);
+ (void)COPY(&autopick_last_destroyed_object, o_ptr, object_type);
/* Destroy Later */
o_ptr->marked |= OM_AUTODESTROY;
string_free(lines_list[lines]);
/* free list of pointers */
- C_FREE((char **)lines_list, MAX_LINES, char *);
+ C_KILL(lines_list, MAX_LINES, cptr);
}
while (TRUE)
{
+ bool match;
+
/* End of list? */
if (forward)
{
if (!autopick_new_entry(entry, tb->lines_list[i], FALSE)) continue;
/* Does this line match to the object? */
- if (!is_autopick_aux(o_ptr, entry, o_name)) continue;
-
+ match = is_autopick_aux(o_ptr, entry, o_name);
+ autopick_free_entry(entry);
+ if (!match) continue;
/* Found a line but it's inactive */
if (tb->states[i] & LSTAT_BYPASS)
char f;
cptr v;
cptr s = tb->lines_list[y];
+ char *ss, *s_keep;
+ int s_len;
/* Update this line's state */
tb->states[y] = state;
if (streq(s, "$AUTOREGISTER"))
state |= LSTAT_AUTOREGISTER;
+ s_len = strlen(s);
+ ss = (char *)string_make(s);
+ s_keep = ss;
+
/* Parse the expr */
- v = process_pref_file_expr(&s, &f);
+ v = process_pref_file_expr(&ss, &f);
/* Set flag */
if (streq(v, "0")) state |= LSTAT_BYPASS;
else state &= ~LSTAT_BYPASS;
+ /* Cannot use string_free() because the string was "destroyed" */
+ C_KILL(s_keep, s_len + 1, char);
+
/* Re-update this line's state */
tb->states[y] = state | LSTAT_EXPRESSION;
}
str1 = "This line is a comment.";
#endif
}
- else if (tb->lines_list[tb->cy][1] == ':')
+ else if (tb->lines_list[tb->cy][0] && tb->lines_list[tb->cy][1] == ':')
{
switch(tb->lines_list[tb->cy][0])
{
free_text_lines(tb->lines_list);
+ string_free(tb->search_str);
string_free(tb->last_destroyed);
/* Destroy string chain */