summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-01-02 15:07:54 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-01-02 15:07:54 +0000
commit9548119ecb3949f1df7d8bb39372e9fd5b656690 (patch)
treedb7a47ba253a78e88f1251407e22af430cf7f524 /crawl-ref/source
parent98450ce0f336e8ab7af37f44080ec1a98f1d0fb6 (diff)
downloadcrawl-ref-9548119ecb3949f1df7d8bb39372e9fd5b656690.tar.gz
crawl-ref-9548119ecb3949f1df7d8bb39372e9fd5b656690.zip
Blinking/teleporting monsters should not be able to land on the player's position.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@768 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/externs.h3
-rw-r--r--crawl-ref/source/items.cc29
-rw-r--r--crawl-ref/source/monstuff.cc1
-rw-r--r--crawl-ref/source/mstuff2.cc5
-rw-r--r--crawl-ref/source/spells2.cc9
5 files changed, 22 insertions, 25 deletions
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 871605da97..5d91734a35 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -290,9 +290,8 @@ struct item_def
item_def() : base_type(OBJ_UNASSIGNED), sub_type(0), plus(0), plus2(0),
special(0L), colour(0), flags(0L), quantity(0),
x(0), y(0), link(NON_ITEM), slot(0), orig_place(0),
- orig_monnum(0)
+ orig_monnum(0), inscription()
{
- inscription.clear();
}
void clear()
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index da54eeaf4f..dcab9825a2 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -1963,54 +1963,55 @@ void update_corpses(double elapsedTime)
for (int c = 0; c < MAX_ITEMS; c++)
{
- if (mitm[c].quantity < 1)
+ item_def &it = mitm[c];
+
+ if (!is_valid_item(it))
continue;
- if (mitm[c].base_type != OBJ_CORPSES && mitm[c].base_type != OBJ_FOOD)
+ if (it.base_type != OBJ_CORPSES && it.base_type != OBJ_FOOD)
{
continue;
}
- if (mitm[c].base_type == OBJ_CORPSES
- && mitm[c].sub_type > CORPSE_SKELETON)
+ if (it.base_type == OBJ_CORPSES
+ && it.sub_type > CORPSE_SKELETON)
{
continue;
}
- if (mitm[c].base_type == OBJ_FOOD && mitm[c].sub_type != FOOD_CHUNK)
+ if (it.base_type == OBJ_FOOD && it.sub_type != FOOD_CHUNK)
{
continue;
}
- if (rot_time >= mitm[c].special)
+ if (rot_time >= it.special)
{
- if (mitm[c].base_type == OBJ_FOOD)
+ if (it.base_type == OBJ_FOOD)
{
destroy_item(c);
}
else
{
- if (mitm[c].sub_type == CORPSE_SKELETON
- || !mons_skeleton( mitm[c].plus ))
+ if (it.sub_type == CORPSE_SKELETON
+ || !mons_skeleton( it.plus ))
{
destroy_item(c);
}
else
{
- mitm[c].sub_type = CORPSE_SKELETON;
- mitm[c].special = 200;
- mitm[c].colour = LIGHTGREY;
+ it.sub_type = CORPSE_SKELETON;
+ it.special = 200;
+ it.colour = LIGHTGREY;
}
}
}
else
{
ASSERT(rot_time < 256);
- mitm[c].special -= rot_time;
+ it.special -= rot_time;
}
}
-
int fountain_checks = (int)(elapsedTime / 1000.0);
if (random2(1000) < (int)(elapsedTime) % 1000)
fountain_checks += 1;
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index e43e33ec8e..66ebef55e0 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -1111,6 +1111,7 @@ bool random_near_space(int ox, int oy, int &tx, int &ty, bool allow_adjacent,
while ((!see_grid(tx, ty) && restrict_LOS)
|| grd[tx][ty] < DNGN_SHALLOW_WATER
|| mgrd[tx][ty] != NON_MONSTER
+ || (tx == you.x_pos && ty == you.y_pos)
|| (!allow_adjacent && distance(ox, oy, tx, ty) <= 2));
return (tries < 150);
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index ebed0c633a..3a60fda754 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -802,8 +802,11 @@ void monster_teleport(struct monsters *monster, bool instan, bool silent)
newy = 10 + random2(GYM - 20);
// don't land on top of another monster
- if (mgrd[newx][newy] != NON_MONSTER)
+ if (mgrd[newx][newy] != NON_MONSTER
+ || (newx == you.x_pos && newy == you.y_pos))
+ {
continue;
+ }
if (monster_habitable_grid(monster, grd[newx][newy]))
break;
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index fd03b4a2c7..9673214744 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -337,7 +337,7 @@ int animate_dead( int power, int corps_beh, int corps_hit, int actual )
int objl = igrd[adx][ady];
int hrg = 0;
- //this searches all the items on the ground for a corpse
+ // This searches all the items on the ground for a corpse
while (objl != NON_ITEM)
{
if (mitm[objl].base_type == OBJ_CORPSES)
@@ -363,13 +363,6 @@ int animate_dead( int power, int corps_beh, int corps_hit, int actual )
if (number_raised > 0)
{
mpr("The dead are walking!");
- //else
- // mpr("The dark energy consumes the dead!"); - no, this
- // means that no corpses were found. Better to say:
- // mpr("You receive no reply.");
- //jmf: Why do I have to get an uninformative message when some random
- //jmf: monster fails to do something?
- // IMHO there's too much noise already.
}
return number_raised;