summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/arena.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-04-07 16:58:07 +0200
committerAdam Borowski <kilobyte@angband.pl>2013-04-07 16:58:07 +0200
commit211afdb1629cfef3b825e86bc604c6667b47b6d8 (patch)
treeb2d4ed077126b3a2a5ea5cb98a17fe63617d938f /crawl-ref/source/arena.cc
parent1d504a9b0f5a03ba4a23b4308520e440d4bee5c6 (diff)
downloadcrawl-ref-211afdb1629cfef3b825e86bc604c6667b47b6d8.tar.gz
crawl-ref-211afdb1629cfef3b825e86bc604c6667b47b6d8.zip
An ugly hack: exempt tentacles from arena faction calculations.
This commit causes problems with freestanding tentacles: if they're the only members of a side, the fight ends -- but that's certainly better than a crash. Such tentacles don't exist except for manual requests, being normally ever spawned by the spell.
Diffstat (limited to 'crawl-ref/source/arena.cc')
-rw-r--r--crawl-ref/source/arena.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/crawl-ref/source/arena.cc b/crawl-ref/source/arena.cc
index 23e0ff1c73..6100ac4567 100644
--- a/crawl-ref/source/arena.cc
+++ b/crawl-ref/source/arena.cc
@@ -538,6 +538,8 @@ namespace arena
for (monster_iterator mons; mons; ++mons)
{
+ if (mons_is_tentacle(mons->type))
+ continue;
if (mons->attitude == ATT_FRIENDLY)
faction_a.active_members++;
else if (mons->attitude == ATT_HOSTILE)
@@ -1048,6 +1050,8 @@ monster_type arena_pick_random_monster(const level_id &place)
bool arena_veto_random_monster(monster_type type)
{
+ if (mons_is_tentacle(type))
+ return true;
if (!arena::allow_immobile && mons_class_is_stationary(type))
return true;
if (!arena::allow_zero_xp && mons_class_flag(type, M_NO_EXP_GAIN))
@@ -1087,7 +1091,9 @@ bool arena_veto_place_monster(const mgen_data &mg, bool first_band_member,
// is placed via splitting.
void arena_placed_monster(monster* mons)
{
- if (mons->attitude == ATT_FRIENDLY)
+ if (mons_is_tentacle(mons->type))
+ ; // we don't count tentacles, even free-standing
+ else if (mons->attitude == ATT_FRIENDLY)
{
arena::faction_a.active_members++;
arena::faction_b.won = false;
@@ -1097,12 +1103,6 @@ void arena_placed_monster(monster* mons)
arena::faction_b.active_members++;
arena::faction_a.won = false;
}
- else
- {
- mprf(MSGCH_ERROR, "Placed neutral (%d) monster %s",
- static_cast<int>(mons->attitude),
- mons->name(DESC_PLAIN, true).c_str());
- }
if (!arena::allow_summons || !arena::allow_animate)
{
@@ -1191,7 +1191,9 @@ void arena_split_monster(monster* split_from, monster* split_to)
void arena_monster_died(monster* mons, killer_type killer,
int killer_index, bool silent, int corpse)
{
- if (mons->attitude == ATT_FRIENDLY)
+ if (mons_is_tentacle(mons->type))
+ ; // part of a monster, or a spell
+ else if (mons->attitude == ATT_FRIENDLY)
arena::faction_a.active_members--;
else if (mons->attitude == ATT_HOSTILE)
arena::faction_b.active_members--;