diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-19 05:18:25 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-19 05:18:25 +0000 |
commit | 77b699b8257957da2e84b70878e97af1adfccf08 (patch) | |
tree | 50b850ff908668e9ac944526f7157713e48e6da2 /crawl-ref | |
parent | 9c825029344d1ab8e5e85987a375cbae9109e2ce (diff) | |
download | crawl-ref-77b699b8257957da2e84b70878e97af1adfccf08.tar.gz crawl-ref-77b699b8257957da2e84b70878e97af1adfccf08.zip |
Since mons_clear_trapping_net() checks if the monster is caught in a
net, a separate check before calling it is redundant, so remove
instances of that.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5974 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/debug.cc | 13 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 6 | ||||
-rw-r--r-- | crawl-ref/source/mstuff2.cc | 11 | ||||
-rw-r--r-- | crawl-ref/source/mstuff2.h | 2 |
4 files changed, 13 insertions, 19 deletions
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index 3315167307..4268ffbfaf 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -4104,19 +4104,16 @@ static void _move_monster(int x, int y, int mid1) if (!moves.isValid || !in_bounds(moves.tx, moves.ty)) return; - struct monsters* mon1 = &menv[mid1]; - if (mons_is_caught(mon1)) - mons_clear_trapping_net(mon1); + monsters* mon1 = &menv[mid1]; + mons_clear_trapping_net(mon1); - int mid2 = mgrd[moves.tx][moves.ty]; - struct monsters* mon2 = NULL; + int mid2 = mgrd[moves.tx][moves.ty]; + monsters* mon2 = NULL; if (mid2 != NON_MONSTER) { mon2 = &menv[mid2]; - - if (mons_is_caught(mon2)) - mons_clear_trapping_net(mon2); + mons_clear_trapping_net(mon2); } mon1->x = moves.tx; diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 350803d8ba..f0078313f5 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -703,8 +703,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) if (!silent && _monster_avoided_death(monster, killer, i)) return; - if (mons_is_caught(monster)) - mons_clear_trapping_net(monster); + mons_clear_trapping_net(monster); // Update list of monsters beholding player. update_beholders(monster, true); @@ -1645,8 +1644,7 @@ bool monster_blink(monsters *monster) } } - if (mons_is_caught(monster)) - mons_clear_trapping_net(monster); + mons_clear_trapping_net(monster); mgrd[monster->x][monster->y] = NON_MONSTER; diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc index c3f9ae10a8..8e20b2dd09 100644 --- a/crawl-ref/source/mstuff2.cc +++ b/crawl-ref/source/mstuff2.cc @@ -996,8 +996,7 @@ void monster_teleport(struct monsters *monster, bool instan, bool silent) // Pick the monster up. mgrd(oldplace) = NON_MONSTER; - if (mons_is_caught(monster)) - mons_clear_trapping_net(monster); + mons_clear_trapping_net(monster); int newx, newy; while (true) @@ -2541,14 +2540,14 @@ bool moth_incite_monsters(const monsters *mon) return (false); } -void mons_clear_trapping_net(monsters *mons) +void mons_clear_trapping_net(monsters *mon) { - if (!mons_is_caught(mons)) + if (!mons_is_caught(mon)) return; - const int net = get_trapping_net(mons->x, mons->y); + const int net = get_trapping_net(mon->x, mon->y); if (net != NON_ITEM) remove_item_stationary(mitm[net]); - mons->del_ench(ENCH_HELD, true); + mon->del_ench(ENCH_HELD, true); } diff --git a/crawl-ref/source/mstuff2.h b/crawl-ref/source/mstuff2.h index 1feec60af6..7d7512ad66 100644 --- a/crawl-ref/source/mstuff2.h +++ b/crawl-ref/source/mstuff2.h @@ -99,6 +99,6 @@ bool orc_battle_cry(monsters *chief); bool orange_statue_effects(monsters *mons); bool silver_statue_effects(monsters *mons); bool moth_incite_monsters(const monsters *mon); -void mons_clear_trapping_net(monsters *mons); +void mons_clear_trapping_net(monsters *mon); #endif |