diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-11 11:30:01 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-11 11:30:01 +0000 |
commit | 4d2b55d169177a29e95c90747667578420823078 (patch) | |
tree | 5cac1082a2ed6a610fb68a8b0ef97e668792b515 /crawl-ref | |
parent | 7896dbd29bda379c2fb31feeb3b16bda57039c00 (diff) | |
download | crawl-ref-4d2b55d169177a29e95c90747667578420823078.tar.gz crawl-ref-4d2b55d169177a29e95c90747667578420823078.zip |
A number of whitespace changes. Linux makes this soooo easy. :P
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4196 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/direct.cc | 118 | ||||
-rw-r--r-- | crawl-ref/source/externs.h | 114 | ||||
-rw-r--r-- | crawl-ref/source/initfile.cc | 106 | ||||
-rw-r--r-- | crawl-ref/source/item_use.cc | 154 | ||||
-rw-r--r-- | crawl-ref/source/libgui.cc | 99 | ||||
-rw-r--r-- | crawl-ref/source/luadgn.cc | 38 | ||||
-rw-r--r-- | crawl-ref/source/spl-book.cc | 38 | ||||
-rw-r--r-- | crawl-ref/source/terrain.cc | 23 |
8 files changed, 343 insertions, 347 deletions
diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index ac34d64f0a..0ad13a4b28 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -89,14 +89,14 @@ static bool find_object( int x, int y, int mode, int range ); static bool find_monster( int x, int y, int mode, int range ); static bool find_feature( int x, int y, int mode, int range ); -static char find_square_wrapper( int tx, int ty, +static char find_square_wrapper( int tx, int ty, FixedVector<char, 2> &mfp, char direction, bool (*targ)(int, int, int, int), int mode = TARG_ANY, int range = -1, bool wrap = false, int los = LOS_ANY); -static char find_square( int xps, int yps, +static char find_square( int xps, int yps, FixedVector<char, 2> &mfp, int direction, bool (*targ)(int, int, int, int), int mode = TARG_ANY, int range = -1, @@ -131,7 +131,7 @@ void direction_choose_compass( dist& moves, targeting_behaviour *beh) moves.isMe = true; break; } - + const int i = targeting_cmd_to_compass(key_command); if ( i != -1 ) { @@ -145,7 +145,7 @@ void direction_choose_compass( dist& moves, targeting_behaviour *beh) } } while ( !moves.isCancel && moves.dx == 0 && moves.dy == 0 ); - + return; } @@ -251,7 +251,7 @@ static bool _is_target_in_range(int x, int y, int range) // range doesn't matter if (range == -1) return true; - + return (grid_distance(you.x_pos, you.y_pos, x, y) <= range); } @@ -345,7 +345,7 @@ static void direction_again(dist& moves, targeting_type restricts, "range."); return; } - + moves.tx = you.prev_grd_targ.x; moves.ty = you.prev_grd_targ.y; @@ -367,7 +367,7 @@ static void direction_again(dist& moves, targeting_type restricts, else { const monsters *montarget = &menv[you.prev_targ]; - + if (!mons_near(montarget) || !player_monster_visible( montarget )) { @@ -450,7 +450,7 @@ void direction(dist& moves, targeting_type restricts, } cursor_control con(!Options.use_fake_cursor); - + int dir = 0; bool show_beam = Options.show_beam && !just_looking && needs_path; ray_def ray; @@ -538,8 +538,8 @@ void direction(dist& moves, targeting_type restricts, #ifdef USE_TILE // if a mouse command, update location to mouse position... - if ( key_command == CMD_TARGET_MOUSE_MOVE || - key_command == CMD_TARGET_MOUSE_SELECT ) + if ( key_command == CMD_TARGET_MOUSE_MOVE + || key_command == CMD_TARGET_MOUSE_SELECT ) { coord_def gc; if (gui_get_mouse_grid_pos(gc)) @@ -547,10 +547,8 @@ void direction(dist& moves, targeting_type restricts, moves.tx = gc.x; moves.ty = gc.y; - if ( key_command == CMD_TARGET_MOUSE_SELECT ) - { + if (key_command == CMD_TARGET_MOUSE_SELECT) key_command = CMD_TARGET_SELECT; - } } else { @@ -564,7 +562,7 @@ void direction(dist& moves, targeting_type restricts, { key_command = shift_direction(key_command); } - + if (target_unshifted && (key_command == CMD_TARGET_CYCLE_FORWARD || key_command == CMD_TARGET_CYCLE_BACK @@ -655,7 +653,7 @@ void direction(dist& moves, targeting_type restricts, need_beam_redraw = true; break; #endif - + case CMD_TARGET_HIDE_BEAM: if (show_beam) { @@ -670,13 +668,13 @@ void direction(dist& moves, targeting_type restricts, "This spell doesn't need a beam path."); break; } - + show_beam = find_ray(you.x_pos, you.y_pos, moves.tx, moves.ty, true, ray, 0, true); need_beam_redraw = show_beam; } break; - + case CMD_TARGET_FIND_YOU: moves.tx = you.x_pos; moves.ty = you.y_pos; @@ -714,7 +712,7 @@ void direction(dist& moves, targeting_type restricts, (mode == TARG_ENEMY) ? "enemies" : "friends" ); break; - + case CMD_TARGET_PREV_TARGET: // Do we have a previous target? if (you.prev_targ == MHITNOT || you.prev_targ == MHITYOU) @@ -726,7 +724,7 @@ void direction(dist& moves, targeting_type restricts, // we have a valid previous target (maybe) { const monsters *montarget = &menv[you.prev_targ]; - + if (!mons_near(montarget) || !player_monster_visible( montarget )) { @@ -764,7 +762,7 @@ void direction(dist& moves, targeting_type restricts, loop_done = true; you.prev_grd_targ = coord_def(0, 0); - + // maybe we should except just_looking here? mid = mgrd[moves.tx][moves.ty]; @@ -794,11 +792,11 @@ void direction(dist& moves, targeting_type restricts, flush_input_buffer(FLUSH_ON_FAILURE); } break; - + case CMD_TARGET_CYCLE_FORWARD: case CMD_TARGET_CYCLE_BACK: dir = (key_command == CMD_TARGET_CYCLE_BACK) ? -1 : 1; - if (find_square_wrapper( moves.tx, moves.ty, monsfind_pos, dir, + if (find_square_wrapper( moves.tx, moves.ty, monsfind_pos, dir, find_monster, mode, range, Options.target_wrap)) { @@ -875,7 +873,7 @@ void direction(dist& moves, targeting_type restricts, wizard_give_monster_item(&menv[mid]); break; #endif - + case CMD_TARGET_DESCRIBE: full_describe_square(moves.target()); force_redraw = true; @@ -888,11 +886,11 @@ void direction(dist& moves, targeting_type restricts, mesclr(true); show_prompt = true; break; - + default: break; } - + if ( loop_done == true ) { // This is where we either finalize everything, or else @@ -952,7 +950,7 @@ void direction(dist& moves, targeting_type restricts, if ( force_redraw ) have_moved = true; - + if ( have_moved ) { // If the target x,y has changed, the beam must have changed. @@ -1088,7 +1086,7 @@ static void extend_move_to_edge(dist &moves) static void describe_oos_square(int x, int y) { mpr("You can't see that place.", MSGCH_EXAMINE_FILTER); - + if (!in_bounds(x, y) || !is_terrain_seen(x, y)) return; @@ -1148,14 +1146,14 @@ static bool find_monster( int x, int y, int mode, int range = -1) { return (false); } - + // Now compare target modes. if (mode == TARG_ANY) return true; - + if (mode == TARG_FRIEND) return (mons_friendly(&menv[targ_mon] )); - + ASSERT(mode == TARG_ENEMY); if (mons_friendly(&menv[targ_mon])) return false; @@ -1186,11 +1184,11 @@ static bool find_object(int x, int y, int mode, int /* range */) { is_mimic = true; } - + const int item = igrd[x][y]; if (item == NON_ITEM && !is_mimic) return false; - + return (in_los(x, y) || Options.target_oos && is_terrain_seen(x, y) && (is_stash(x, y) || is_mimic)); } @@ -1218,9 +1216,9 @@ static int next_los(int dir, int los, bool wrap) // // * Say the cursor is on the last item in LOS, there are no // items outside LOS, and wrap == true. flipvh is true. - // * We set wrap false and flip from visible to hidden, but there + // * We set wrap false and flip from visible to hidden, but there // are no hidden items. So now we need to flip back to visible - // so we can go back to the first item in LOS. Unless we set + // so we can go back to the first item in LOS. Unless we set // fliphv, we can't flip from hidden to visible. // los = flipvh? LOS_FLIPHV : LOS_FLIPVH; @@ -1229,7 +1227,7 @@ static int next_los(int dir, int los, bool wrap) { if (!flipvh && !fliphv) return (LOS_NONE); - + if (flipvh && vis != (dir == 1)) return (LOS_NONE); @@ -1255,10 +1253,10 @@ bool in_los_bounds(int x, int y) // // find_square // -// Finds the next monster/object/whatever (moving in a spiral -// outwards from the player, so closer targets are chosen first; -// starts to player's left) and puts its coordinates in mfp. -// Returns 1 if it found something, zero otherwise. If direction +// Finds the next monster/object/whatever (moving in a spiral +// outwards from the player, so closer targets are chosen first; +// starts to player's left) and puts its coordinates in mfp. +// Returns 1 if it found something, zero otherwise. If direction // is -1, goes backwards. // // If the game option target_zero_exp is true, zero experience @@ -1293,7 +1291,7 @@ static char find_square( int xps, int yps, // need to find what we're currently on. const bool vis = (env.show(view2show(coord_def(xps, yps))) || view2grid(coord_def(xps, yps)) == you.pos()); - + if (wrap && (vis != (los == LOS_FLIPVH)) == (direction == 1)) { // We've already flipped over into the other direction, @@ -1322,7 +1320,7 @@ static char find_square( int xps, int yps, radius = crawl_view.viewsz.y - LOS_RADIUS - 1; const coord_def vyou = grid2view(you.pos()); - + const int minx = vyou.x - radius, maxx = vyou.x + radius, miny = vyou.y - radius, maxy = vyou.y + radius, ctrx = vyou.x, ctry = vyou.y; @@ -1511,7 +1509,7 @@ static void describe_feature(int mx, int my, bool oos) dungeon_feature_type grid = grd[mx][my]; if ( grid == DNGN_SECRET_DOOR ) grid = grid_secret_door_appearance(mx, my); - + std::string desc = feature_description(grid); if (desc.length()) { @@ -1575,7 +1573,7 @@ void describe_floor() return; msg_channel_type channel = MSGCH_EXAMINE; - + // water is not terribly important if you don't mind it if ((grd[you.x_pos][you.y_pos] == DNGN_DEEP_WATER || grd[you.x_pos][you.y_pos] == DNGN_SHALLOW_WATER) @@ -1625,7 +1623,7 @@ static std::string feature_do_grammar(description_level_type dtype, return (""); default: return (desc); - } + } } std::string feature_description(dungeon_feature_type grid, @@ -1676,7 +1674,7 @@ std::string raw_feature_description(dungeon_feature_type grid, return ("undefined trap"); } } - + switch (grid) { case DNGN_STONE_WALL: @@ -1688,7 +1686,7 @@ std::string raw_feature_description(dungeon_feature_type grid, else return ("rock wall"); case DNGN_PERMAROCK_WALL: - return ("unnaturally hard rock wall"); + return ("unnaturally hard rock wall"); case DNGN_CLOSED_DOOR: return ("closed door"); case DNGN_METAL_WALL: @@ -1700,7 +1698,7 @@ std::string raw_feature_description(dungeon_feature_type grid, case DNGN_CLEAR_STONE_WALL: return ("translucent stone wall"); case DNGN_CLEAR_PERMAROCK_WALL: - return ("translucent unnaturally hard rock wall"); + return ("translucent unnaturally hard rock wall"); case DNGN_ORCISH_IDOL: if (you.species == SP_HILL_ORC) return ("idol of Beogh"); @@ -1905,7 +1903,7 @@ std::string feature_description(int mx, int my, bool bloody, if (bloody) desc += ", spattered with blood"; - + return feature_do_grammar(dtype, add_stop, false, desc); } @@ -1992,7 +1990,7 @@ static std::string describe_monster_weapon(const monsters *mons) if (name1.empty() && !name2.empty()) name1.swap(name2); - + if (name1 == name2 && weap) { item_def dup = *weap; @@ -2004,7 +2002,7 @@ static std::string describe_monster_weapon(const monsters *mons) if (name1.empty()) return (desc); - + desc += " wielding "; desc += name1; @@ -2013,7 +2011,7 @@ static std::string describe_monster_weapon(const monsters *mons) desc += " and "; desc += name2; } - + return (desc); } @@ -2050,7 +2048,7 @@ static void describe_monster(const monsters *mon) } print_wounds(mon); - + if (!mons_is_mimic(mon->type) && mons_behaviour_perceptible(mon)) { if (mon->behaviour == BEH_SLEEP) @@ -2087,7 +2085,7 @@ static void describe_monster(const monsters *mon) std::string desc = ""; std::string last_desc = ""; std::string tmp = ""; - + const bool paralysed = mons_is_paralysed(mon); if (paralysed) last_desc += "paralysed"; @@ -2104,7 +2102,7 @@ static void describe_monster(const monsters *mon) last_desc = tmp; } } - + if (!last_desc.empty()) { if (!desc.empty()) @@ -2148,7 +2146,7 @@ std::string get_monster_desc(const monsters *mon, bool full_desc, desc += "wearing "; desc += mitm[mon_arm].name(DESC_NOCAP_A); } - + return desc; } @@ -2184,7 +2182,7 @@ static void describe_cell(int mx, int my) #endif describe_monster(&menv[i]); - + if (mons_is_mimic( menv[i].type )) { mimic_item = true; @@ -2278,7 +2276,7 @@ static void describe_cell(int mx, int my) else { const dungeon_feature_type feat = grd[mx][my]; - + if (interesting_feature(feat)) feature_desc += " (Press 'v' for more information.)"; @@ -2287,7 +2285,7 @@ static void describe_cell(int mx, int my) if ((feat == DNGN_FLOOR || feat == DNGN_FLOOR_SPECIAL) && !bloody && (monster_described || item_described || cloud_described)) return; - + msg_channel_type channel = MSGCH_EXAMINE; if (feat == DNGN_FLOOR || feat == DNGN_FLOOR_SPECIAL @@ -2339,7 +2337,7 @@ command_type targeting_behaviour::get_command(int key) case CK_MOUSE_MOVE: return CMD_TARGET_MOUSE_MOVE; case CK_MOUSE_CLICK: return CMD_TARGET_MOUSE_SELECT; #endif - + #ifdef WIZARD case 'F': return CMD_TARGET_WIZARD_MAKE_FRIENDLY; case 's': return CMD_TARGET_WIZARD_MAKE_SHOUT; @@ -2392,7 +2390,7 @@ command_type targeting_behaviour::get_command(int key) case 'Y': return CMD_TARGET_DIR_UP_LEFT; default: return CMD_NO_CMD; - } + } } bool targeting_behaviour::should_redraw() diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 7f3ff99de4..05e2459d14 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -56,7 +56,7 @@ extern char info[INFO_SIZE]; // defined in acr.cc {dlb} extern unsigned char show_green; // defined in view.cc {dlb} // defined in mon-util.cc -- w/o this screen redraws *really* slow {dlb} -extern FixedVector<unsigned short, 1000> mcolour; +extern FixedVector<unsigned short, 1000> mcolour; const int kNameLen = 30; #ifdef SHORT_FILE_NAMES @@ -88,9 +88,9 @@ public: virtual kill_category kill_alignment() const = 0; virtual god_type deity() const = 0; - + virtual bool alive() const = 0; - + virtual coord_def pos() const = 0; virtual bool swimming() const = 0; virtual bool submerged() const = 0; @@ -101,12 +101,12 @@ public: virtual bool can_pass_through_feat(dungeon_feature_type grid) const = 0; virtual bool can_pass_through(int x, int y) const; virtual bool can_pass_through(const coord_def &c) const; - + virtual size_type body_size(int psize = PSIZE_TORSO, bool base = false) const = 0; virtual int body_weight() const = 0; virtual int total_weight() const = 0; - + virtual int damage_type(int which_attack = -1) = 0; virtual int damage_brand(int which_attack = -1) = 0; virtual item_def *weapon(int which_attack = -1) = 0; @@ -129,7 +129,7 @@ public: virtual void lose_energy(energy_use_type) { } - + virtual std::string name(description_level_type type) const = 0; virtual std::string pronoun(pronoun_type which_pronoun) const = 0; virtual std::string conj_verb(const std::string &verb) const = 0; @@ -169,7 +169,7 @@ public: { return (0); } - + virtual void exercise(skill_type sk, int qty) { } virtual int stat_hp() const = 0; @@ -183,7 +183,7 @@ public: virtual void shield_block_succeeded() { } virtual int mons_species() const = 0; - + virtual mon_holy_type holiness() const = 0; virtual int res_fire() const = 0; virtual int res_steam() const = 0; @@ -195,7 +195,7 @@ public: virtual flight_type flight_mode() const = 0; virtual bool is_levitating() const = 0; virtual bool airborne() const; - + virtual bool paralysed() const = 0; virtual bool confused() const = 0; virtual bool caught() const = 0; @@ -250,7 +250,7 @@ struct coord_def } int distance_from(const coord_def &b) const; - + bool operator == (const coord_def &other) const { return x == other.x && y == other.y; @@ -279,7 +279,7 @@ struct coord_def y += offset; return (*this); } - + const coord_def &operator -= (const coord_def &other) { x -= other.x; @@ -307,7 +307,7 @@ struct coord_def y *= mul; return (*this); } - + coord_def operator + (const coord_def &other) const { coord_def copy = *this; @@ -343,7 +343,7 @@ struct coord_def coord_def copy = *this; return (copy *= mul); } - + int abs() const { return (x * x + y * y); @@ -387,7 +387,7 @@ struct delay_queue_item }; -struct item_def +struct item_def { object_class_type base_type; // basic class (ie OBJ_WEAPON) unsigned char sub_type; // type within that class (ie WPN_DAGGER) @@ -398,7 +398,7 @@ struct item_def unsigned long flags; // item status flags short quantity; // number of items - short x; // x-location; for inventory items = -1 + short x; // x-location; for inventory items = -1 short y; // y-location; for inventory items = -1 short link; // link to next item; for inventory items = slot short slot; // Inventory letter @@ -428,14 +428,14 @@ public: int book_number() const; int zap() const; // what kind of beam it shoots (if wand). // XXX should really return zap_type! - + // Returns index in mitm array. Results are undefined if this item is // not in the array! int index() const; int armour_rating() const; - + bool launched_by(const item_def &launcher) const; void clear() @@ -546,7 +546,7 @@ class player : public actor { public: bool turn_is_over; // flag signaling that player has performed a timed action - + // If true, player is headed to the Abyss. bool banished; std::string banished_by; @@ -554,7 +554,7 @@ public: std::vector<int> beheld_by; // monsters beholding player bool just_autoprayed; // autopray just kicked in - + unsigned short prev_targ; coord_def prev_grd_targ; char your_name[kNameLen]; @@ -653,7 +653,7 @@ public: int your_level; // offset by one (-1 == 0, 0 == 1, etc.) for display // durational things - FixedVector<int, NUM_DURATIONS> duration; + FixedVector<int, NUM_DURATIONS> duration; int rotting; @@ -724,13 +724,13 @@ public: unsigned char hell_exit; // which level plyr goes to on hell exit. - // This field is here even in non-WIZARD compiles, since the + // This field is here even in non-WIZARD compiles, since the // player might have been playing previously under wiz mode. bool wizard; // true if player has entered wiz mode. time_t birth_time; // start time of game time_t start_time; // start time of session - long real_time; // real time played (in seconds) + long real_time; // real time played (in seconds) long num_turns; // number of turns taken long last_view_update; // what turn was the view last updated? @@ -770,7 +770,7 @@ public: void copy_from(const player &other); void init(); - + // Low-level move the player to (x, y). Use these functions instead of // changing x_pos and y_pos directly. void moveto(int x, int y); @@ -778,7 +778,7 @@ public: coord_def prev_move() const; void reset_prev_move(); - + bool in_water() const; bool can_swim() const; bool is_levitating() const; @@ -895,7 +895,7 @@ public: int stat_hp() const { return hp; } int stat_maxhp() const { return hp_max; } - + int shield_bonus() const; int shield_block_penalty() const; int shield_bypass_ability(int tohit) const; @@ -986,7 +986,7 @@ public: private: int modded_speed(const monsters *mons, int hdplus) const; - int calc_duration(const monsters *mons, const mon_enchant *added) const; + int calc_duration(const monsters *mons, const mon_enchant *added) const; }; typedef std::map<enchant_type, mon_enchant> mon_enchant_list; @@ -1076,14 +1076,14 @@ public: void apply_enchantment(const mon_enchant &me); void timeout_enchantments(int levels); - + bool needs_transit() const; void set_transit(const level_id &destination); bool find_place_to_live(bool near_player = false); bool find_place_near_player(); bool find_home_around(const coord_def &c, int radius); bool find_home_anywhere(); - + void set_ghost(const ghost_demon &ghost); void ghost_init(); void pandemon_init(); @@ -1092,10 +1092,10 @@ public: void load_spells(mon_spellbook_type spellbook); actor *get_foe() const; - + // actor interface int id() const; - int get_experience_level() const; + int get_experience_level() const; god_type deity() const; bool alive() const; coord_def pos() const; @@ -1141,7 +1141,7 @@ public: bool force = false); bool can_use_missile(const item_def &item) const; - + std::string name(description_level_type type) const; std::string name(description_level_type type, bool force_visible) const; std::string pronoun(pronoun_type pro) const; @@ -1164,7 +1164,7 @@ public: mon_holy_type holiness() const; int res_fire() const; - int res_steam() const; + int res_steam() const; int res_cold() const; int res_elec() const; int res_poison() const; @@ -1237,9 +1237,9 @@ private: void equip_armour(item_def &item, int near); void unequip_weapon(item_def &item, int near); void unequip_armour(item_def &item, int near); - + bool decay_enchantment(const mon_enchant &me, bool decay_degree = true); - + bool drop_item(int eslot, int near); bool wants_weapon(const item_def &item) const; bool wants_armour(const item_def &item) const; @@ -1361,11 +1361,11 @@ public: // Glyphs of squares that are in LOS. env_show_grid show; - + // What would be visible, if all of the translucent wall were // made opaque. env_show_grid no_trans_show; - + FixedArray<unsigned short, ENV_SHOW_DIAMETER, ENV_SHOW_DIAMETER> show_col; // view window colour @@ -1387,7 +1387,7 @@ public: FixedVector< int, 20 > mons_alloc; map_markers markers; - + double elapsed_time; // used during level load // Number of turns the player has spent on this level. @@ -1408,8 +1408,8 @@ struct message_filter int channel; // Use -1 to match any channel. text_pattern pattern; // Empty pattern matches any message - message_filter( int ch, const std::string &s ) - : channel(ch), pattern(s) + message_filter( int ch, const std::string &s ) + : channel(ch), pattern(s) { } @@ -1513,7 +1513,7 @@ struct mon_display }; class InitLineInput; -struct game_options +struct game_options { public: game_options(); @@ -1545,7 +1545,7 @@ public: bool suppress_startup_errors; bool mouse_input; - + int view_max_width; int view_max_height; int mlist_min_height; @@ -1588,7 +1588,7 @@ public: bool list_rotten; // list slots for rotting corpses/chunks bool default_target; // start targeting on a real target bool autopickup_no_burden; // don't autopickup if it changes burden - + bool note_all_skill_levels; // take note for all skill levels (1-27) bool note_skill_max; // take note when skills reach new max bool note_all_spells; // take note when learning any spell @@ -1600,7 +1600,7 @@ public: int colour[16]; // macro fg colours to other colours int background; // select default background colour int channels[NUM_MESSAGE_CHANNELS]; // msg channel colouring - + bool use_old_selection_order; // use old order of species/classes in // selection screen int weapon; // auto-choose weapon for character @@ -1632,7 +1632,7 @@ public: FixedVector<unsigned, NUM_DCHAR_TYPES> char_table; int num_colours; // used for setting up curses colour table (8 or 16) - + #ifdef WIZARD int wiz_mode; // yes, no, never in wiz mode to start #endif @@ -1684,7 +1684,7 @@ public: unsigned may_stab_brand; // Highlight potential stab candidates unsigned feature_item_brand; // Highlight features covered by items. unsigned trap_item_brand; // Highlight traps covered by items. - + bool trap_prompt; // Prompt when stepping on mechnical traps // without enough hp (using trapwalk.lua) @@ -1704,7 +1704,7 @@ public: // Some experimental improvments to explore bool explore_improved; - + std::vector<sound_mapping> sound_mappings; std::vector<colour_mapping> menu_colour_mappings; std::vector<message_colour_mapping> message_colour_mappings; @@ -1744,14 +1744,14 @@ public: int assign_item_slot; // How free slots are assigned std::vector<text_pattern> drop_filter; - + FixedArray<bool, NUM_DELAYS, NUM_AINTERRUPTS> activity_interrupts; // Previous startup options bool remember_name; // Remember and reprompt with last name bool dos_use_background_intensity; - + bool use_fake_cursor; // Draw a fake cursor instead of relying // on the term's own cursor. @@ -1769,7 +1769,7 @@ public: std::string fsim_mons; std::vector<std::string> fsim_kit; #endif // WIZARD - + #ifdef USE_TILE char tile_show_items[20]; // show which item types in tile inventory bool tile_title_screen; // display title screen? @@ -1797,11 +1797,11 @@ public: #ifdef WIN32TILES bool use_dos_char; #endif - + typedef std::map<std::string, std::string> opt_map; opt_map named_options; // All options not caught above are // recorded here. - + /////////////////////////////////////////////////////////////////////// // These options cannot be directly set by the user. Instead they're // set indirectly to the choices the user made for the last character @@ -1827,14 +1827,14 @@ public: unsigned int tut_berserk_counter; unsigned int tut_melee_counter; unsigned int tut_last_healed; - + bool tut_just_triggered; unsigned int tutorial_type; unsigned int tutorial_left; private: std::map<std::string, std::string> aliases; - + public: // Convenience accessors for the second-class options in named_options. int o_int(const char *name, int def = 0) const; @@ -1849,7 +1849,7 @@ public: private: std::string unalias(const std::string &key) const; void add_alias(const std::string &alias, const std::string &name); - + void clear_feature_overrides(); void clear_cset_overrides(); void add_cset_override(char_set_type set, const std::string &overrides); @@ -1860,7 +1860,7 @@ private: void add_message_colour_mappings(const std::string &); void add_message_colour_mapping(const std::string &); message_filter parse_message_filter(const std::string &s); - + void set_default_activity_interrupts(); void clear_activity_interrupts(FixedVector<bool, NUM_AINTERRUPTS> &eints); void set_activity_interrupt( @@ -1879,11 +1879,11 @@ private: void split_parse(const std::string &s, const std::string &separator, void (game_options::*add)(const std::string &)); - void add_mon_glyph_override(monster_type mtype, mon_display &mdisp); + void add_mon_glyph_override(monster_type mtype, mon_display &mdisp); void add_mon_glyph_overrides(const std::string &mons, mon_display &mdisp); void add_mon_glyph_override(const std::string &); mon_display parse_mon_glyph(const std::string &s) const; - void set_option_fragment(const std::string &s); + void set_option_fragment(const std::string &s); static const std::string interrupt_prefix; }; diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 519f5feb15..a9bc0ba6b8 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -65,10 +65,10 @@ god_type str_to_god(std::string god) return (GOD_NO_GOD); lowercase(god); - + if (god == "random") return (GOD_RANDOM); - + for (int i = GOD_NO_GOD; i < NUM_GODS; ++i) if (lowercase_string(god_name(static_cast<god_type>(i))) == god) return (static_cast<god_type>(i)); @@ -101,7 +101,7 @@ static unsigned int _str_to_tile_colour(std::string colour) colour = "grey"; else if (colour == "lightgray") colour = "lightgrey"; - + for (unsigned int i = 0; i < 24; i++) { if (tile_cols[i] == colour) @@ -163,7 +163,7 @@ int str_to_colour( const std::string &str, int default_colour, if (ret == 16) { // Maybe we have an element colour attribute. - for (unsigned i = 0; i < sizeof(element_cols) / sizeof(*element_cols); + for (unsigned i = 0; i < sizeof(element_cols) / sizeof(*element_cols); ++i) { if (str == element_cols[i]) @@ -327,7 +327,7 @@ static char _str_to_race( const std::string &str ) return '*'; int index = -1; - + if (str.length() == 1) // old system of using menu letter return (str[0]); else if (str.length() == 2) // scan abbreviations @@ -339,7 +339,7 @@ static char _str_to_race( const std::string &str ) if (index == -1) fprintf( stderr, "Unknown race choice: %s\n", str.c_str() ); - + return ((index != -1) ? index_to_letter( index ) : 0); } @@ -422,7 +422,7 @@ static unsigned curses_attribute(const std::string &field) crawl_state.add_startup_error( make_stringf("Bad highlight string -- %s\n", field.c_str())); else - return CHATTR_HILITE | (colour << 8); + return CHATTR_HILITE | (colour << 8); } else if (field != "none") crawl_state.add_startup_error( @@ -521,8 +521,8 @@ void game_options::set_activity_interrupt( make_stringf("Unknown delay: %s\n", delay_name.c_str())); return; } - - FixedVector<bool, NUM_AINTERRUPTS> &refints = + + FixedVector<bool, NUM_AINTERRUPTS> &refints = activity_interrupts[delay]; for (int i = 0; i < NUM_AINTERRUPTS; ++i) @@ -543,7 +543,7 @@ void game_options::set_activity_interrupt( eints[ai] = true; } - + void game_options::set_activity_interrupt(const std::string &activity_name, const std::string &interrupt_names, bool append_interrupts, @@ -575,7 +575,7 @@ void game_options::set_activity_interrupt(const std::string &activity_name, { if (!append_interrupts) clear_activity_interrupts(eints); - + for (int i = 0, size = interrupts.size(); i < size; ++i) set_activity_interrupt(eints, interrupts[i]); } @@ -609,7 +609,7 @@ void game_options::reset_options() #endif mouse_input = false; - + view_max_width = 33; view_max_height = 21; mlist_min_height = 5; @@ -647,7 +647,7 @@ void game_options::reset_options() #else char_set = CSET_IBM; #endif - + // set it to the .crawlrc default autopickups = ((1L << 15) | // gold (1L << 6) | // scrolls @@ -658,7 +658,7 @@ void game_options::reset_options() (1L << 4)); // food suppress_startup_errors = false; - + show_inventory_weights = false; colour_map = true; clean_map = false; @@ -674,7 +674,7 @@ void game_options::reset_options() magic_point_warning = 0; default_target = true; autopickup_no_burden = false; - + user_note_prefix = ""; note_all_skill_levels = false; note_skill_max = false; @@ -753,7 +753,7 @@ void game_options::reset_options() target_oos = true; target_los_first = true; target_unshifted_dirs = false; - + dump_kill_places = KDO_ONE_PLACE; dump_message_count = 7; dump_item_origins = IODS_ARTEFACTS | IODS_RODS; @@ -844,7 +844,7 @@ void game_options::reset_options() for (int i = 0; i < 16; i++) colour[i] = i; #endif - + // map each channel to plain (well, default for now since I'm testing) for (int i = 0; i < NUM_MESSAGE_CHANNELS; i++) channels[i] = MSGCOL_DEFAULT; @@ -866,8 +866,8 @@ void game_options::reset_options() never_pickup.clear(); always_pickup.clear(); - note_monsters.clear(); - note_messages.clear(); + note_monsters.clear(); + note_messages.clear(); autoinscriptions.clear(); note_items.clear(); note_skill_levels.clear(); @@ -960,14 +960,14 @@ void game_options::add_mon_glyph_overrides(const std::string &mons, int letter = -1; if (mons.length() == 1) letter = mons[0] == '_' ? ' ' : mons[0]; - + bool found = false; for (int i = 0; i < NUM_MONSTERS; ++i) { const monsterentry *me = get_monster_data(i); if (!me || me->mc == MONS_PROGRAM_BUG) continue; - + if (me->showchar == letter || me->name == mons) { found = true; @@ -1015,7 +1015,7 @@ void game_options::add_feature_override(const std::string &text) std::string::size_type spos = text.rfind("{", epos); if (spos == std::string::npos) return; - + std::string fname = text.substr(0, spos); std::string props = text.substr(spos + 1, epos - spos - 1); std::vector<std::string> iprops = split_string(",", props, true, true); @@ -1036,7 +1036,7 @@ void game_options::add_feature_override(const std::string &text) { feature_override fov; fov.feat = feats[i]; - + fov.override.symbol = read_symbol(iprops[0]); fov.override.magic_symbol = read_symbol(iprops[1]); fov.override.colour = str_to_colour(iprops[2], BLACK); @@ -1058,12 +1058,12 @@ void game_options::add_cset_override( std::vector<std::string> mapping = split_string(":", overs[i]); if (mapping.size() != 2) continue; - + dungeon_char_type dc = dchar_by_name(mapping[0]); if (dc == NUM_DCHAR_TYPES) continue; - - unsigned symbol = + + unsigned symbol = static_cast<unsigned>(read_symbol(mapping[1])); if (set == NUM_CSET) @@ -1227,7 +1227,7 @@ void save_player_name() write_newgame_options_file(); #endif // !DISABLE_STICKY_STARTUP_OPTIONS } - + void read_options(FILE *f, bool runscript) { FileLineInput fl(f); @@ -1249,7 +1249,7 @@ void game_options::read_options(InitLineInput &il, bool runscript, bool clear_aliases) { unsigned int line = 0; - + bool inscriptblock = false; bool inscriptcond = false; bool isconditional = false; @@ -1258,7 +1258,7 @@ void game_options::read_options(InitLineInput &il, bool runscript, if (clear_aliases) aliases.clear(); - + std::string luacond; std::string luacode; while (!il.eof()) @@ -1316,7 +1316,7 @@ void game_options::read_options(InitLineInput &il, bool runscript, } continue; } - else if (inscriptcond && + else if (inscriptcond && (str.find(">") == str.length() - 1 || str == ">L")) { inscriptcond = false; @@ -1359,7 +1359,7 @@ void game_options::read_options(InitLineInput &il, bool runscript, luacode.clear(); #endif } - + continue; } else if (inscriptblock && (str == "}Lua" || str == "}")) @@ -1531,7 +1531,7 @@ void game_options::set_menu_sort(std::string field) { if (field.empty()) return; - + menu_sort_condition cond(field); sort_menus.push_back(cond); } @@ -1549,7 +1549,7 @@ void game_options::set_option_fragment(const std::string &s) { if (s.empty()) return; - + std::string::size_type st = s.find(':'); if (st == std::string::npos) { @@ -1608,7 +1608,7 @@ void game_options::read_option_line(const std::string &str, bool runscript) return; field = str.substr( first_equals + 1 ); - + std::string prequal = trimmed_string( str.substr(0, first_equals) ); // Is this a case of key += val? @@ -1658,10 +1658,10 @@ void game_options::read_option_line(const std::string &str, bool runscript) // Keep unlowercased field around const std::string orig_field = field; - if (key != "name" && key != "crawl_dir" + if (key != "name" && key != "crawl_dir" && key != "race" && key != "class" && key != "ban_pickup" && key != "autopickup_exceptions" - && key != "stop_travel" && key != "sound" + && key != "stop_travel" && key != "sound" && key != "travel_stop_message" && key != "drop_filter" && key != "lua_file" && key != "note_items" && key != "autoinscribe" @@ -1742,7 +1742,7 @@ void game_options::read_option_line(const std::string &str, bool runscript) if (key == "ascii_display") { - char_set = + char_set = _read_bool(field, char_set == CSET_ASCII)? CSET_ASCII : CSET_IBM; @@ -1829,7 +1829,7 @@ void game_options::read_option_line(const std::string &str, bool runscript) else COLOUR_OPTION(detected_monster_colour); else if (key.find(interrupt_prefix) == 0) { - set_activity_interrupt(key.substr(interrupt_prefix.length()), + set_activity_interrupt(key.substr(interrupt_prefix.length()), field, plus_equal, minus_equal); @@ -1912,7 +1912,7 @@ void game_options::read_option_line(const std::string &str, bool runscript) else if (key == "fire_items_start") { if (isalpha( field[0] )) - fire_items_start = letter_to_index( field[0] ); + fire_items_start = letter_to_index( field[0] ); else { fprintf( stderr, "Bad fire item start index: %s\n", @@ -2071,7 +2071,7 @@ void game_options::read_option_line(const std::string &str, bool runscript) if (scrollmarg < 0) scrollmarg = 0; scroll_margin_x = scroll_margin_y = scrollmarg; - } + } else if (key == "user_note_prefix") { // field is already cleaned up from trim_string() @@ -2084,22 +2084,22 @@ void game_options::read_option_line(const std::string &str, bool runscript) { if (subkey == "failure") { - flush_input[FLUSH_ON_FAILURE] + flush_input[FLUSH_ON_FAILURE] = _read_bool(field, flush_input[FLUSH_ON_FAILURE]); } else if (subkey == "command") { - flush_input[FLUSH_BEFORE_COMMAND] + flush_input[FLUSH_BEFORE_COMMAND] = _read_bool(field, flush_input[FLUSH_BEFORE_COMMAND]); } else if (subkey == "message") { - flush_input[FLUSH_ON_MESSAGE] + flush_input[FLUSH_ON_MESSAGE] = _read_bool(field, flush_input[FLUSH_ON_MESSAGE]); } else if (subkey == "lua") { - flush_input[FLUSH_LUA] + flush_input[FLUSH_LUA] = _read_bool(field, flush_input[FLUSH_LUA]); } } @@ -2461,7 +2461,7 @@ void game_options::read_option_line(const std::string &str, bool runscript) new_dump_fields(field, !minus_equal); } - else if (key == "dump_kill_places") + else if (key == "dump_kill_places") { dump_kill_places = field == "none"? KDO_NO_PLACES : @@ -2498,10 +2498,10 @@ void game_options::read_option_line(const std::string &str, bool runscript) if (ch == "artefacts" || ch == "artifacts" || ch == "artefact" || ch == "artifact") dump_item_origins |= IODS_ARTEFACTS; - else if (ch == "ego_arm" || ch == "ego armour" + else if (ch == "ego_arm" || ch == "ego armour" || ch == "ego_armour") dump_item_origins |= IODS_EGO_ARMOUR; - else if (ch == "ego_weap" || ch == "ego weapon" + else if (ch == "ego_weap" || ch == "ego weapon" || ch == "ego_weapon" || ch == "ego weapons" || ch == "ego_weapons") dump_item_origins |= IODS_EGO_WEAPON; @@ -2666,7 +2666,7 @@ void game_options::read_option_line(const std::string &str, bool runscript) else if (runscript) { #ifdef CLUA_BINDINGS - if (!clua.callbooleanfn(false, "c_process_lua_option", "ss", + if (!clua.callbooleanfn(false, "c_process_lua_option", "ss", key.c_str(), orig_field.c_str())) #endif { @@ -2760,7 +2760,7 @@ bool arg_seen[num_cmd_ops]; bool parse_args( int argc, char **argv, bool rc_only ) { set_crawl_base_dir(argv[0]); - + if (argc < 2) // no args! return (true); @@ -2776,7 +2776,7 @@ bool parse_args( int argc, char **argv, bool rc_only ) if (SysEnv.cmd_args.empty()) for (int i = 1; i < argc; ++i) SysEnv.cmd_args.push_back(argv[i]); - + while (current < argc) { // get argument @@ -2841,7 +2841,7 @@ bool parse_args( int argc, char **argv, bool rc_only ) case CLO_SCORES: case CLO_TSCORES: case CLO_VSCORES: - if (!next_is_param) + if (!next_is_param) ecount = -1; // default else // optional number given { @@ -2882,7 +2882,7 @@ bool parse_args( int argc, char **argv, bool rc_only ) else SysEnv.map_gen_iters = 100; break; - + case CLO_MACRO: if (!next_is_param) return (false); @@ -2906,7 +2906,7 @@ bool parse_args( int argc, char **argv, bool rc_only ) SysEnv.scorefile = next_arg; nextUsed = true; break; - + case CLO_NAME: if (!next_is_param) return (false); diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 80a7f25787..6ac82b95d4 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -94,7 +94,7 @@ static bool _fire_validate_item(int selected, std::string& err); bool can_wield(const item_def *weapon, bool say_reason, bool ignore_temporary_disability) { -#define SAY(x) if (say_reason) { x; } else +#define SAY(x) if (say_reason) { x; } else if (!ignore_temporary_disability && you.duration[DUR_BERSERKER]) { @@ -170,7 +170,7 @@ bool can_wield(const item_def *weapon, bool say_reason, int weap_brand = get_weapon_brand( *weapon ); if ((you.is_undead || you.species == SP_DEMONSPAWN) && (!is_fixed_artefact( *weapon ) - && (weap_brand == SPWPN_HOLY_WRATH + && (weap_brand == SPWPN_HOLY_WRATH || (weapon->base_type == OBJ_WEAPONS && weapon->sub_type == WPN_BLESSED_BLADE)))) { @@ -305,10 +305,10 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages) if (!yesno(prompt.c_str(), false, 'n')) return (false); } - + if (!unwield_item(show_weff_messages)) return (false); - + canned_msg( MSG_EMPTY_HANDED ); you.turn_is_over = true; @@ -377,7 +377,7 @@ static void warn_rod_shield_interference(const item_def &) // Any way to avoid the double entendre? :-) if (leak_degree) - mprf(MSGCH_WARN, + mprf(MSGCH_WARN, "Your %s %sreduces the effectiveness of your rod.", shield_base_name(player_shield()), leak_degree); @@ -385,19 +385,19 @@ static void warn_rod_shield_interference(const item_def &) static void warn_launcher_shield_slowdown(const item_def &launcher) { - const int slowspeed = + const int slowspeed = launcher_final_speed(launcher, player_shield()) * player_speed() / 100; - const int normspeed = + const int normspeed = launcher_final_speed(launcher, NULL) * player_speed() / 100; // Don't warn the player unless the slowdown is real. if (slowspeed > normspeed) { - const char *slow_degree = + const char *slow_degree = shield_impact_degree(slowspeed * 100 / normspeed); if (slow_degree) - mprf(MSGCH_WARN, - "Your %s %sslows your rate of fire.", + mprf(MSGCH_WARN, + "Your %s %sslows your rate of fire.", shield_base_name(player_shield()), slow_degree); } @@ -430,18 +430,18 @@ int item_special_wield_effect(const item_def &item) { if (item.base_type != OBJ_WEAPONS || !is_artefact(item)) return (SPWLD_NONE); - + int i_eff = SPWPN_NORMAL; if (is_random_artefact( item )) i_eff = randart_wpn_property(item, RAP_BRAND); - else + else i_eff = item.special; switch (i_eff) { case SPWPN_SINGING_SWORD: return (SPWLD_SING); - + case SPWPN_WRATH_OF_TROG: return (SPWLD_TROG); @@ -491,7 +491,7 @@ void wield_effects(int item_wield_2, bool showMsgs) { if (showMsgs) mpr("The area is filled with flickering shadows."); - + you.current_vision -= 2; setLOSRadius(you.current_vision); you.special_wield = SPWLD_SHADOW; @@ -528,7 +528,7 @@ void wield_effects(int item_wield_2, bool showMsgs) // only used for Singing Sword introduction const bool was_known = item_type_known(you.inv[item_wield_2]); const char *old_desc = you.inv[item_wield_2].name(DESC_CAP_THE).c_str(); - + set_ident_flags( you.inv[item_wield_2], ISFLAG_EQ_WEAPON_MASK ); if (is_random_artefact( you.inv[item_wield_2] )) @@ -536,7 +536,7 @@ void wield_effects(int item_wield_2, bool showMsgs) i_dam = randart_wpn_property(you.inv[item_wield_2], RAP_BRAND); use_randart(item_wield_2); } - else + else { i_dam = you.inv[item_wield_2].special; } @@ -581,7 +581,7 @@ void wield_effects(int item_wield_2, bool showMsgs) ? "You feel a sudden desire to commit suicide." : "You feel a sudden desire to slay dragons!"); break; - + case SPWPN_VENOM: mpr("It begins to drip with poison!"); break; @@ -681,7 +681,7 @@ void wield_effects(int item_wield_2, bool showMsgs) case SPWPN_DISTORTION: mpr("Space warps around you for a moment!"); - + if (!was_known) xom_is_stimulated(32); break; @@ -759,7 +759,7 @@ bool armour_prompt( const std::string & mesg, int *index, operation_types oper) ASSERT(index != NULL); bool succeeded = false; - int slot; + int slot; if (inv_count() < 1) canned_msg(MSG_NOTHING_CARRIED); @@ -932,7 +932,7 @@ bool can_wear_armour(const item_def &item, bool verbose, bool ignore_temporary) return (false); } } - + if (!can_equip( slot, ignore_temporary )) { if (verbose) @@ -1005,7 +1005,7 @@ bool do_wear_armour( int item, bool quiet ) if (!can_wear_armour(you.inv[item], !quiet, false)) return (false); - + const item_def &invitem = you.inv[item]; const equipment_type slot = get_armour_slot(invitem); @@ -1042,7 +1042,7 @@ bool do_wear_armour( int item, bool quiet ) return (false); } - + bool removedCloak = false; int cloak = -1; @@ -1301,7 +1301,7 @@ void fire_target_behaviour::message_ammo_prompt(const std::string* pre_text) { const item_def& item_def = you.inv[m_slot]; const launch_retval projected = is_launched(&you, you.weapon(), item_def); - + if (projected == LRET_FUMBLED) msg << "Awkwardly throwing "; else if (projected == LRET_LAUNCHED) @@ -1385,7 +1385,7 @@ command_type fire_target_behaviour::get_command(int key) need_prompt = true; return (CMD_NO_CMD); } - + return targeting_behaviour::get_command(key); } @@ -1445,7 +1445,7 @@ static int _fire_prompt_for_item(std::string& err) { if (inv_count() < 1) { - // canned_msg(MSG_NOTHING_CARRIED); // Hmmm... + // canned_msg(MSG_NOTHING_CARRIED); // Hmmm... err = "You aren't carrying anything."; return -1; } @@ -1517,10 +1517,10 @@ void fire_thing(int item) { if (_fire_warn_if_impossible()) { - flush_input_buffer( FLUSH_ON_FAILURE ); + flush_input_buffer( FLUSH_ON_FAILURE ); return; } - + if (Options.tutorial_left) Options.tut_throw_counter++; @@ -1565,7 +1565,7 @@ int launcher_shield_slowdown(const item_def &launcher, const item_def *shield) // Adjust for shields skill. if (speed_adjust > 100) - speed_adjust -= ((speed_adjust - 100) * 5 / 10) + speed_adjust -= ((speed_adjust - 100) * 5 / 10) * you.skills[SK_SHIELDS] / 27; return (speed_adjust); @@ -1598,7 +1598,7 @@ int launcher_final_speed(const item_def &launcher, const item_def *shield) speed_base = speed_base * speed_adjust / 100; speed_min = speed_min * speed_adjust / 100; } - + // do the same when trying to shoot while held in a net if (you.attribute[ATTR_HELD]) // only for blowguns { @@ -1639,7 +1639,7 @@ bool elemental_missile_beam(int launcher_brand, int ammo_brand) // XXX This is a bit too generous, as it lets the player determine // that the bolt of fire he just shot from a flaming bow is actually // a poison arrow. Hopefully this isn't too abusable. -static bool determines_ammo_brand(int bow_brand, int ammo_brand) +static bool determines_ammo_brand(int bow_brand, int ammo_brand) { if (bow_brand == SPWPN_FLAME && ammo_brand == SPMSL_FLAME) return false; @@ -1736,7 +1736,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, { if (thr.isCancel) canned_msg(MSG_OK); - + return (false); } } @@ -1829,7 +1829,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, // figure out if we're thrown or launched const launch_retval projected = is_launched(&you, you.weapon(), item); - + // extract launcher bonuses due to magic if (projected == LRET_LAUNCHED) { @@ -1875,7 +1875,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, #ifdef DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "Base hit == %d; Base damage == %d " - "(item %d + launcher %d)", + "(item %d + launcher %d)", baseHit, baseDam, item_base_dam, lnch_base_dam); #endif @@ -1886,14 +1886,14 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, // check for matches; dwarven, elven, orcish if (!get_equip_race(you.inv[you.equip[EQ_WEAPON]]) == 0) { - if (get_equip_race( you.inv[you.equip[EQ_WEAPON]] ) + if (get_equip_race( you.inv[you.equip[EQ_WEAPON]] ) == get_equip_race( item )) { baseHit += 1; baseDam += 1; // elves with elven bows - if (get_equip_race(you.inv[you.equip[EQ_WEAPON]]) + if (get_equip_race(you.inv[you.equip[EQ_WEAPON]]) == ISFLAG_ELVEN && player_genus(GENPC_ELVEN)) { @@ -1901,7 +1901,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, } } } - + // lower accuracy if held in a net (needs testing) if (you.attribute[ATTR_HELD]) { @@ -1916,10 +1916,10 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, // [dshaligram] Throwing now two parts launcher skill, one part // ranged combat. Removed the old model which is... silly. - + // [jpeg] Throwing now only affects actual throwing weapons, // i.e. not launched ones. (Sep 10, 2007) - + shoot_skill = you.skills[launcher_skill]; effSkill = shoot_skill; @@ -1965,7 +1965,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, // Sling bullets are designed for slinging and easier to aim. if (wepType == MI_SLING_BULLET) baseHit += 4; - + exHitBonus += (effSkill * 3) / 2; // strength is good if you're using a nice sling. @@ -2021,7 +2021,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, // add in skill for bows.. help you to find those vulnerable spots. // exDamBonus += effSkill; - + dice_mult = dice_mult * (17 + random2(1 + effSkill)) / 17; // now kill the launcher damage bonus @@ -2157,10 +2157,10 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, { returning = ((get_weapon_brand(item) == SPWPN_RETURNING || get_ammo_brand(item) == SPMSL_RETURNING) && !teleport); - + if (returning && !one_chance_in(1 + skill_bump(SK_THROWING))) did_return = true; - + baseHit = 0; // missiles only use inv_plus @@ -2296,16 +2296,16 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, { baseDam = div_rand_round(baseDam, 2); } - + // exercise skill if (coinflip()) exercise(SK_THROWING, 1); - + // ID check if ( !teleport && !item_ident(you.inv[throw_2], ISFLAG_KNOW_PLUSES) && random2(100) < you.skills[SK_THROWING] ) - { + { set_ident_flags( item, ISFLAG_KNOW_PLUSES ); set_ident_flags( you.inv[throw_2], ISFLAG_KNOW_PLUSES ); identify_floor_missiles_matching(item, ISFLAG_KNOW_PLUSES); @@ -2664,7 +2664,7 @@ void jewellery_wear_effects(item_def &item) ident = ID_KNOWN_TYPE; } break; - + case AMU_RAGE: if (!scan_randarts( RAP_BERSERK )) { @@ -2703,7 +2703,7 @@ void jewellery_wear_effects(item_def &item) if (item_cursed( item )) { - mprf("Oops, that %s feels deathly cold.", + mprf("Oops, that %s feels deathly cold.", jewellery_is_amulet(item)? "amulet" : "ring"); learned_something_new(TUT_YOU_CURSED); @@ -2821,7 +2821,7 @@ bool safe_to_remove_or_wear(const item_def &item, bool remove) prompt += "ing this item could be fatal. "; prompt += item.base_type == OBJ_WEAPONS ? "Wield" : "Put on"; prompt += " anyway?"; - + if ((-prop_str >= you.strength || -prop_int >= you.intel || -prop_dex >= you.dex) && !yesno(prompt.c_str(), false, 'n')) @@ -2851,10 +2851,10 @@ static bool swap_rings(int ring_slot) if (!remove_ring(unwanted, false)) return (false); - + if (!safe_to_remove_or_wear(you.inv[ring_slot], false)) return (false); - + start_delay(DELAY_JEWELLERY_ON, 1, ring_slot); return (true); @@ -2868,7 +2868,7 @@ bool puton_item(int item_slot, bool prompt_finger) { // if (Options.easy_unequip) return (!remove_ring(item_slot)); - + // mpr("You've already put that on!"); // return (true); } @@ -2913,7 +2913,7 @@ bool puton_item(int item_slot, bool prompt_finger) if (!safe_to_remove_or_wear(you.inv[item_slot], false)) return (false); - + start_delay(DELAY_JEWELLERY_ON, 1, item_slot); // Assume it's going to succeed. @@ -2922,7 +2922,7 @@ bool puton_item(int item_slot, bool prompt_finger) if (!safe_to_remove_or_wear(you.inv[item_slot], false)) return (false); - + // First ring goes on left hand if we're choosing automatically. int hand_used = 0; @@ -2934,8 +2934,8 @@ bool puton_item(int item_slot, bool prompt_finger) if (is_amulet) hand_used = 2; - else if (prompt_finger - && you.equip[EQ_LEFT_RING] == -1 + else if (prompt_finger + && you.equip[EQ_LEFT_RING] == -1 && you.equip[EQ_RIGHT_RING] == -1) { mpr("Put on which hand (l or r)?", MSGCH_PROMPT); @@ -3001,7 +3001,7 @@ bool puton_ring(int slot, bool prompt_finger) void jewellery_remove_effects(item_def &item) { // The ring/amulet must already be removed from you.equip at this point. - + // Turn off show_uncursed before getting the item name, because this item // was just removed, and the player knows it's uncursed. const bool old_showuncursed = Options.show_uncursed; @@ -3098,7 +3098,7 @@ bool remove_ring(int slot, bool announce) return (false); } - if (you.equip[EQ_GLOVES] != -1 + if (you.equip[EQ_GLOVES] != -1 && item_cursed( you.inv[you.equip[EQ_GLOVES]] ) && you.equip[EQ_AMULET] == -1) { @@ -3126,7 +3126,7 @@ bool remove_ring(int slot, bool announce) if (hand_used == EQ_NONE) { - const int equipn = + const int equipn = (slot == -1)? prompt_invent_item( "Remove which piece of jewellery?", MT_INVLIST, OBJ_JEWELLERY, true, true, true, @@ -3157,7 +3157,7 @@ bool remove_ring(int slot, bool announce) return (false); } } - + if (!check_warning_inscriptions(you.inv[you.equip[hand_used]], OPER_REMOVE)) { @@ -3165,7 +3165,7 @@ bool remove_ring(int slot, bool announce) return (false); } - if (you.equip[EQ_GLOVES] != -1 + if (you.equip[EQ_GLOVES] != -1 && item_cursed( you.inv[you.equip[EQ_GLOVES]] ) && (hand_used == EQ_LEFT_RING || hand_used == EQ_RIGHT_RING)) { @@ -3190,7 +3190,7 @@ bool remove_ring(int slot, bool announce) set_ident_flags( you.inv[you.equip[hand_used]], ISFLAG_KNOW_CURSE ); return (false); } - + ring_wear_2 = you.equip[hand_used]; if (!safe_to_remove_or_wear(you.inv[ring_wear_2], true)) @@ -3402,7 +3402,7 @@ void inscribe_item() else break; } - + you.inv[item_slot].inscription = std::string(buf); you.wield_change = true; you.quiver_change = true; @@ -3450,7 +3450,7 @@ void drink( int slot ) canned_msg(MSG_PRESENT_FORM); return; } - + if (slot != -1) item_slot = slot; else @@ -3477,18 +3477,18 @@ void drink( int slot ) // potions on monsters. const bool dangerous = player_in_a_dangerous_place() && (you.experience_level > 1); - + if (potion_effect(static_cast<potion_type>(you.inv[item_slot].sub_type), 40, alreadyknown)) { set_ident_flags( you.inv[item_slot], ISFLAG_IDENT_MASK ); - set_ident_type( you.inv[item_slot].base_type, + set_ident_type( you.inv[item_slot].base_type, you.inv[item_slot].sub_type, ID_KNOWN_TYPE ); } else { - set_ident_type( you.inv[item_slot].base_type, + set_ident_type( you.inv[item_slot].base_type, you.inv[item_slot].sub_type, ID_TRIED_TYPE ); } if (!alreadyknown && dangerous) @@ -3522,14 +3522,14 @@ bool _drink_fountain() { if (!yesno("Drink from the fountain?")) return false; - + mpr("You drink the pure, clear water."); } else if ( feat == DNGN_FOUNTAIN_BLOOD ) { if (!yesno("Drink from the fountain of blood?")) return false; - + mpr("You drink the blood."); fountain_effect = POT_BLOOD; } @@ -3537,7 +3537,7 @@ bool _drink_fountain() { if (!yesno("Drink from the sparkling fountain?")) return false; - + mpr("You drink the sparkling water."); const potion_type effects[] = @@ -3683,7 +3683,7 @@ static bool affix_weapon_enchantment() mprf("%s twongs alarmingly.", itname.c_str()); // from unwield_item - miscast_effect( SPTYP_TRANSLOCATION, 9, 90, 100, + miscast_effect( SPTYP_TRANSLOCATION, 9, 90, 100, "distortion affixation" ); success = false; break; @@ -3917,7 +3917,7 @@ static void handle_read_book( int item_slot ) skill_manual(item_slot); return; } - + while (true) { // Spellbook @@ -3990,7 +3990,7 @@ static bool scroll_modify_item(const scroll_type scroll) default: break; } - + // Oops, wrong item... canned_msg(MSG_NOTHING_HAPPENS); return (false); @@ -4022,9 +4022,9 @@ void read_scroll( int slot ) int item_slot = (slot != -1) ? slot : prompt_invent_item( - "Read which item?", - MT_INVLIST, - OBJ_SCROLLS, + "Read which item?", + MT_INVLIST, + OBJ_SCROLLS, true, true, true, 0, NULL, OPER_READ ); @@ -4407,7 +4407,7 @@ void read_scroll( int slot ) void examine_object(void) { - int item_slot = prompt_invent_item( "Examine which item?", + int item_slot = prompt_invent_item( "Examine which item?", MT_INVLIST, -1, true, true, true, 0, NULL, OPER_EXAMINE ); @@ -4534,7 +4534,7 @@ bool wearing_slot(int inv_slot) for (int i = EQ_CLOAK; i <= EQ_AMULET; ++i) if ( inv_slot == you.equip[i] ) return true; - + return false; } diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc index c65f754ed3..bf8d0029ab 100644 --- a/crawl-ref/source/libgui.cc +++ b/crawl-ref/source/libgui.cc @@ -141,7 +141,7 @@ typedef struct prefs #define MAX_EDIT_PREFS 5 static int dummy_int[PREF_MODE_NUM][8]; static char dummy_str[PREF_MODE_NUM][2][MAX_PREF_CHAR+1]; -struct prefs pref_data[MAX_PREFS] = +struct prefs pref_data[MAX_PREFS] = { {"DUNGEON X", "DngnX", 'I', &dngn_x, 17, 35, 0}, {"DUNGEON Y", "DngnY", 'I', &dngn_y, 17, 35, 1}, @@ -231,19 +231,19 @@ static char _gmap_to_colour(char gm) } static const char gmap_col[256] = { - /* 0x00 */ PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, + /* 0x00 */ PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, /* 0x08 */ PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, - /* 0x10 */ PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, + /* 0x10 */ PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, /* 0x18 */ PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, /* ' ' '!' '"' '#' '$' '%' '&' ''' */ /* 0x20 */ PX_0, PX_I, PX_I, PX_F, PX_I, PX_I, PX_M, PX_D, - /* '(' ')' '*' '+' ',' '-' '.' '/' */ + /* '(' ')' '*' '+' ',' '-' '.' '/' */ /* 0x28 */ PX_I, PX_I, PX_WB,PX_I, PX_F, PX_0, PX_F, PX_I, /* 0 1 2 3 4 5 6 7 */ /* 0x30 */ PX_0, PX_M, PX_M, PX_M, PX_M, PX_M, PX_0, PX_0, /* 8 9 : ; < = > ? */ - /* 0x38 */ PX_MS,PX_0, PX_0, PX_M, PX_US,PX_I, PX_DS,PX_I, + /* 0x38 */ PX_MS,PX_0, PX_0, PX_M, PX_US,PX_I, PX_DS,PX_I, /* @ A B C D E F G */ /* 0x40 */ PX_M, PX_M, PX_M, PX_M, PX_M, PX_M, PX_M, PX_M, /* H I J K L M N O */ @@ -344,7 +344,7 @@ int tile_idx_unseen_terrain(int x, int y, int what) void GmapUpdate(int x, int y, int what, bool upd_tile) { int c; - + if (x == you.x_pos && y == you.y_pos) c = Options.tile_player_col; // player position always highlighted else @@ -390,7 +390,7 @@ void GmapUpdate(int x, int y, int what, bool upd_tile) c = Options.tile_excluded_col; } } - + int oldc = gmap_data[x][y]; gmap_data[x][y] = c; @@ -474,7 +474,7 @@ void GmapDisplay(int linex, int liney) ox += linex - gmap_min_x; oy += liney - gmap_min_y; // highlight centre of the map - buf2[ox + oy * GXM] = Options.tile_player_col; + buf2[ox + oy * GXM] = Options.tile_player_col; } region_map->flag = true; @@ -555,7 +555,7 @@ static void _do_layout() } while (item_x * item_y < 40) item_y++; - + region_item -> resize(item_x, item_y, TILE_X, TILE_Y); win_main->placeRegion (region_item, LAYER_NML, r0, place); } @@ -657,10 +657,10 @@ void libgui_init() region_tip->id = REGION_TIP; region_crt->init_font(font_name); - region_stat->init_font(font_name); - region_msg->init_font(font_name); + region_stat->init_font(font_name); + region_msg->init_font(font_name); region_tip->init_font(font_name); - + if (region_dngn) region_dngn->init_font(font_name); #endif @@ -673,7 +673,7 @@ void libgui_init() region_tile -> init_backbuf(); region_item2->init_backbuf(); - + if (region_item) region_item->init_backbuf(); } @@ -811,7 +811,7 @@ static void _libgui_save_prefs() { struct prefs *p = &pref_data[i]; int idx = p->dummy_idx; - + if (p->type == 'I') { fprintf(fp, "%s:%s=%d\n", pref_mode_name[mode], @@ -894,7 +894,7 @@ void edit_prefs() cprintf("H, L : Dec/Inc by 10"); need_draw_msg = false; } - + if (need_draw_stat) { region_stat->clear(); @@ -912,7 +912,7 @@ void edit_prefs() textcolor(LIGHTGREY); cprintf(" "); } - + if (pref_data[i].type == 'I') cprintf(" %s: %3d ", p->name, *(int *)p->ptr); else @@ -949,7 +949,7 @@ void edit_prefs() if (key == 0x1b || key == '\r') break; - + if (key == 'j' || key == CK_DOWN) { cur_pos++; @@ -982,7 +982,7 @@ void edit_prefs() int msg_y_old = msg_y; int dngn_x_old = dngn_x; int dngn_y_old = dngn_y; - + if (p->type == 'I' && inc != 0) { if (dat == &dngn_x || dat == &dngn_y) @@ -1059,7 +1059,7 @@ void edit_prefs() region_item->resize_backbuf(); if (region_item2) region_item2->resize_backbuf(); - + tile_set_force_redraw_inv(true); tile_draw_inv(REGION_INV1); @@ -1069,7 +1069,7 @@ void edit_prefs() region_item->redraw(); } // need resize } // while-loop - + clrscr(); redraw_screen(); mpr("Done."); @@ -1144,7 +1144,7 @@ int convert_cursor_pos(int mx, int my, int *cx, int *cy) { if (! (*r)->is_active()) continue; - + if ( (*r)->mouse_pos(mx, my, cx, cy) ) { id = (*r)->id; @@ -1218,12 +1218,12 @@ static bool _can_use_item(item_def item, bool equipped) // misc. items/rods can always be evoked, cursed or not if (item.base_type == OBJ_MISCELLANY || item_is_rod(item)) return true; - + // you can't unwield/fire a wielded cursed weapon/staff // but cursed armour and rings can be unwielded without problems return (!_is_true_equipped_item(item)); } - + // mummies can't do anything with food or potions if (you.species == SP_MUMMY) return (item.base_type != OBJ_POTIONS && item.base_type != OBJ_FOOD); @@ -1269,7 +1269,7 @@ static int _handle_mouse_motion(int mouse_x, int mouse_y, bool init) } else mode = convert_cursor_pos(mouse_x, mouse_y, &cx, &cy); - + if (oldcx == cx && oldcy == cy && oldmode == mode) return 0; // erase old cursor @@ -1540,8 +1540,8 @@ static int _handle_mouse_motion(int mouse_x, int mouse_y, bool init) return 0; } - if (mouse_mode == MOUSE_MODE_TARGET || - mouse_mode == MOUSE_MODE_TARGET_DIR) + if (mouse_mode == MOUSE_MODE_TARGET + || mouse_mode == MOUSE_MODE_TARGET_DIR) { if (mode == REGION_DNGN || mode == REGION_TDNGN) { @@ -1561,7 +1561,7 @@ static int _handle_mouse_motion(int mouse_x, int mouse_y, bool init) { if (mode == oldmode && oldcx == DCX && oldcy == DCY) update_tip_text(""); - + oldcx = cx; oldcy = cy; oldmode = mode; @@ -1584,7 +1584,7 @@ static int _handle_mouse_motion(int mouse_x, int mouse_y, bool init) desc += get_species_abbrev(you.species); desc += get_class_abbrev(you.char_class); desc += ")"; - + if (igrd[you.x_pos][you.y_pos] != NON_ITEM) desc += EOL "[L-Click] Pick up items (g)"; @@ -1607,13 +1607,9 @@ static int _handle_mouse_motion(int mouse_x, int mouse_y, bool init) if (mode == REGION_MAP && mouse_mode == MOUSE_MODE_COMMAND) { if (oldmode != REGION_MAP) - { update_tip_text("[L-Click] Travel / [R-Click] View"); - } else - { _tip_grid(cx - 1, cy - 1, false, 1); - } oldmode = mode; oldcx = cx; @@ -1626,12 +1622,13 @@ static int _handle_mouse_motion(int mouse_x, int mouse_y, bool init) { if (oldmode != REGION_MSG) update_tip_text("[L-Click] Browse message history"); + oldmode = mode; oldcx = cx; oldcy = cy; return 0; } - + if (mode == REGION_STAT && mouse_mode == MOUSE_MODE_COMMAND) { if (oldmode != REGION_STAT) @@ -1670,7 +1667,7 @@ static int _handle_mouse_button(int mx, int my, int button, trig = CK_MOUSE_B4; else if (button == 5) trig = CK_MOUSE_B5; - + if (shift) trig |= 512; if (ctrl) @@ -1696,7 +1693,7 @@ static int _handle_mouse_button(int mx, int my, int button, mode = convert_cursor_pos(mx, my, &cx, &cy); // prevent accidental wheel slip and subsequent char death - if (mouse_mode==MOUSE_MODE_COMMAND && (button == 4 || button == 5) + if (mouse_mode == MOUSE_MODE_COMMAND && (button == 4 || button == 5) && button == old_button && oldcx == cx && oldcy == cy) { if (!enable_wheel) @@ -1743,7 +1740,7 @@ static int _handle_mouse_button(int mx, int my, int button, } else _gui_set_mouse_inv(ix, INV_VIEW); - + TileMoveInvCursor(-1); return CK_MOUSE_B2ITEM; } @@ -1757,10 +1754,10 @@ static int _handle_mouse_button(int mx, int my, int button, _gui_set_mouse_inv(ix, INV_PICKUP); else _gui_set_mouse_inv(ix, INV_USE_FLOOR); - + return CK_MOUSE_B1ITEM; } - + // use item if (shift) _gui_set_mouse_inv(ix, INV_DROP); @@ -1768,7 +1765,7 @@ static int _handle_mouse_button(int mx, int my, int button, _gui_set_mouse_inv(ix, INV_USE2); else _gui_set_mouse_inv(ix, INV_USE); - + return CK_MOUSE_B1ITEM; } } @@ -1819,7 +1816,7 @@ static int _handle_mouse_button(int mx, int my, int button, if (you.religion != GOD_NO_GOD) return '^'; // religion screen } - + // trigger if (mouse_mode == MOUSE_MODE_MACRO) return trig; @@ -1850,9 +1847,9 @@ static int _handle_mouse_button(int mx, int my, int button, if (adir != -1) { - if (shift) + if (shift) return cmd_s[adir]; - else if (ctrl) + else if (ctrl) return cmd_c[adir]; else return cmd_n[dir]; @@ -1909,7 +1906,7 @@ static int _handle_mouse_button(int mx, int my, int button, { if (cx < DCX-1 || cy < DCY-1 || cx > DCX+1 || cy > DCY+1) return 0; - + for (dir = 0; dir < 9; dir++) { if (DCX + dx[dir] == cx && DCY + dy[dir] == cy) @@ -1983,10 +1980,10 @@ int getch() int keyin = getch_ck(); if (keyin >= CK_UP && keyin <= CK_CTRL_PGDN) return ck_tr[ keyin - CK_UP ]; - + if (keyin == CK_DELETE) return '.'; - + return keyin; } @@ -2077,7 +2074,7 @@ void clrscr() } if (region_item2) { - + if (region_lock[REGION_INV2]) region_item2->redraw(); else @@ -2372,10 +2369,10 @@ void puttext(int sx, int sy, int ex, int ey, unsigned char *buf, bool mono, for (xx = sx-1; xx <= ex-1; xx++) { *c = *ptr; - + if (*c == 0) *c = 32; - + ptr++; if (mono) *a = WHITE; @@ -2419,14 +2416,14 @@ void ViewTextFile(const char *name) while (nlines < MAXTEXTLINES) { fgets((char *)buf2, 82, fp); - + if (feof(fp)) break; - + i = 0; while (i < 79 && buf2[i] != 13 && buf2[i] != 10) i++; - + memcpy(&buf[nlines*80], buf2, i); nlines++; } diff --git a/crawl-ref/source/luadgn.cc b/crawl-ref/source/luadgn.cc index 005ad8fe8c..df3313876e 100644 --- a/crawl-ref/source/luadgn.cc +++ b/crawl-ref/source/luadgn.cc @@ -101,7 +101,7 @@ void dlua_chunk::write(writer& outf) const marshallByte(outf, CT_EMPTY); return; } - + if (!compiled.empty()) { marshallByte(outf, CT_COMPILED); @@ -112,7 +112,7 @@ void dlua_chunk::write(writer& outf) const marshallByte(outf, CT_SOURCE); marshallString4(outf, chunk); } - + marshallString4(outf, file); marshallLong(outf, first); } @@ -187,7 +187,7 @@ int dlua_chunk::load(CLua &interp) chunk.clear(); return (-1000); } - + int err = check_op( interp, interp.loadstring(chunk.c_str(), context.c_str()) ); if (err) @@ -356,7 +356,7 @@ static int dgn_depth_proc(lua_State *ls, depth_ranges &dr, int s) { PLUARET(string, dgn_depth_list_string(dr).c_str()); } - + if (lua_isnil(ls, s)) { dr.clear(); @@ -607,7 +607,7 @@ static int dgn_map_add_transform( } } - return (0); + return (0); } static int dgn_subst(lua_State *ls) @@ -681,12 +681,12 @@ static int dgn_map(lua_State *ls) } return (0); } - + const std::string newline = luaL_checkstring(ls, 3); if (which_line < 0) luaL_error(ls, make_stringf("Index %d out of range", which_line).c_str()); - + if (which_line < (int) lines.size()) { lines[which_line] = newline; @@ -857,7 +857,7 @@ static int dgn_map_pathfind(lua_State *ls, int minargs, (ls, make_stringf("Not enough points to test connectedness " "(need at least %d)", minargs / 2).c_str()); - + map_def::map_feature_finder feat_finder(*map); map_def::map_bounds_check bounds_checker(*map); map_flood_finder finder(feat_finder, bounds_checker); @@ -870,7 +870,7 @@ static int dgn_map_pathfind(lua_State *ls, int minargs, } const coord_def pos(luaL_checkint(ls, 2), luaL_checkint(ls, 3)); - PLUARET(boolean, (finder.*f)(pos)); + PLUARET(boolean, (finder.*f)(pos)); } static int dgn_points_connected(lua_State *ls) @@ -1144,7 +1144,7 @@ std::vector<std::string> dungeon_feature_matches(const std::string &name) const char *dungeon_feature_name(dungeon_feature_type rfeat) { const unsigned feat = rfeat; - + if (feat >= ARRAYSIZE(dngn_feature_names)) return (NULL); @@ -1183,7 +1183,7 @@ static const char *dgn_event_type_name(unsigned evmask) { if (evmask == 0) return (dgn_event_type_names[0]); - + for (unsigned i = 1; i < ARRAYSIZE(dgn_event_type_names); ++i) if (evmask & (1 << (i - 1))) return (dgn_event_type_names[i]); @@ -1695,10 +1695,10 @@ static const struct luaL_reg dgn_lib[] = { "kitem", dgn_kitem }, { "kmons", dgn_kmons }, { "kmask", dgn_kmask }, - + { "grid", dgn_grid }, { "max_bounds", dgn_max_bounds }, - + { "terrain_changed", dgn_terrain_changed }, { "points_connected", dgn_points_connected }, { "any_point_connected", dgn_any_point_connected }, @@ -1804,7 +1804,7 @@ static int file_marshall_meta(lua_State *ls) { if (lua_gettop(ls) != 2) luaL_error(ls, "Need two arguments: tag header and value"); - + writer &th(*static_cast<writer*>( lua_touserdata(ls, 1) )); lua_persist_type ptype = LPT_NONE; @@ -1924,7 +1924,7 @@ static const struct luaL_reg dgnevent_lib[] = { NULL, NULL } }; -static void luaopen_setmeta(lua_State *ls, +static void luaopen_setmeta(lua_State *ls, const char *global, const luaL_reg *lua_lib, const char *meta) @@ -1933,7 +1933,7 @@ static void luaopen_setmeta(lua_State *ls, lua_setglobal(ls, global); luaL_openlib(ls, global, lua_lib, 0); - + // Do <global>.__index = <global> lua_pushstring(ls, "__index"); lua_pushvalue(ls, -2); @@ -1976,16 +1976,16 @@ static void luaopen_mapmarker(lua_State *ls) void init_dungeon_lua() { lua_stack_cleaner clean(dlua); - + luaL_openlib(dlua, "dgn", dgn_lib, 0); // Add additional function to the Crawl module. luaL_openlib(dlua, "crawl", crawl_lib, 0); luaL_openlib(dlua, "file", file_lib, 0); luaL_openlib(dlua, "you", you_lib, 0); - + dlua.execfile("clua/dungeon.lua", true, true); dlua.execfile("clua/luamark.lua", true, true); - + lua_getglobal(dlua, "dgn_run_map"); luaopen_debug(dlua); luaL_newmetatable(dlua, MAP_METATABLE); diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc index c8c2795a80..bd12cfdad0 100644 --- a/crawl-ref/source/spl-book.cc +++ b/crawl-ref/source/spl-book.cc @@ -280,7 +280,7 @@ static spell_type spellbook_template_array[NUMBER_SPELLBOOKS][SPELLBOOK_SIZE] = SPELL_NO_SPELL, SPELL_NO_SPELL, }, - // 23 - Book of Necromancy + // 23 - Book of Necromancy {SPELL_PAIN, SPELL_ANIMATE_SKELETON, SPELL_VAMPIRIC_DRAINING, @@ -364,7 +364,7 @@ static spell_type spellbook_template_array[NUMBER_SPELLBOOKS][SPELLBOOK_SIZE] = SPELL_SILENCE, SPELL_DEFLECT_MISSILES, SPELL_LIGHTNING_BOLT, - SPELL_CONJURE_BALL_LIGHTNING, + SPELL_CONJURE_BALL_LIGHTNING, }, // 30 - Book of Divinations @@ -713,7 +713,7 @@ int spellbook_contents( item_def &book, read_book_action_type action, bool spell_skills = false; - for (i = SK_SPELLCASTING; i <= SK_POISON_MAGIC; i++) + for (i = SK_SPELLCASTING; i <= SK_POISON_MAGIC; i++) { if (you.skills[i]) { @@ -763,7 +763,7 @@ int spellbook_contents( item_def &book, read_book_action_type action, { if (knowsSpell) colour = LIGHTGREY; - else if (you.experience_level >= level_diff + else if (you.experience_level >= level_diff && spell_levels >= levels_req && spell_skills) { @@ -788,7 +788,7 @@ int spellbook_contents( item_def &book, read_book_action_type action, out.cprintf( "%s", spell_title(stype) ); out.cgotoxy( 35, -1 ); - + if (action == RBOOK_USE_STAFF) out.cprintf( "Evocations" ); else @@ -1142,10 +1142,10 @@ bool player_can_memorise(const item_def &book) { if (book.base_type != OBJ_BOOKS || book.sub_type == BOOK_MANUAL) return false; - + if (!player_spell_levels()) return false; - + for (int j = 0; j < SPELLBOOK_SIZE; j++) { const spell_type stype = which_spell_in_book(book.book_number(), j); @@ -1174,7 +1174,7 @@ bool player_can_memorise(const item_def &book) } return false; } - + bool learn_spell(int book) { int chance = 0; @@ -1210,7 +1210,7 @@ bool learn_spell(int book) if (book < 0) book = which_spellbook(); - + if (book < 0) // still -1? return (false); @@ -1326,7 +1326,7 @@ bool learn_spell(int book) if (you.inv[ book ].sub_type == BOOK_NECRONOMICON) { mpr("The pages of the Necronomicon glow with a dark malevolence..."); - miscast_effect( SPTYP_NECROMANCY, 8, random2avg(88, 3), 100, + miscast_effect( SPTYP_NECROMANCY, 8, random2avg(88, 3), 100, "reading the Necronomicon" ); } else if (you.inv[ book ].sub_type == BOOK_DEMONOLOGY) @@ -1347,7 +1347,7 @@ bool learn_spell(int book) return (false); else if (!yesno("Memorise anyway?")) return (false); -#else +#else return (false); #endif } @@ -1364,7 +1364,7 @@ int count_staff_spells(const item_def &item, bool need_id) { if (item.base_type != OBJ_STAVES) return (-1); - + if (need_id && !item_type_known(item)) return (0); @@ -1400,12 +1400,12 @@ int rod_shield_leakage() int staff_spell( int staff ) { item_def& istaff(you.inv[staff]); - // Spell staves are mostly for the benefit of non-spellcasters, so we're + // Spell staves are mostly for the benefit of non-spellcasters, so we're // not going to involve INT or Spellcasting skills for power. -- bwr - int powc = (5 + you.skills[SK_EVOCATIONS] + int powc = (5 + you.skills[SK_EVOCATIONS] + roll_dice( 2, you.skills[SK_EVOCATIONS] )) * 100 - / rod_shield_leakage(); + / rod_shield_leakage(); if (!item_is_rod(istaff)) { @@ -1451,7 +1451,7 @@ int staff_spell( int staff ) // Note that auto_list is ignored here. keyin = get_ch(); - + if (keyin == '?' || keyin == '*') { keyin = read_book( you.inv[staff], RBOOK_USE_STAFF ); @@ -1495,14 +1495,14 @@ int staff_spell( int staff ) if (food < diff * 5) food = diff * 5; } - + if (food && (you.hunger_state <= HS_STARVING || you.hunger <= food)) { mpr("You don't have the energy to cast that spell."); crawl_state.zero_turns_taken(); return (-1); } - + if (istaff.plus < mana) { mpr("The rod doesn't have enough magic points."); @@ -1519,7 +1519,7 @@ int staff_spell( int staff ) { mpr("Something interferes with your magic!"); } - // All checks passed, we can cast the spell + // All checks passed, we can cast the spell else if (your_spells(spell, powc, false) == SPRET_ABORT) { crawl_state.zero_turns_taken(); diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc index cb008c08fd..d414c19c58 100644 --- a/crawl-ref/source/terrain.cc +++ b/crawl-ref/source/terrain.cc @@ -108,7 +108,7 @@ command_type grid_stair_direction(dungeon_feature_type grid) case DNGN_EXIT_HELL: case DNGN_EXIT_PORTAL_VAULT: return (CMD_GO_UPSTAIRS); - + case DNGN_ENTER_PORTAL_VAULT: case DNGN_ENTER_HELL: case DNGN_ENTER_LABYRINTH: @@ -143,7 +143,7 @@ command_type grid_stair_direction(dungeon_feature_type grid) case DNGN_ENTER_RESERVED_3: case DNGN_ENTER_RESERVED_4: return (CMD_GO_DOWNSTAIRS); - + default: return (CMD_NO_CMD); } @@ -282,7 +282,7 @@ dungeon_feature_type grid_secret_door_appearance( int gx, int gy ) } } - return ((ret == DNGN_FLOOR) ? DNGN_ROCK_WALL + return ((ret == DNGN_FLOOR) ? DNGN_ROCK_WALL : ret); } @@ -299,7 +299,7 @@ static coord_def dgn_find_nearest_square( bool (*traversable)(const coord_def &) = NULL) { memset(travel_point_distance, 0, sizeof(travel_distance_grid_t)); - + std::list<coord_def> points[2]; int iter = 0; points[iter].push_back(pos); @@ -313,7 +313,7 @@ static coord_def dgn_find_nearest_square( if (p != pos && acceptable(p)) return (p); - + travel_point_distance[p.x][p.y] = 1; for (int yi = -1; yi <= 1; ++yi) { @@ -328,7 +328,7 @@ static coord_def dgn_find_nearest_square( if (traversable && !traversable(np)) continue; - + points[!iter].push_back(np); } } @@ -377,7 +377,7 @@ static bool dgn_shift_feature(const coord_def &pos) const dungeon_feature_type dfeat = grd(pos); if (!is_critical_feature(dfeat) && !env.markers.find(pos, MAT_ANY)) return (false); - + const coord_def dest = dgn_find_nearest_square(pos, is_feature_shift_target); if (in_bounds(dest) && dest != pos) @@ -450,13 +450,14 @@ void dungeon_terrain_changed(const coord_def &pos, { if (preserve_features) dgn_shift_feature(pos); + unnotice_feature(level_pos(level_id::current(), pos)); grd(pos) = nfeat; env.grid_colours(pos) = BLACK; if (is_notable_terrain(nfeat) && see_grid(pos)) seen_notable_thing(nfeat, pos.x, pos.y); } - + dgn_check_terrain_items(pos, preserve_items); if (affect_player && pos == you.pos()) { @@ -472,7 +473,7 @@ void dungeon_terrain_changed(const coord_def &pos, } // returns true if we manage to scramble free. -bool fall_into_a_pool( int entry_x, int entry_y, bool allow_shift, +bool fall_into_a_pool( int entry_x, int entry_y, bool allow_shift, unsigned char terrain ) { bool escape = false; @@ -484,7 +485,7 @@ bool fall_into_a_pool( int entry_x, int entry_y, bool allow_shift, merfolk_start_swimming(); return (false); } - + // sanity check if (terrain != DNGN_LAVA && beogh_water_walk()) return (false); @@ -522,7 +523,7 @@ bool fall_into_a_pool( int entry_x, int entry_y, bool allow_shift, { if (allow_shift) { - if (empty_surrounds( you.x_pos, you.y_pos, DNGN_FLOOR, 1, + if (empty_surrounds( you.x_pos, you.y_pos, DNGN_FLOOR, 1, false, empty )) { escape = true; |