diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-01-10 12:13:52 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-01-10 12:13:52 +0000 |
commit | c19654b6135f04e1b846a12818319d829d704fe8 (patch) | |
tree | 08e2d9ac0c9c9face8cb3f51b6549373378797ce /crawl-ref/source/religion.cc | |
parent | ca24077fe2dc9c9f381ebbccb70c04fd143ea718 (diff) | |
download | crawl-ref-c19654b6135f04e1b846a12818319d829d704fe8.tar.gz crawl-ref-c19654b6135f04e1b846a12818319d829d704fe8.zip |
[1632207] Dropping items on an altar while praying will offer those items to
$DEITY. If it's a multidrop, only the last item will trigger the altar-offer to
avoid spammy messages. Interrupted multidrop will not do the offer, nor will the
offer happen if prayer ends before the last item is dropped.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@821 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/religion.cc')
-rw-r--r-- | crawl-ref/source/religion.cc | 56 |
1 files changed, 21 insertions, 35 deletions
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 38fd7ed69c..46574758b4 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -333,19 +333,18 @@ void pray(void) you.turn_is_over = true; if (you.religion != GOD_NO_GOD - && grd[you.x_pos][you.y_pos] == 179 + you.religion) + && grid_altar_god(grd[you.x_pos][you.y_pos]) == you.religion) { altar_prayer(); } - else if (grd[you.x_pos][you.y_pos] >= 180 - && grd[you.x_pos][you.y_pos] <= 199) + else if (grid_altar_god(grd[you.x_pos][you.y_pos]) != GOD_NO_GOD) { if (you.species == SP_DEMIGOD) { mpr("Sorry, a being of your status cannot worship here."); return; } - god_pitch(grd[you.x_pos][you.y_pos] - 179); + god_pitch( grid_altar_god(grd[you.x_pos][you.y_pos]) ); return; } @@ -2305,18 +2304,6 @@ static bool bless_weapon( int god, int brand, int colour ) void altar_prayer(void) { - int i, j, next; - char subst_id[4][50]; - char str_pass[ ITEMNAME_SIZE ]; - - for (i = 0; i < 4; i++) - { - for (j = 0; j < 50; j++) - { - subst_id[i][j] = 1; - } - } - mpr( "You kneel at the altar and pray." ); if (you.religion == GOD_XOM) @@ -2373,13 +2360,24 @@ void altar_prayer(void) bless_weapon(GOD_LUCY, SPWPN_DISTORTION, RED); } - i = igrd[you.x_pos][you.y_pos]; + offer_items(); +} // end altar_prayer() + +void offer_items() +{ + if (you.religion == GOD_NO_GOD) + return; + + char subst_id[4][50]; + memset(subst_id, 1, sizeof subst_id); + + int i = igrd[you.x_pos][you.y_pos]; while (i != NON_ITEM) { if (one_chance_in(1000)) break; - next = mitm[i].link; // in case we can't get it later. + const int next = mitm[i].link; // in case we can't get it later. const int value = item_value( mitm[i], subst_id, true ); @@ -2389,10 +2387,7 @@ void altar_prayer(void) case GOD_OKAWARU: case GOD_MAKHLEB: case GOD_NEMELEX_XOBEH: - it_name(i, DESC_CAP_THE, str_pass); - strcpy(info, str_pass); - strcat(info, sacrifice[you.religion - 1]); - mpr(info); + mprf("%s%s", it_name(i, DESC_CAP_THE), sacrifice[you.religion - 1]); #ifdef DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "Sacrifice item value: %d", value); @@ -2409,10 +2404,7 @@ void altar_prayer(void) break; case GOD_SIF_MUNA: - it_name(i, DESC_CAP_THE, str_pass); - strcpy(info, str_pass); - strcat(info, sacrifice[you.religion - 1]); - mpr(info); + mprf("%s%s", it_name(i, DESC_CAP_THE), sacrifice[you.religion - 1]); if (value >= 150) gain_piety(1 + random2(3)); @@ -2425,10 +2417,7 @@ void altar_prayer(void) if (mitm[i].base_type != OBJ_CORPSES) break; - it_name(i, DESC_CAP_THE, str_pass); - strcpy(info, str_pass); - strcat(info, sacrifice[you.religion - 1]); - mpr(info); + mprf("%s%s", it_name(i, DESC_CAP_THE), sacrifice[you.religion - 1]); gain_piety(1); destroy_item(i); @@ -2441,10 +2430,7 @@ void altar_prayer(void) break; } - it_name(i, DESC_CAP_THE, str_pass); - strcpy(info, str_pass); - strcat(info, sacrifice[you.religion - 1]); - mpr(info); + mprf("%s%s", it_name(i, DESC_CAP_THE), sacrifice[you.religion - 1]); if (random2(value) >= random2(50) || (mitm[i].base_type == OBJ_WEAPONS @@ -2462,7 +2448,7 @@ void altar_prayer(void) i = next; } -} // end altar_prayer() +} void god_pitch(unsigned char which_god) { |