summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-15 14:31:48 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-15 14:31:48 +0000
commit3e19a2c17e30265df5a49f8aa5c9e598d309e20b (patch)
treec1ab1a74b3d9185be9b0c62ea225168744f2059b
parent2854a6cf54831cd8415f96be5d6542440beb71a2 (diff)
downloadcrawl-ref-3e19a2c17e30265df5a49f8aa5c9e598d309e20b.tar.gz
crawl-ref-3e19a2c17e30265df5a49f8aa5c9e598d309e20b.zip
Fix [2506229].
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8463 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/beam.cc5
-rw-r--r--crawl-ref/source/monstuff.cc3
-rw-r--r--crawl-ref/source/xom.cc20
3 files changed, 10 insertions, 18 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index bf48e44b0a..82da7982c1 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -4005,11 +4005,8 @@ void bolt::update_hurt_or_helped(monsters *mon)
friend_info.hurt++;
// Harmful beam from this monster rebounded and hit the monster.
- if (!is_tracer
- && static_cast<int>(monster_index(mon)) == beam_source)
- {
+ if (!is_tracer && mon->mindex() == beam_source)
xom_is_stimulated(128);
- }
}
else if (nice_to(mon))
friend_info.helped++;
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index e787b38f4b..31a9896171 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -270,7 +270,6 @@ void monster_drop_ething(monsters *monster, bool mark_item_origins,
int owner_id)
{
const bool hostile_grid = grid_destroys_items(grd(monster->pos()));
- const int midx = (int) monster_index(monster);
bool destroyed = false;
@@ -285,7 +284,7 @@ void monster_drop_ething(monsters *monster, bool mark_item_origins,
testbits(mitm[item].flags, ISFLAG_SUMMONED);
if (hostile_grid || summoned_item)
{
- item_was_destroyed(mitm[item], midx);
+ item_was_destroyed(mitm[item], monster->mindex());
destroy_item( item );
if (!summoned_item)
destroyed = true;
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 42c5f27fd3..24e0042700 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -800,21 +800,20 @@ static bool _xom_is_good(int sever, int tension)
// It's pointless to send in help if there's no danger.
else if (tension > 0 && x_chance_in_y(5, sever))
{
- // XXX: Can we clean up this ugliness, please?
+ // FIXME: Can we clean up this ugliness, please?
const int numdemons =
std::min(random2(random2(random2(sever+1)+1)+1)+2, 16);
int numdifferent = 0;
// If we have a mix of demons and non-demons, there's a chance
// that one or both of the factions may be hostile.
- int hostile = random2(12);
- int hostiletype =
- (hostile < 3) ? 0 : // 1/4: both are friendly
- (hostile < 11) ? (coinflip() ? 1 : 2) // 2/3: one is hostile
- : 3; // 1/12: both are hostile
+ int hostiletype = random_choose_weighted(3, 0, // both friendly
+ 4, 1, // one hostile
+ 4, 2, // other hostile
+ 1, 3); // both hostile
- bool *is_demonic = new bool[numdemons];
- int *summons = new int[numdemons];
+ std::vector<bool> is_demonic(numdemons);
+ std::vector<int> summons(numdemons);
bool success = false;
@@ -859,7 +858,7 @@ static bool _xom_is_good(int sever, int tension)
for (int i = 0; i < numdemons; ++i)
{
- monsters *mon = &menv[i];
+ monsters *mon = &menv[summons[i]];
if (hostiletype != 0)
{
@@ -878,9 +877,6 @@ static bool _xom_is_good(int sever, int tension)
done = true;
}
-
- delete[] is_demonic;
- delete[] summons;
}
else if (x_chance_in_y(6, sever))
{