diff options
author | Neil Moore <neil@s-z.org> | 2014-07-09 18:16:09 -0400 |
---|---|---|
committer | Neil Moore <neil@s-z.org> | 2014-07-09 18:16:09 -0400 |
commit | 9b86da9ce7491c6e62eef555ba33a8000eef343b (patch) | |
tree | 08b24e2dfea3356ef3402083c47f12782a5329aa /crawl-ref/source/religion.cc | |
parent | 8e6fa416551224a0b640fd745bd52317cf8e9e2c (diff) | |
download | crawl-ref-9b86da9ce7491c6e62eef555ba33a8000eef343b.tar.gz crawl-ref-9b86da9ce7491c6e62eef555ba33a8000eef343b.zip |
Swap two functions to avoid a forward declaration.
Diffstat (limited to 'crawl-ref/source/religion.cc')
-rw-r--r-- | crawl-ref/source/religion.cc | 91 |
1 files changed, 45 insertions, 46 deletions
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 5e397799c9..3279ee8f60 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -2346,52 +2346,6 @@ void set_piety(int piety) while (diff != 0); } -static void _gain_piety_point(); -/** - * Gain an amount of piety. - * - * @param original_gain The numerator of the nominal piety gain. - * @param denominator The denominator of the nominal piety gain. - * @param should_scale_piety Should the piety gain be scaled by faith, - * forlorn, and Sprint? - * @return True if something happened, or if another call with the same - * arguments might cause something to happen (because of random number - * rolls). - */ -bool gain_piety(int original_gain, int denominator, bool should_scale_piety) -{ - if (original_gain <= 0) - return false; - - // Xom uses piety differently; Gozag doesn't at all. - if (you_worship(GOD_NO_GOD) - || you_worship(GOD_XOM) - || you_worship(GOD_GOZAG)) - { - return false; - } - - int pgn = should_scale_piety? piety_scale(original_gain) : original_gain; - - if (crawl_state.game_is_sprint() && should_scale_piety) - pgn = sprint_modify_piety(pgn); - - pgn = div_rand_round(pgn, denominator); - while (pgn-- > 0) - _gain_piety_point(); - if (you.piety > you.piety_max[you.religion]) - { - if (you.piety >= piety_breakpoint(5) - && you.piety_max[you.religion] < piety_breakpoint(5)) - { - mark_milestone("god.maxpiety", "became the Champion of " - + god_name(you.religion) + "."); - } - you.piety_max[you.religion] = you.piety; - } - return true; -} - static void _gain_piety_point() { // check to see if we owe anything first @@ -2573,6 +2527,51 @@ static void _gain_piety_point() do_god_gift(); } +/** + * Gain an amount of piety. + * + * @param original_gain The numerator of the nominal piety gain. + * @param denominator The denominator of the nominal piety gain. + * @param should_scale_piety Should the piety gain be scaled by faith, + * forlorn, and Sprint? + * @return True if something happened, or if another call with the same + * arguments might cause something to happen (because of random number + * rolls). + */ +bool gain_piety(int original_gain, int denominator, bool should_scale_piety) +{ + if (original_gain <= 0) + return false; + + // Xom uses piety differently; Gozag doesn't at all. + if (you_worship(GOD_NO_GOD) + || you_worship(GOD_XOM) + || you_worship(GOD_GOZAG)) + { + return false; + } + + int pgn = should_scale_piety? piety_scale(original_gain) : original_gain; + + if (crawl_state.game_is_sprint() && should_scale_piety) + pgn = sprint_modify_piety(pgn); + + pgn = div_rand_round(pgn, denominator); + while (pgn-- > 0) + _gain_piety_point(); + if (you.piety > you.piety_max[you.religion]) + { + if (you.piety >= piety_breakpoint(5) + && you.piety_max[you.religion] < piety_breakpoint(5)) + { + mark_milestone("god.maxpiety", "became the Champion of " + + god_name(you.religion) + "."); + } + you.piety_max[you.religion] = you.piety; + } + return true; +} + void lose_piety(int pgn) { if (pgn <= 0) |