Stash-tracking is no longer #ifdef conditionalised. I'm not aware of anybody who compiles without it.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@538 c06c8d41-db1a-0410-9941-cceddc491573
547JREUJXTZNYVGHNNAET5F5O5JYYGNTDQB6ABZNT7YX5EY64OHAC
return runmode == RMODE_TRAVEL? "travel" :
runmode == RMODE_INTERLEVEL? "intertravel" :
runmode == RMODE_EXPLORE? "explore" :
runmode > 0? "run" :
"";
return runmode == RMODE_TRAVEL? "travel" :
runmode == RMODE_INTERLEVEL? "intertravel" :
runmode == RMODE_EXPLORE? "explore" :
runmode == RMODE_EXPLORE_GREEDY? "explore_greedy" :
runmode > 0? "run" :
"";
}
// Prompts the user to stop explore if necessary for the given
// explore-stop condition, returns true if explore should be stopped.
bool prompt_stop_explore(int es_why)
{
return (!(Options.explore_stop_prompt & es_why)
|| yesno("Stop exploring?", true, 'n', true, false));
}
static bool es_say(const char *what)
{
mprf("Spotted %s.", what);
return (true);
#define ES_shop (Options.explore_stop & ES_SHOP)
#define ES_stair (Options.explore_stop & ES_STAIR)
#define ES_altar (Options.explore_stop & ES_ALTAR)
#define ES_shop ((Options.explore_stop & ES_SHOP) && \
es_say("a shop") && prompt_stop_explore(ES_SHOP))
#define ES_stair ((Options.explore_stop & ES_STAIR) && \
es_say("a stair") && prompt_stop_explore(ES_STAIR))
#define ES_altar ((Options.explore_stop & ES_ALTAR) && \
es_say("an altar") && prompt_stop_explore(ES_ALTAR))
if (ES_item && igrd[x + 1][y + 1] != NON_ITEM)
return true;
if (ES_item && igrd[x + 1][y + 1] != NON_ITEM
&& you.running != RMODE_EXPLORE_GREEDY)
{
mprf("Spotted %s.",
item_name( mitm[ igrd[x + 1][y + 1] ], DESC_NOCAP_A ));
if (prompt_stop_explore(ES_ITEM))
return (true);
}
return (ES_shop && grid == DNGN_ENTER_SHOP)
|| (ES_stair && is_stair(grid))
|| (ES_altar && is_altar(grid)
&& you.where_are_you != BRANCH_ECUMENICAL_TEMPLE);
return (grid == DNGN_ENTER_SHOP && you.running != RMODE_EXPLORE_GREEDY
&& ES_shop)
|| (is_stair(grid) && ES_stair)
|| (is_altar(grid)
&& you.where_are_you != BRANCH_ECUMENICAL_TEMPLE
&& ES_altar);
if (floodout && you.running == RMODE_EXPLORE
&& !is_player_mapped(envf))
if (floodout && you.running.is_explore()
&& (!is_player_mapped(envf)
|| (you.running == RMODE_EXPLORE_GREEDY
&& is_greed_inducing_square(lev, dx, dy))))
you.running = RMODE_EXPLORE;
if (Options.explore_stop)
you.running = grab_items? RMODE_EXPLORE_GREEDY : RMODE_EXPLORE;
if (you.running == RMODE_EXPLORE_GREEDY
&& Options.stash_tracking != STM_ALL)
return a.base_type == b.base_type &&
a.sub_type == b.sub_type &&
a.plus == b.plus &&
a.plus2 == b.plus2 &&
a.special == b.special &&
a.colour == b.colour &&
a.flags == b.flags &&
a.quantity == b.quantity;
const bool same = a.base_type == b.base_type
&& a.sub_type == b.sub_type
&& a.plus == b.plus
&& a.plus2 == b.plus2
&& a.special == b.special
&& a.colour == b.colour
&& a.flags == b.flags
&& a.quantity == b.quantity;
// Account for rotting meat when comparing items.
return (same
|| (a.base_type == b.base_type
&& (a.base_type == OBJ_CORPSES
|| (a.base_type == OBJ_FOOD && a.sub_type == FOOD_CHUNK
&& b.sub_type == FOOD_CHUNK))
&& a.plus == b.plus));
bool LevelStashes::shop_needs_visit(int x, int y) const
{
const ShopInfo *shop = find_shop(x, y);
return (shop && !shop->is_visited());
}
bool LevelStashes::needs_visit(int x, int y) const
{
const Stash *s = find_stash(x, y);
if (s && (s->unverified() || s->pickup_eligible()))
return (true);
return (shop_needs_visit(x, y));
}
//David Loewenstern 6/99
int result, o, next;
bool did_pickup = false;
if (!Options.autopickup_on || Options.autopickups == 0L)
return;
return (strstr(item.inscription.c_str(), "=g") != 0
|| ((item.flags & ISFLAG_THROWN) && Options.pickup_thrown)
|| (((Options.autopickups & (1L << item.base_type))
#ifdef CLUA_BINDINGS
|| clua.callbooleanfn(false, "ch_autopickup", "u", &item)
#endif
)
&& (Options.pickup_dropped || !(item.flags & ISFLAG_DROPPED))
&& !is_banned(item)));
}
bool can_autopickup()
{
// [ds] Checking for autopickups == 0 is a bad idea because
// autopickup is still possible with inscriptions and
// pickup_thrown.
if (!Options.autopickup_on)
return (false);
if (
(strstr(mitm[o].inscription.c_str(), "=g") != 0) || (
((mitm[o].flags & ISFLAG_THROWN) && Options.pickup_thrown) ||
( (Options.autopickups & (1L << mitm[o].base_type)
#ifdef CLUA_BINDINGS
|| clua.callbooleanfn(false, "ch_autopickup", "u", &mitm[o])
#endif
)
&& (Options.pickup_dropped || !(mitm[o].flags & ISFLAG_DROPPED))
&& !is_banned(mitm[o]))))
if (item_needs_autopickup(mitm[o]))
append_vector(dump_order, split_string(",", text, true, true));
std::vector<std::string> fields = split_string(",", text, true, true);
if (add)
append_vector(dump_order, fields);
else
{
for (int f = 0, size = fields.size(); f < size; ++f)
{
for (int i = 0, dsize = dump_order.size(); i < dsize; ++i)
{
if (dump_order[i] == fields[f])
{
dump_order.erase( dump_order.begin() + i );
break;
}
}
}
}
}
int game_options::read_explore_stop_conditions(const std::string &field) const
{
int conditions = 0;
std::vector<std::string> stops = split_string(",", field);
for (int i = 0, count = stops.size(); i < count; ++i)
{
const std::string &c = stops[i];
if (c == "item" || c == "items")
conditions |= ES_ITEM;
else if (c == "pickup")
conditions |= ES_PICKUP;
else if (c == "greedy_pickup" || c == "greedy pickup")
conditions |= ES_GREEDY_PICKUP;
else if (c == "shop" || c == "shops")
conditions |= ES_SHOP;
else if (c == "stair" || c == "stairs")
conditions |= ES_STAIR;
else if (c == "altar" || c == "altars")
conditions |= ES_ALTAR;
}
return (conditions);
explore_stop = ES_NONE;
std::vector<std::string> stops = split_string(",", field);
for (int i = 0, count = stops.size(); i < count; ++i)
{
const std::string &c = stops[i];
if (c == "item" || c == "items")
explore_stop |= ES_ITEM;
else if (c == "shop" || c == "shops")
explore_stop |= ES_SHOP;
else if (c == "stair" || c == "stairs")
explore_stop |= ES_STAIR;
else if (c == "altar" || c == "altars")
explore_stop |= ES_ALTAR;
}
if (!plus_equal && !minus_equal)
explore_stop = ES_NONE;
const int new_conditions = read_explore_stop_conditions(field);
if (minus_equal)
explore_stop &= ~new_conditions;
else
explore_stop |= new_conditions;
}
else if (key == "explore_stop_prompt")
{
if (!plus_equal && !minus_equal)
explore_stop_prompt = ES_NONE;
const int new_conditions = read_explore_stop_conditions(field);
if (minus_equal)
explore_stop_prompt &= ~new_conditions;
else
explore_stop_prompt |= new_conditions;
RMODE_INTERLEVEL = -3, // Interlevel travel (Ctrl+G)
RMODE_EXPLORE = -2, // Exploring (Ctrl+O)
RMODE_TRAVEL = -1, // Classic or Plain Old travel
RMODE_NOT_RUNNING = 0, // must remain equal to 0
RMODE_INTERLEVEL = -4, // Interlevel travel (Ctrl+G)
RMODE_EXPLORE_GREEDY = -3, // Explore + grab items (Tab/Ctrl+I)
RMODE_EXPLORE = -2, // Exploring (Ctrl+O)
RMODE_TRAVEL = -1, // Classic or Plain Old travel
RMODE_NOT_RUNNING = 0, // must remain equal to 0
// Ask the player if they want to stop explore to examine
// the loot, but only if we picked up at least one item
// that the character did not throw.
int estop = (you.running == RMODE_EXPLORE_GREEDY
&& delay.parm1)? ES_GREEDY_PICKUP : ES_PICKUP;
if ((Options.explore_stop & estop) && prompt_stop_explore(estop))
stop_delay();