summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-02 21:46:56 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-02 21:46:56 +0000
commitc0c613a08e2c4353475b6dd14f5aa934b364a38d (patch)
tree61bef1064546f3833b9361ada39307be5b199f3d /crawl-ref
parent6dc97e95453230d0f5ea8d72feee98c561f078cc (diff)
downloadcrawl-ref-c0c613a08e2c4353475b6dd14f5aa934b364a38d.tar.gz
crawl-ref-c0c613a08e2c4353475b6dd14f5aa934b364a38d.zip
Fix a recent bug of mine that blocked the friendly fire prompts.
Fix 1943573: Weird message order when attacking charmed monsters. Fix 1826896: NOTE_ID could have line breaks in mid-word Modify the "This feature has more information" hint to mention mouseclicking for Tiles players rather than 'v' like for purists. Oh, and when trying to look into BR 1952908 (buggy trap in the Abyss) I found that traps can be generated in the Abyss after all. I don't know when that was changed but the last time I checked I remember seeing something like "if (level == ABYSS) return false" in a "Can there be traps here?" check. Is my memory playing tricks on me or was that really changed, and if so, was it intentional? git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5445 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/acr.cc2
-rw-r--r--crawl-ref/source/beam.cc58
-rw-r--r--crawl-ref/source/chardump.cc8
-rw-r--r--crawl-ref/source/directn.cc18
-rw-r--r--crawl-ref/source/misc.cc2
-rw-r--r--crawl-ref/source/notes.cc4
-rw-r--r--crawl-ref/source/spells4.cc4
-rw-r--r--crawl-ref/source/spl-util.cc2
-rw-r--r--crawl-ref/source/traps.cc29
9 files changed, 69 insertions, 58 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 612f125951..5b62dabf80 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -1364,7 +1364,7 @@ static void _input()
Options.tut_just_triggered = false;
// He, we don't want those "Whew, it's safe to rest now" messages when
- // you were just cast into the abyss. Right?
+ // you were just cast into the Abyss. Right?
if (i_feel_safe() && you.level_type != LEVEL_ABYSS)
{
if (Options.tutorial_left)
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 25cc0aeee5..6322adc2ec 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -233,7 +233,6 @@ static void _beam_set_default_values(bolt &beam, int power)
// If needs_tracer is true, we need to check the beam path for friendly
// monsters for *player beams* only! If allies are found, the player is
// prompted to stop or continue.
-// NOTE: Doesn't check for the player being hit by a rebounding lightning bolt.
bool zapping(zap_type ztype, int power, bolt &pbolt, bool needs_tracer,
std::string msg)
{
@@ -661,6 +660,7 @@ static void _get_max_range( zap_type z_type, int power, bolt &pbolt )
// Returns true if the path is considered "safe", and false if there are
// monsters in the way the player doesn't want to hit.
+// NOTE: Doesn't check for the player being hit by a rebounding lightning bolt.
bool player_tracer( zap_type ztype, int power, bolt &pbolt, int range)
{
// Non-controlleable during confusion.
@@ -668,12 +668,6 @@ bool player_tracer( zap_type ztype, int power, bolt &pbolt, int range)
if (you.duration[DUR_CONF])
return (true);
- // If you target yourself, that's always deliberate.
- // This is basically pbolt.aimed_at_feet except that that hasn't been
- // initialized yet.
- if (pbolt.target_x == you.x_pos && pbolt.target_y == you.y_pos);
- return (true);
-
_beam_set_default_values(pbolt, power);
pbolt.name = "unimportant";
_get_max_range(ztype, power, pbolt);
@@ -2053,9 +2047,9 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item )
int mons_adjust_flavoured( monsters *monster, bolt &pbolt,
int hurted, bool doFlavouredEffects )
{
- // if we're not doing flavored effects, must be preliminary
- // damage check only; do not print messages or apply any side
- // effects!
+ // If we're not doing flavored effects, must be preliminary
+ // damage check only.
+ // Do not print messages or apply any side effects!
int resist = 0;
int original = hurted;
@@ -2355,7 +2349,7 @@ static bool _monster_resists_mass_enchantment(monsters *monster,
enchant_type wh_enchant,
int pow)
{
- // assuming that the only mass charm is control undead:
+ // Assuming that the only mass charm is control undead.
if (wh_enchant == ENCH_CHARM)
{
if (mons_friendly(monster))
@@ -4428,17 +4422,17 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item)
{
if (beam.thrower == KILL_YOU_MISSILE)
{
- if (!_beam_is_harmless(beam, mon))
- {
- const bool target = (beam.target_x == mon->x
- && beam.target_y == mon->y);
+ if (!_beam_is_harmless(beam, mon))
+ {
+ const bool target = (beam.target_x == mon->x
+ && beam.target_y == mon->y);
- if (stop_attack_prompt(mon, true, target))
- {
- beam.fr_count = 1;
- return (BEAM_STOP);
- }
+ if (stop_attack_prompt(mon, true, target))
+ {
+ beam.fr_count = 1;
+ return (BEAM_STOP);
}
+ }
}
// Check only if actual damage.
else if (hurt_final > 0)
@@ -4486,7 +4480,7 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item)
{
const bool okay =
(beam.aux_source == "reading a scroll of immolation"
- && !beam.effect_known);
+ && !beam.effect_known);
if (is_sanctuary(mon->x, mon->y)
|| is_sanctuary(you.x_pos, you.y_pos))
@@ -4504,14 +4498,9 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item)
{
hit_woke_orc = true;
}
-
- // Don't annoy friendlies or good neutrals if the player's beam
- // did no damage. Hostiles will still take umbrage.
- if (hurt_final > 0 || !mons_wont_attack(mon) || !YOU_KILL(beam.thrower))
- behaviour_event(mon, ME_ANNOY, _beam_source(beam));
}
- // explosions always 'hit'
+ // Explosions always 'hit'.
const bool engulfs = (beam.is_explosion || beam.is_big_cloud);
int beam_hit = beam.hit;
@@ -4603,7 +4592,7 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item)
bleed_onto_floor(mon->x, mon->y, mon->type, blood, true);
}
- // now hurt monster
+ // Now hurt monster.
hurt_monster( mon, hurt_final );
if (mon->hit_points < 1)
@@ -4618,6 +4607,11 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item)
print_wounds(mons);
}
+ // Don't annoy friendlies or good neutrals if the player's beam
+ // did no damage. Hostiles will still take umbrage.
+ if (hurt_final > 0 || !mons_wont_attack(mon) || !YOU_KILL(beam.thrower))
+ behaviour_event(mon, ME_ANNOY, _beam_source(beam));
+
// sticky flame
if (beam.name == "sticky flame")
{
@@ -4628,7 +4622,7 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item)
_sticky_flame_monster( tid, _whose_kill(beam), levels );
}
- /* Look for missiles which aren't poison but are poison*ed*. */
+ // Handle missile effects.
if (item)
{
if (item->base_type == OBJ_MISSILES
@@ -4647,7 +4641,7 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item)
}
int num_success = 0;
- if ( YOU_KILL(beam.thrower) )
+ if (YOU_KILL(beam.thrower))
{
const int skill_level = _name_to_skill_level(beam.name);
if ( skill_level + 25 > random2(50) )
@@ -4841,13 +4835,13 @@ static int _affect_monster_enchantment(bolt &beam, monsters *mon)
simple_monster_message(mon, " is enslaved.");
- // wow, permanent enslaving
+ // Wow, permanent enslaving!
if (one_chance_in(2 + mon->hit_dice / 4))
mon->attitude = ATT_FRIENDLY;
else
mon->add_ench(ENCH_CHARM);
- // break fleeing and suchlike
+ // Break fleeing and suchlike.
mon->behaviour = BEH_SEEK;
return (MON_AFFECTED);
}
diff --git a/crawl-ref/source/chardump.cc b/crawl-ref/source/chardump.cc
index 22198eef94..fd54f88a5b 100644
--- a/crawl-ref/source/chardump.cc
+++ b/crawl-ref/source/chardump.cc
@@ -1240,13 +1240,15 @@ void display_notes()
if (spaceleft <= 0)
return;
- linebreak_string(suffix, spaceleft - 4, spaceleft);
+ // Use smarter linebreak function.
+ // was: linebreak_string(suffix, spaceleft - 4, spaceleft);
+ linebreak_string2(suffix, spaceleft);
std::vector<std::string> parts = split_string("\n", suffix);
- if (parts.empty()) // disregard pure-whitespace notes
+ if (parts.empty()) // Disregard pure-whitespace notes.
continue;
scr.add_entry(new MenuEntry(prefix + parts[0]));
- for ( unsigned int j = 1; j < parts.size(); ++j )
+ for (unsigned int j = 1; j < parts.size(); ++j)
{
scr.add_entry(new MenuEntry(std::string(prefix.length()-2, ' ') +
std::string("| ") + parts[j]));
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 1cb11e4303..23ce7b0b1a 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -2320,7 +2320,12 @@ static void describe_cell(int mx, int my)
#endif
if (Options.tutorial_left && tutorial_monster_interesting(&menv[i]))
{
- std::string msg = "(Press <w>v<lightgray> for more information.)";
+ std::string msg;
+#ifdef USE_TILE
+ msg = "(Right-click for more information.)";
+#else
+ msg = "(Press <w>v<lightgray> for more information.)";
+#endif
print_formatted_paragraph(msg, get_number_of_cols());
}
}
@@ -2397,8 +2402,11 @@ static void describe_cell(int mx, int my)
#else
if (Options.tutorial_left && tutorial_pos_interesting(mx, my))
{
+#ifdef USE_TILE
+ feature_desc += " (Right-click for more information.)";
+#else
feature_desc += " (Press <w>v<lightgray> for more information.)";
-
+#endif
print_formatted_paragraph(feature_desc, get_number_of_cols());
}
else
@@ -2406,7 +2414,13 @@ static void describe_cell(int mx, int my)
const dungeon_feature_type feat = grd[mx][my];
if (interesting_feature(feat))
+ {
+#ifdef USE_TILE
+ feature_desc += " (Right-click for more information.)";
+#else
feature_desc += " (Press 'v' for more information.)";
+#endif
+ }
// Suppress "Floor." if there's something on that square that we've
// already described.
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index ddd1a0c1cb..32f378197e 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -2125,7 +2125,7 @@ void down_stairs( int old_level, dungeon_feature_type force_stair,
&& you.duration[DUR_CONF]
&& !grid_is_escape_hatch(stair_find)
&& force_stair != DNGN_ENTER_ABYSS
- /*&& random2(100) > you.dex*/)
+ && random2(100) > you.dex)
{
std::string fall_where = "down the stairs";
diff --git a/crawl-ref/source/notes.cc b/crawl-ref/source/notes.cc
index 9191fbb7ae..40bee46258 100644
--- a/crawl-ref/source/notes.cc
+++ b/crawl-ref/source/notes.cc
@@ -449,7 +449,7 @@ void save_notes(writer& outf)
{
marshallLong( outf, NOTES_VERSION_NUMBER );
marshallLong( outf, note_list.size() );
- for ( unsigned i = 0; i < note_list.size(); ++i )
+ for (unsigned i = 0; i < note_list.size(); ++i)
note_list[i].save(outf);
}
@@ -472,7 +472,7 @@ void make_user_note()
mpr("Enter note: ", MSGCH_PROMPT);
char buf[400];
bool validline = !cancelable_get_line(buf, sizeof(buf));
- if ( !validline || (!*buf) )
+ if (!validline || (!*buf))
return;
Note unote(NOTE_USER_NOTE);
unote.name = buf;
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 845701cf45..7864c322d3 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -2222,11 +2222,11 @@ void cast_fragmentation(int pow) // jmf: ripped idea from airstrike
if (trap != -1
&& trap_category( env.trap[trap].type ) != DNGN_TRAP_MECHANICAL)
{
- // non-mechanical traps don't explode with this spell -- bwr
+ // Non-mechanical traps don't explode with this spell. -- bwr
break;
}
- // undiscovered traps appear as exploding from the floor -- bwr
+ // Undiscovered traps appear as exploding from the floor. -- bwr
what = ((grid == DNGN_UNDISCOVERED_TRAP) ? "floor" : "trap");
explode = true;
diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc
index 6e0496a643..5d7997d7c5 100644
--- a/crawl-ref/source/spl-util.cc
+++ b/crawl-ref/source/spl-util.cc
@@ -764,7 +764,7 @@ bool spell_direction( dist &spelld, bolt &pbolt,
if (!spelld.isValid)
{
- // check for user cancel
+ // Check for user cancel.
canned_msg(MSG_OK);
return (false);
}
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index 05a9301273..a12d2a8bfe 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -44,9 +44,9 @@
static void dart_trap(bool trap_known, int trapped, bolt &pbolt, bool poison);
-// returns the number of a net on a given square
-// if trapped only stationary ones are counted
-// otherwise the first net found is returned
+// Returns the number of a net on a given square.
+// If trapped only stationary ones are counted
+// otherwise the first net found is returned.
int get_trapping_net(int x, int y, bool trapped)
{
int net, next;
@@ -65,7 +65,7 @@ int get_trapping_net(int x, int y, bool trapped)
return (NON_ITEM);
}
-// if there are more than one net on this square
+// If there are more than one net on this square
// split off one of them for checking/setting values.
static void maybe_split_nets(item_def &item, int x, int y)
{
@@ -554,12 +554,12 @@ void disarm_trap( struct dist &disa )
if (env.trap[i].type == TRAP_NET)
trap_item( OBJ_MISSILES, MI_THROWING_NET, beam.target_x, beam.target_y );
else if (env.trap[i].type != TRAP_BLADE
- && trap_category(env.trap[i].type) == DNGN_TRAP_MECHANICAL)
+ && trap_category(env.trap[i].type) == DNGN_TRAP_MECHANICAL)
{
const int num_to_make = 10 + random2(you.skills[SK_TRAPS_DOORS]);
for (j = 0; j < num_to_make; j++)
{
- // places items (eg darts), which will automatically stack
+ // Places items (eg darts), which will automatically stack.
itrap(beam, i);
}
}
@@ -568,11 +568,12 @@ void disarm_trap( struct dist &disa )
env.trap[i].type = TRAP_UNASSIGNED;
you.turn_is_over = true;
- // reduced from 5 + random2(5)
+ // Reduced from 5 + random2(5).
exercise(SK_TRAPS_DOORS, 1 + random2(5) + (you.your_level / 5));
-} // end disarm_trap()
+}
-// attempts to take a net off a given monster
+// Attempts to take a net off a given monster.
+// This doesn't actually have any effect (yet).
// Do not expect gratitude for this!
// ----------------------------------
void remove_net_from(monsters *mon)
@@ -639,10 +640,10 @@ void remove_net_from(monsters *mon)
}
-// decides whether you will try to tear the net (result <= 0)
-// or try to slip out of it (result > 0)
-// both damage and escape could be 9 (more likely for damage)
-// but are capped at 5 (damage) and 4 (escape)
+// Decides whether you will try to tear the net (result <= 0)
+// or try to slip out of it (result > 0).
+// Both damage and escape could be 9 (more likely for damage)
+// but are capped at 5 (damage) and 4 (escape).
static int damage_or_escape_net(int hold)
{
// Spriggan: little (+2)
@@ -945,7 +946,7 @@ int trap_at_xy(int which_x, int which_y)
trap_type trap_type_at_xy(int x, int y)
{
const int idx = trap_at_xy(x, y);
- return (idx == -1? NUM_TRAPS : env.trap[idx].type);
+ return (idx == -1 ? NUM_TRAPS : env.trap[idx].type);
}
bool is_valid_shaft_level(const level_id &place)