summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/acr.cc21
-rw-r--r--crawl-ref/source/enum.h10
-rw-r--r--crawl-ref/source/externs.h14
-rw-r--r--crawl-ref/source/initfile.cc10
-rw-r--r--crawl-ref/source/makeitem.cc2
-rw-r--r--crawl-ref/source/misc.cc4
-rw-r--r--crawl-ref/source/mon-util.cc6
-rw-r--r--crawl-ref/source/monstuff.cc5
-rw-r--r--crawl-ref/source/tags.cc10
-rw-r--r--crawl-ref/source/tags.h11
10 files changed, 56 insertions, 37 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 7f111843bb..3802878710 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -1851,17 +1851,17 @@ static void _print_friendly_pickup_setting(bool was_changed)
{
std::string now = (was_changed? "now " : "");
- if (Options.friendly_pickup == -1)
+ if (you.friendly_pickup == FRIENDLY_PICKUP_NONE)
{
mprf("Your allies are %sforbidden to pick up anything at all.",
now.c_str());
}
- else if (Options.friendly_pickup == 0)
+ else if (you.friendly_pickup == FRIENDLY_PICKUP_FRIEND)
{
mprf("Your allies may %sonly pick up items dropped by allies.",
now.c_str());
}
- else if (Options.friendly_pickup == 1)
+ else if (you.friendly_pickup == FRIENDLY_PICKUP_ALL)
{
mprf("Your allies may %spick up anything they need.", now.c_str());
}
@@ -2040,17 +2040,20 @@ void process_command( command_type cmd )
{
// Toggle pickup mode for friendlies.
_print_friendly_pickup_setting(false);
- mpr("Change to (n)othing, (f)riend-dropped, or (a)ll? ", MSGCH_PROMPT);
+ mpr("Change to (d)efault, (n)othing, (f)riend-dropped, or (a)ll? ",
+ MSGCH_PROMPT);
char type = (char) getchm(KC_DEFAULT);
type = tolower(type);
- if (type == 'n')
- Options.friendly_pickup = -1;
+ if (type == 'd')
+ you.friendly_pickup = Options.default_friendly_pickup;
+ else if (type == 'n')
+ you.friendly_pickup = FRIENDLY_PICKUP_NONE;
else if (type == 'f')
- Options.friendly_pickup = 0;
+ you.friendly_pickup = FRIENDLY_PICKUP_FRIEND;
else if (type == 'a')
- Options.friendly_pickup = 1;
+ you.friendly_pickup = FRIENDLY_PICKUP_ALL;
else
{
canned_msg( MSG_OK );
@@ -4032,7 +4035,7 @@ static bool _initialise(void)
if (newc) // start a new game
{
- Options.friendly_pickup = Options.default_friendly_pickup;
+ you.friendly_pickup = Options.default_friendly_pickup;
// Mark items in inventory as of unknown origin.
origin_set_inventory(origin_set_unknown);
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index b73aca2c8e..7794bbd4ae 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1372,6 +1372,7 @@ enum level_area_type // you.level_type
NUM_LEVEL_AREA_TYPES
};
+// reasons for entering the Abyss
enum entry_cause_type
{
EC_UNKNOWN,
@@ -1379,7 +1380,7 @@ enum entry_cause_type
EC_SELF_RISKY, // i.e., wielding an id'd distorion weapon
EC_SELF_ACCIDENT, // i.e., wielding an un-id'd distortion weapon
EC_MISCAST,
- EC_GOD_RETRIUBTION,
+ EC_GOD_RETRIBUTION,
EC_GOD_ACT, // Xom sending the player somewhere for amusement
EC_MONSTER,
NUM_ENTRY_CAUSE_TYPES
@@ -2723,6 +2724,13 @@ enum unique_item_status_type
UNIQ_LOST_IN_ABYSS = 2
};
+enum friendly_pickup_type
+{
+ FRIENDLY_PICKUP_NONE = 0,
+ FRIENDLY_PICKUP_FRIEND,
+ FRIENDLY_PICKUP_ALL
+};
+
#ifdef WIZARD
enum wizard_option_type
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index da0067ad31..70fd38a5e1 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -559,7 +559,8 @@ public:
std::vector<int> beheld_by; // monsters beholding player
- bool just_autoprayed; // autopray just kicked in
+ bool just_autoprayed; // autopray just kicked in
+ int friendly_pickup; // pickup setting for allies
unsigned short prev_targ;
coord_def prev_grd_targ;
@@ -1014,7 +1015,7 @@ public:
public:
std::string mname;
-
+
int type;
int hit_points;
int max_hit_points;
@@ -1061,9 +1062,9 @@ public:
// Does this monster have a base name, i.e. is base_name() != name().
// See base_name() for details.
bool has_base_name() const;
-
- const monsterentry *find_monsterentry() const;
-
+
+ const monsterentry *find_monsterentry() const;
+
void init_experience();
void mark_summoned(int longevity, bool mark_items_summoned );
@@ -1079,7 +1080,7 @@ public:
// Has a hydra-like variable number of attacks based on mons->number.
bool has_hydra_multi_attack() const;
-
+
bool has_ench(enchant_type ench) const;
bool has_ench(enchant_type ench, enchant_type ench2) const;
mon_enchant get_ench(enchant_type ench,
@@ -1606,7 +1607,6 @@ public:
bool autopickup_on;
bool autoprayer_on;
int default_friendly_pickup;
- int friendly_pickup;
bool show_more_prompt;
bool show_gold_turns; // Show gold and turns in HUD.
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index bc14c9545f..d2e44d7d14 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -628,7 +628,7 @@ void game_options::reset_options()
autopickup_on = true;
autoprayer_on = false;
- default_friendly_pickup = 0; // allies may only pickup items
+ default_friendly_pickup = FRIENDLY_PICKUP_FRIEND;
show_more_prompt = true;
show_gold_turns = false;
@@ -1805,11 +1805,11 @@ void game_options::read_option_line(const std::string &str, bool runscript)
else if (key == "default_friendly_pickup")
{
if (field == "none")
- default_friendly_pickup = -1;
- else if (field == "all")
- default_friendly_pickup = 1;
+ default_friendly_pickup = FRIENDLY_PICKUP_NONE;
else if (field == "friend")
- default_friendly_pickup = 0;
+ default_friendly_pickup = FRIENDLY_PICKUP_FRIEND;
+ else if (field == "all")
+ default_friendly_pickup = FRIENDLY_PICKUP_ALL;
}
else BOOL_OPTION(show_inventory_weights);
else BOOL_OPTION(suppress_startup_errors);
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index 95540dacfc..64a96c12e1 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -1780,7 +1780,7 @@ static void _generate_missile_item(item_def& item, int force_type,
}
else if (item.sub_type == MI_STONE)
{
- item.quantity = 1^+ random2(9) + random2(12) + random2(15) + random2(12);
+ item.quantity = 1 + random2(9) + random2(12) + random2(15) + random2(12);
return;
}
else if (item.sub_type == MI_THROWING_NET) // no fancy nets, either
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index b7fdba8714..dbe150e71f 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1477,7 +1477,7 @@ static void set_entry_cause(entry_cause_type default_cause,
if (crawl_state.is_god_acting())
{
if (crawl_state.is_god_retribution())
- you.entry_cause = EC_GOD_RETRIUBTION;
+ you.entry_cause = EC_GOD_RETRIBUTION;
else
you.entry_cause = EC_GOD_ACT;
@@ -2122,7 +2122,7 @@ void down_stairs( int old_level, dungeon_feature_type force_stair,
if (newlevel)
{
// When entering a new level, reset friendly_pickup to default.
- Options.friendly_pickup = Options.default_friendly_pickup;
+ you.friendly_pickup = Options.default_friendly_pickup;
switch(you.level_type)
{
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 7c10f1d1d8..dd57728002 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -2941,7 +2941,7 @@ bool monsters::can_use_missile(const item_def &item) const
if (item.sub_type == MI_LARGE_ROCK && !can_throw_rocks())
return (false);
- // These don't need any launcher, and always okay.
+ // These don't need any launcher, and are always okay.
if (item.sub_type == MI_STONE || item.sub_type == MI_DART)
return (true);
@@ -3808,8 +3808,8 @@ bool monsters::pickup_item(item_def &item, int near, bool force)
// Depending on the friendly pickup toggle, your allies may not
// pick up anything, or only stuff dropped by (other) allies.
- if (Options.friendly_pickup < 0
- || Options.friendly_pickup == 0
+ if (you.friendly_pickup == FRIENDLY_PICKUP_NONE
+ || you.friendly_pickup == FRIENDLY_PICKUP_FRIEND
&& !testbits(item.flags, ISFLAG_DROPPED_BY_ALLY))
{
return false;
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 8677061f73..f6aa5cc7c1 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -4851,9 +4851,10 @@ static void _handle_monster_move(int i, monsters *monster)
|| monster->type == MONS_GHOUL))
{
// Keep neutral and charmed monsters from picking up stuff.
- // Same for friendlies if friendly_pickup is set to -1.
+ // Same for friendlies if friendly_pickup is set to "none".
if (!mons_neutral(monster) && !monster->has_ench(ENCH_CHARM)
- && (!mons_friendly(monster) || Options.friendly_pickup >= 0))
+ && (!mons_friendly(monster)
+ || you.friendly_pickup > FRIENDLY_PICKUP_NONE))
{
if (_handle_pickup(monster))
{
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index 4a3f586a66..0fd7ecab8a 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -1008,6 +1008,9 @@ static void tag_construct_you(writer &th)
// minorVersion 3 starts here
you.m_quiver->save(th);
+
+ // minorVersion 7 starts here
+ marshallByte(th, you.friendly_pickup);
}
static void tag_construct_you_items(writer &th)
@@ -1394,6 +1397,9 @@ static void tag_read_you(reader &th, char minorVersion)
if (minorVersion >= TAG_MINOR_QUIVER)
you.m_quiver->load(th);
+
+ if (minorVersion >= TAG_MINOR_FPICKUP)
+ you.friendly_pickup = unmarshallByte(th);
}
static void tag_read_you_items(reader &th, char minorVersion)
@@ -2017,10 +2023,10 @@ static void tag_read_level_items(reader &th, char minorVersion)
static void unmarshall_monster(reader &th, monsters &m)
{
m.reset();
-
+
if (_tag_minor_version >= TAG_MINOR_MONNAM)
m.mname = unmarshallString(th, 100);
-
+
m.ac = unmarshallByte(th);
m.ev = unmarshallByte(th);
m.hit_dice = unmarshallByte(th);
diff --git a/crawl-ref/source/tags.h b/crawl-ref/source/tags.h
index 3b96dec779..5b30de1779 100644
--- a/crawl-ref/source/tags.h
+++ b/crawl-ref/source/tags.h
@@ -34,7 +34,7 @@ enum tag_type // used during save/load process to identify data blocks
enum tag_file_type // file types supported by tag system
{
- TAGTYPE_PLAYER=0, // Foo.sav
+ TAGTYPE_PLAYER = 0, // Foo.sav
TAGTYPE_LEVEL, // Foo.00a, .01a, etc.
TAGTYPE_GHOST, // bones.xxx
@@ -50,12 +50,13 @@ enum tag_major_version
// Minor version will be reset to zero when major version changes.
enum tag_minor_version
{
- TAG_MINOR_PIETY = 2, // Added piety_hysteresis
- TAG_MINOR_QUIVER = 3, // Added quiver
+ TAG_MINOR_PIETY = 2, // Added piety_hysteresis
+ TAG_MINOR_QUIVER = 3, // Added quiver
TAG_MINOR_MAPMARK = 4, // Added sizes to map markers
- TAG_MINOR_MONNAM = 5, // Monsters get individual names
+ TAG_MINOR_MONNAM = 5, // Monsters get individual names
TAG_MINOR_MONBASE = 6, // Zombie base monster gets its own field.
- TAG_MINOR_VERSION = 6 // Current version
+ TAG_MINOR_FPICKUP = 7, // Added pickup option for allied monsters.
+ TAG_MINOR_VERSION = 7 // Current version
};