summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-30 12:25:35 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-30 12:25:35 +0000
commitcbd9791cd0bd50b017312d12d8110580b90873ec (patch)
tree1ba88ee570d82d8112ae00b99947680ffc85198c
parent67ff47f25420cc6e8cccd2a4f02f1810eb4fe141 (diff)
downloadcrawl-ref-cbd9791cd0bd50b017312d12d8110580b90873ec.tar.gz
crawl-ref-cbd9791cd0bd50b017312d12d8110580b90873ec.zip
Running now respects travel_delay.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1698 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/delay.cc5
-rw-r--r--crawl-ref/source/spl-cast.cc80
-rw-r--r--crawl-ref/source/spl-cast.h3
-rw-r--r--crawl-ref/source/stuff.cc10
-rw-r--r--crawl-ref/source/view.cc12
5 files changed, 53 insertions, 57 deletions
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index a472861856..b2e72c287f 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -796,6 +796,11 @@ static command_type get_running_command()
}
return CMD_MOVE_NOWHERE;
}
+ else if (Options.travel_delay > 0)
+ {
+ delay(Options.travel_delay);
+ }
+
return direction_to_command( you.running.x, you.running.y );
}
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index cf0fdeadb3..a80124ebc5 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -682,7 +682,7 @@ bool spell_is_unholy( spell_type spell_id )
return (testbits( get_spell_flags( spell_id ), SPFLAG_UNHOLY ));
}
-void spellcasting_side_effects(spell_type spc2, bool idonly = false)
+void spellcasting_side_effects(spell_type spell, bool idonly = false)
{
int total_skill = 0;
@@ -697,47 +697,47 @@ void spellcasting_side_effects(spell_type spc2, bool idonly = false)
total_skill = you.skills[SK_SPELLCASTING];
break;
case STAFF_FIRE:
- if (spell_typematch(spc2, SPTYP_FIRE))
+ if (spell_typematch(spell, SPTYP_FIRE))
total_skill = you.skills[SK_FIRE_MAGIC];
- else if (spell_typematch(spc2, SPTYP_ICE))
+ else if (spell_typematch(spell, SPTYP_ICE))
total_skill = you.skills[SK_ICE_MAGIC];
break;
case STAFF_COLD:
- if (spell_typematch(spc2, SPTYP_ICE))
+ if (spell_typematch(spell, SPTYP_ICE))
total_skill = you.skills[SK_ICE_MAGIC];
- else if (spell_typematch(spc2, SPTYP_FIRE))
+ else if (spell_typematch(spell, SPTYP_FIRE))
total_skill = you.skills[SK_FIRE_MAGIC];
break;
case STAFF_AIR:
- if (spell_typematch(spc2, SPTYP_AIR))
+ if (spell_typematch(spell, SPTYP_AIR))
total_skill = you.skills[SK_AIR_MAGIC];
- else if (spell_typematch(spc2, SPTYP_EARTH))
+ else if (spell_typematch(spell, SPTYP_EARTH))
total_skill = you.skills[SK_EARTH_MAGIC];
break;
case STAFF_EARTH:
- if (spell_typematch(spc2, SPTYP_EARTH))
+ if (spell_typematch(spell, SPTYP_EARTH))
total_skill = you.skills[SK_EARTH_MAGIC];
- else if (spell_typematch(spc2, SPTYP_AIR))
+ else if (spell_typematch(spell, SPTYP_AIR))
total_skill = you.skills[SK_AIR_MAGIC];
break;
case STAFF_POISON:
- if (spell_typematch(spc2, SPTYP_POISON))
+ if (spell_typematch(spell, SPTYP_POISON))
total_skill = you.skills[SK_POISON_MAGIC];
break;
case STAFF_DEATH:
- if (spell_typematch(spc2, SPTYP_NECROMANCY))
+ if (spell_typematch(spell, SPTYP_NECROMANCY))
total_skill = you.skills[SK_NECROMANCY];
break;
case STAFF_CONJURATION:
- if (spell_typematch(spc2, SPTYP_CONJURATION))
+ if (spell_typematch(spell, SPTYP_CONJURATION))
total_skill = you.skills[SK_CONJURATIONS];
break;
case STAFF_ENCHANTMENT:
- if (spell_typematch(spc2, SPTYP_ENCHANTMENT))
+ if (spell_typematch(spell, SPTYP_ENCHANTMENT))
total_skill = you.skills[SK_ENCHANTMENTS];
break;
case STAFF_SUMMONING:
- if (spell_typematch(spc2, SPTYP_SUMMONING))
+ if (spell_typematch(spell, SPTYP_SUMMONING))
total_skill = you.skills[SK_SUMMONINGS];
break;
}
@@ -760,22 +760,22 @@ void spellcasting_side_effects(spell_type spc2, bool idonly = false)
if (idonly)
return;
- if (!spell_is_utility_spell(spc2))
- did_god_conduct( DID_SPELL_NONUTILITY, 10 + spell_difficulty(spc2) );
+ if (!spell_is_utility_spell(spell))
+ did_god_conduct( DID_SPELL_NONUTILITY, 10 + spell_difficulty(spell) );
- if (spell_is_unholy( spc2 ))
- did_god_conduct( DID_UNHOLY, 10 + spell_difficulty(spc2) );
+ if (spell_is_unholy( spell ))
+ did_god_conduct( DID_UNHOLY, 10 + spell_difficulty(spell) );
// Linley says: Condensation Shield needs some disadvantages to keep
// it from being a no-brainer... this isn't much, but its a start -- bwr
- if (spell_typematch(spc2, SPTYP_FIRE))
+ if (spell_typematch(spell, SPTYP_FIRE))
expose_player_to_element(BEAM_FIRE, 0);
- if (spell_typematch( spc2, SPTYP_NECROMANCY ))
+ if (spell_typematch( spell, SPTYP_NECROMANCY ))
{
- did_god_conduct( DID_NECROMANCY, 10 + spell_difficulty(spc2) );
+ did_god_conduct( DID_NECROMANCY, 10 + spell_difficulty(spell) );
- if (spc2 == SPELL_NECROMUTATION
+ if (spell == SPELL_NECROMUTATION
&& (you.religion == GOD_ELYVILON
|| you.religion == GOD_SHINING_ONE
|| you.religion == GOD_ZIN))
@@ -817,7 +817,7 @@ static bool spell_is_uncastable(spell_type spell)
// returns SPRET_SUCCESS if spell is successfully cast for purposes of
// exercising, SPRET_FAIL otherwise, or SPRET_ABORT if the player canceled
// the casting.
-spret_type your_spells( spell_type spc2, int powc, bool allow_fail )
+spret_type your_spells( spell_type spell, int powc, bool allow_fail )
{
struct dist spd;
struct bolt beam;
@@ -825,10 +825,10 @@ spret_type your_spells( spell_type spc2, int powc, bool allow_fail )
// [dshaligram] Any action that depends on the spellcasting attempt to have
// succeeded must be performed after the switch()
- if (spell_is_uncastable(spc2))
+ if (spell_is_uncastable(spell))
return (SPRET_ABORT);
- const int flags = get_spell_flags(spc2);
+ const int flags = get_spell_flags(spell);
// XXX: This handles only some of the cases where spells need targeting...
// there are others that do their own that will be missed by this
@@ -843,7 +843,7 @@ spret_type your_spells( spell_type spc2, int powc, bool allow_fail )
testbits( flags, SPFLAG_GRID ) ? DIR_TARGET :
testbits( flags, SPFLAG_DIR ) ? DIR_DIR : DIR_NONE);
- const char *prompt = get_spell_target_prompt(spc2);
+ const char *prompt = get_spell_target_prompt(spell);
if (dir == DIR_DIR)
mpr(prompt? prompt : "Which direction? ", MSGCH_PROMPT);
@@ -852,8 +852,8 @@ spret_type your_spells( spell_type spc2, int powc, bool allow_fail )
if (testbits( flags, SPFLAG_NOT_SELF ) && spd.isMe)
{
- if (spc2 == SPELL_TELEPORT_OTHER || spc2 == SPELL_HEAL_OTHER
- || spc2 == SPELL_POLYMORPH_OTHER)
+ if (spell == SPELL_TELEPORT_OTHER || spell == SPELL_HEAL_OTHER
+ || spell == SPELL_POLYMORPH_OTHER)
{
mpr( "Sorry, this spell works on others only." );
}
@@ -868,9 +868,9 @@ spret_type your_spells( spell_type spc2, int powc, bool allow_fail )
// Added this so that the passed in powc can have meaning -- bwr
if (powc == 0)
- powc = calc_spell_power( spc2, true );
+ powc = calc_spell_power( spell, true );
- surge_power(spc2);
+ surge_power(spell);
if (allow_fail)
{
@@ -890,9 +890,9 @@ spret_type your_spells( spell_type spc2, int powc, bool allow_fail )
dec_penance(GOD_SIF_MUNA, 1);
}
- if (spfl < spell_fail(spc2))
+ if (spfl < spell_fail(spell))
{
- spellcasting_side_effects(spc2, true);
+ spellcasting_side_effects(spell, true);
mpr( "You miscast the spell." );
flush_input_buffer( FLUSH_ON_FAILURE );
@@ -910,32 +910,32 @@ spret_type your_spells( spell_type spc2, int powc, bool allow_fail )
do
{
sptype = 1 << (random2(SPTYP_LAST_EXPONENT+1));
- } while (!spell_typematch(spc2, sptype));
+ } while (!spell_typematch(spell, sptype));
// all spell failures give a bit of magical radiation..
// failure is a function of power squared multiplied
// by how badly you missed the spell. High power
// spells can be quite nasty: 9 * 9 * 90 / 500 = 15
// points of contamination!
- int nastiness = spell_mana(spc2) * spell_mana(spc2)
- * (spell_fail(spc2) - spfl) + 250;
+ int nastiness = spell_mana(spell) * spell_mana(spell)
+ * (spell_fail(spell) - spfl) + 250;
const int cont_points = div_rand_round(nastiness, 500);
contaminate_player( cont_points );
- miscast_effect( sptype, spell_mana(spc2),
- spell_fail(spc2) - spfl, 100 );
+ miscast_effect( sptype, spell_mana(spell),
+ spell_fail(spell) - spfl, 100 );
return (SPRET_FAIL);
}
}
#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Spell #%d, power=%d", spc2, powc );
+ mprf(MSGCH_DIAGNOSTICS, "Spell #%d, power=%d", spell, powc );
#endif
- switch (spc2)
+ switch (spell)
{
case SPELL_IDENTIFY:
identify(powc);
@@ -1823,7 +1823,7 @@ spret_type your_spells( spell_type spc2, int powc, bool allow_fail )
break;
} // end switch
- spellcasting_side_effects(spc2);
+ spellcasting_side_effects(spell);
return (SPRET_SUCCESS);
} // end you_spells()
diff --git a/crawl-ref/source/spl-cast.h b/crawl-ref/source/spl-cast.h
index 650a221f27..488ef1b669 100644
--- a/crawl-ref/source/spl-cast.h
+++ b/crawl-ref/source/spl-cast.h
@@ -42,7 +42,8 @@ void inspect_spells();
/* ***********************************************************************
* called from: ability - debug - it_use3 - spell
* *********************************************************************** */
-spret_type your_spells( spell_type spc2, int powc = 0, bool allow_fail = true );
+spret_type your_spells( spell_type spell, int powc = 0,
+ bool allow_fail = true );
// last updated 12may2000 {dlb}
/* ***********************************************************************
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index b28e57ef03..f7cd439ae1 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -591,8 +591,6 @@ void canned_msg(canned_message_type which_message)
bool yesno( const char *str, bool safe, int safeanswer, bool clear_after,
bool interrupt_delays, bool noprompt )
{
- int tmp;
-
if (interrupt_delays)
interrupt_activity( AI_FORCE_INTERRUPT );
for (;;)
@@ -600,7 +598,7 @@ bool yesno( const char *str, bool safe, int safeanswer, bool clear_after,
if ( !noprompt )
mpr(str, MSGCH_PROMPT);
- tmp = getch();
+ int tmp = getch();
if ((tmp == ' ' || tmp == 27 || tmp == '\r' || tmp == '\n')
&& safeanswer)
@@ -628,16 +626,14 @@ bool yesno( const char *str, bool safe, int safeanswer, bool clear_after,
// like yesno(), but returns 0 for no, 1 for yes, and -1 for quit
int yesnoquit( const char* str, bool safe, int safeanswer, bool clear_after )
{
- unsigned char tmp;
-
interrupt_activity( AI_FORCE_INTERRUPT );
while (1)
{
mpr(str, MSGCH_PROMPT);
- tmp = (unsigned char) getch();
+ int tmp = getch();
- if ( tmp == 27 || tmp == 'q' || tmp == 'Q' )
+ if ( tmp == ESCAPE || tmp == 'q' || tmp == 'Q' )
return -1;
if ((tmp == ' ' || tmp == '\r' || tmp == '\n') && safeanswer)
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index a0096622fb..4ea107e343 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -3901,14 +3901,8 @@ void viewwindow(bool draw_it, bool do_updates)
losight( env.show, grd, you.x_pos, you.y_pos ); // must be done first
- for (count_x = 0; count_x < ENV_SHOW_DIAMETER; count_x++)
- {
- for (count_y = 0; count_y < ENV_SHOW_DIAMETER; count_y++)
- {
- env.show_col[count_x][count_y] = LIGHTGREY;
- Show_Backup[count_x][count_y] = 0;
- }
- }
+ env.show_col.init(LIGHTGREY);
+ Show_Backup.init(0);
item_grid(); // must be done before cloud and monster
cloud_grid();
@@ -4089,7 +4083,7 @@ void viewwindow(bool draw_it, bool do_updates)
you.flash_colour = BLACK;
// avoiding unneeded draws when running
- if (!you.running || (you.running < 0 && Options.travel_delay > -1))
+ if (!you.running || (Options.travel_delay > -1))
{
bufcount = 0;
for (count_y = 0; count_y < crawl_view.viewsz.y; count_y++)