diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-17 06:33:24 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-17 06:33:24 +0000 |
commit | 24f899df4143cf27c98b218da786de393578e765 (patch) | |
tree | 9d81a68f2bb6e34647934b707d80036abc7f0cca /crawl-ref/source/religion.cc | |
parent | c3e48e8a84795381523dc3c524a1720819341f74 (diff) | |
download | crawl-ref-24f899df4143cf27c98b218da786de393578e765.tar.gz crawl-ref-24f899df4143cf27c98b218da786de393578e765.zip |
Fix attack conduct handling to register more than one conduct for an
attack again. For example, if you make an unchivalric attack on a
neutral monster, both the "unchivalric attack" and "attack neutral"
conducts will be handled again, instead of just the former (big oops).
Passing a constant-sized array of god_conduct_triggers and adding
wrapper functions to enable and disable them all is not the most elegant
solution, but I don't quite have the time or the understanding right now
to rewrite the god_conduct_trigger class to handle more than one conduct
at once, and this does work in the meantime.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5914 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/religion.cc')
-rw-r--r-- | crawl-ref/source/religion.cc | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 4f217b9ff5..c9bb6ed80d 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -2743,19 +2743,31 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, return (ret); } -void set_attack_conducts(const monsters *mon, god_conduct_trigger& conduct, +void set_attack_conducts(god_conduct_trigger conduct[4], const monsters *mon, bool known) { if (mons_friendly(mon)) - conduct.set(DID_ATTACK_FRIEND, 5, known, mon); + conduct[0].set(DID_ATTACK_FRIEND, 5, known, mon); else if (mons_neutral(mon)) - conduct.set(DID_ATTACK_NEUTRAL, 5, known, mon); + conduct[1].set(DID_ATTACK_NEUTRAL, 5, known, mon); if (is_unchivalric_attack(&you, mon, mon)) - conduct.set(DID_UNCHIVALRIC_ATTACK, 4, known, mon); + conduct[2].set(DID_UNCHIVALRIC_ATTACK, 4, known, mon); if (mons_is_holy(mon)) - conduct.set(DID_ATTACK_HOLY, mon->hit_dice, known, mon); + conduct[3].set(DID_ATTACK_HOLY, mon->hit_dice, known, mon); +} + +void enable_attack_conducts(god_conduct_trigger conduct[4]) +{ + for (int i = 0; i < 4; ++i) + conduct[i].enabled = true; +} + +void disable_attack_conducts(god_conduct_trigger conduct[4]) +{ + for (int i = 0; i < 4; ++i) + conduct[i].enabled = false; } static void _dock_piety(int piety_loss, int penance) |