From 3719e3c8c35ad7bd924373512c25ce7828d62a03 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Fri, 13 Apr 2007 14:08:38 +0000 Subject: Fixed bad grammar on shield block messages in melee. Split up Abyss/Pan/Labyrinth save files. The only practical use right now is to be able to correctly place Abyss and Pan ghosts. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1295 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/Kills.cc | 27 +++++++++++++------- crawl-ref/source/Kills.h | 3 ++- crawl-ref/source/debug.cc | 4 +-- crawl-ref/source/externs.h | 7 ++--- crawl-ref/source/fight.cc | 4 +-- crawl-ref/source/files.cc | 61 +++++++++++++++++++++++++------------------- crawl-ref/source/files.h | 8 +++--- crawl-ref/source/ghost.cc | 10 ++++++++ crawl-ref/source/misc.cc | 32 ++++++++--------------- crawl-ref/source/mon-util.cc | 22 ++++++++++------ crawl-ref/source/mtransit.cc | 4 +-- crawl-ref/source/mtransit.h | 4 +-- crawl-ref/source/ouch.cc | 10 +++++--- crawl-ref/source/player.cc | 1 + crawl-ref/source/spells3.cc | 3 +++ crawl-ref/source/spl-cast.cc | 8 +++--- crawl-ref/source/tags.cc | 4 +-- 17 files changed, 122 insertions(+), 90 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/Kills.cc b/crawl-ref/source/Kills.cc index 8a85e04921..8f16ef81cc 100644 --- a/crawl-ref/source/Kills.cc +++ b/crawl-ref/source/Kills.cc @@ -347,7 +347,16 @@ static bool ends_with(const std::string &s, const char *suffixes[]) return false; } -// For monster names ending with these suffixes, we pluralize directly without +std::string apostrophise(const std::string &name) +{ + if (name.empty()) + return (name); + + const char lastc = name[ name.length() - 1 ]; + return (name + (lastc == 's' || lastc == 'x'? "'" : "'s")); +} + +// For monster names ending with these suffixes, we pluralise directly without // attempting to use the "of" rule. For instance: // // moth of wrath => moths of wrath but @@ -361,18 +370,18 @@ static const char *modifier_suffixes[] = "zombie", "skeleton", "simulacrum", NULL, }; -// Pluralizes a monster name. This'll need to be updated for correctness +// Pluralises a monster name. This'll need to be updated for correctness // whenever new monsters are added. -std::string pluralize(const std::string &name, +std::string pluralise(const std::string &name, const char *no_of[]) { std::string::size_type pos; - // Pluralize first word of names like 'eye of draining', but only if the + // Pluralise first word of names like 'eye of draining', but only if the // whole name is not suffixed by a modifier, such as 'zombie' or 'skeleton' if ( (pos = name.find(" of ")) != std::string::npos && !ends_with(name, no_of) ) - return pluralize(name.substr(0, pos)) + name.substr(pos); + return pluralise(name.substr(0, pos)) + name.substr(pos); else if (ends_with(name, "us")) // Fungus, ufetubus, for instance. return name.substr(0, name.length() - 2) + "i"; @@ -428,14 +437,14 @@ static std::string article_a(const std::string &name) } // For a non-unique monster, prefixes a suitable article if we have only one -// kill, else prefixes a kill count and pluralizes the monster name. +// kill, else prefixes a kill count and pluralises the monster name. static std::string n_names(const std::string &name, int n) { if (n > 1) { char buf[20]; snprintf(buf, sizeof buf, "%d ", n); - return buf + pluralize(name, modifier_suffixes); + return buf + pluralise(name, modifier_suffixes); } else return article_a(name); @@ -545,11 +554,11 @@ std::string kill_def::info(const kill_monster_desc &md) const if (!mons_is_unique(md.monnum)) { - // Pluralize as needed + // Pluralise as needed name = n_names(name, kills); // We brand shapeshifters with the (shapeshifter) qualifier. This - // has to be done after doing pluralize(), else we get very odd plurals + // has to be done after doing pluralise(), else we get very odd plurals // :) if (md.modifier == kill_monster_desc::M_SHAPESHIFTER && md.monnum != MONS_SHAPESHIFTER && diff --git a/crawl-ref/source/Kills.h b/crawl-ref/source/Kills.h index 625b145cba..81f82be2f5 100644 --- a/crawl-ref/source/Kills.h +++ b/crawl-ref/source/Kills.h @@ -12,8 +12,9 @@ #include #include "enum.h" -std::string pluralize(const std::string &name, +std::string pluralise(const std::string &name, const char *no_of[] = NULL); +std::string apostrophise(const std::string &name); struct monsters; diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index 419ac7e4df..5423c874f9 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -425,11 +425,11 @@ static void wizard_go_to_level(const level_pos &pos) : DNGN_STONE_STAIRS_UP_I; const int old_level = you.your_level; - const int old_where = you.where_are_you; + const branch_type old_where = you.where_are_you; const bool was_a_labyrinth = you.level_type == LEVEL_LABYRINTH; you.level_type = LEVEL_DUNGEON; - you.where_are_you = pos.id.branch; + you.where_are_you = static_cast(pos.id.branch); you.your_level = abs_depth; load(stair_taken, LOAD_ENTER_LEVEL, was_a_labyrinth, old_level, old_where); diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index ce8360b751..cdce5fee23 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -646,9 +646,9 @@ public: KillMaster kills; - char level_type; + level_area_type level_type; - char where_are_you; + branch_type where_are_you; FixedVector branch_stairs; @@ -941,7 +941,7 @@ public: void timeout_enchantments(int levels); bool needs_transit() const; - void set_transit(level_id destination); + void set_transit(const level_id &destination); bool find_place_to_live(bool near_player = false); bool find_place_near_player(); bool find_home_in(coord_def s, coord_def e); @@ -1145,6 +1145,7 @@ private: static int n_extra_ghosts(); static void find_extra_ghosts(std::vector &ghosts, int n); static void find_transiting_ghosts(std::vector &gs, int n); + static void announce_ghost(const ghost_demon &g); private: void add_spells(); diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index d1cf453c6a..a9856708f4 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -2513,7 +2513,7 @@ bool melee_attack::attack_shield_blocked(bool verbose) mprf("%s %s %s attack.", def_name(DESC_CAP_THE).c_str(), defender->conj_verb("block").c_str(), - atk_name(DESC_NOCAP_YOUR).c_str()); + atk_name(DESC_NOCAP_ITS).c_str()); defender->shield_block_succeeded(); @@ -2862,7 +2862,7 @@ void melee_attack::mons_apply_attack_flavour(const mon_attack_def &attk) mprf("%s %s strength from %s injuries!", atk_name(DESC_CAP_THE).c_str(), attacker->conj_verb("draw").c_str(), - def_name(DESC_NOCAP_YOUR).c_str()); + def_name(DESC_NOCAP_ITS).c_str()); } // 4.1.2 actually drains max hp; we're being nicer and just doing diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index df241e835c..d8753231ef 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -86,7 +86,8 @@ #define DO_CHMOD_PRIVATE(x) // empty command #endif -void save_level(int level_saved, bool was_a_labyrinth, char where_were_you); +void save_level(int level_saved, level_area_type lt, + branch_type where_were_you); #define GHOST_MINOR_VERSION 1 #define LEVEL_MINOR_VERSION 1 @@ -467,16 +468,27 @@ std::string get_prefs_filename() return get_savedir_filename("start", "ns", "prf"); } +static std::string get_level_suffix(int level, int where, level_area_type lt) +{ + switch (lt) + { + default: + case LEVEL_DUNGEON: + return (make_stringf("%02d%c", level, where + 'a')); + case LEVEL_LABYRINTH: + return ("lab"); + case LEVEL_ABYSS: + return ("abs"); + case LEVEL_PANDEMONIUM: + return ("pan"); + } +} + std::string make_filename( const char *prefix, int level, int where, - bool isLabyrinth, bool isGhost ) + level_area_type ltype, bool isGhost ) { - char suffix[4], lvl[5]; - strcpy(suffix, (level < 10) ? "0" : ""); - itoa(level, lvl, 10); - strcat(suffix, lvl); - suffix[2] = where + 97; - suffix[3] = 0; - return get_savedir_filename( prefix, "", isLabyrinth ? "lab" : suffix, + return get_savedir_filename( prefix, "", + get_level_suffix(level, where, ltype), isGhost ); } @@ -512,7 +524,7 @@ bool travel_load_map( char branch, int absdepth ) { // Try to open level savefile. FILE *levelFile = fopen(make_filename(you.your_name, absdepth, branch, - false, false).c_str(), "rb"); + LEVEL_DUNGEON, false).c_str(), "rb"); if (!levelFile) return false; @@ -536,8 +548,8 @@ bool travel_load_map( char branch, int absdepth ) return true; } -void load( unsigned char stair_taken, int load_mode, bool was_a_labyrinth, - char old_level, char where_were_you2 ) +void load( int stair_taken, int load_mode, bool was_a_labyrinth, + int old_level, branch_type where_were_you2 ) { int j = 0; int i = 0, count_x = 0, count_y = 0; @@ -550,7 +562,7 @@ void load( unsigned char stair_taken, int load_mode, bool was_a_labyrinth, std::string cha_fil = make_filename( you.your_name, you.your_level, you.where_are_you, - you.level_type != LEVEL_DUNGEON, + you.level_type, false ); if (you.level_type == LEVEL_DUNGEON) @@ -605,9 +617,7 @@ void load( unsigned char stair_taken, int load_mode, bool was_a_labyrinth, continue; #if DEBUG_DIAGNOSTICS - snprintf( info, INFO_SIZE, "%s is following.", - ptr_monam( fmenv, DESC_CAP_THE ) ); - mpr( info, MSGCH_DIAGNOSTICS ); + mprf( "%s is following.", ptr_monam( fmenv, DESC_CAP_THE ) ); #endif follower f(*fmenv); @@ -618,7 +628,7 @@ void load( unsigned char stair_taken, int load_mode, bool was_a_labyrinth, } // end of grabbing followers if (!was_a_labyrinth) - save_level( old_level, false, where_were_you2 ); + save_level( old_level, LEVEL_DUNGEON, where_were_you2 ); was_a_labyrinth = false; } @@ -632,7 +642,7 @@ void load( unsigned char stair_taken, int load_mode, bool was_a_labyrinth, builder( you.your_level, you.level_type ); just_created_level = true; - if (you.your_level > 1 + if ((you.your_level > 1 || you.level_type != LEVEL_DUNGEON) && one_chance_in(3) && you.level_type != LEVEL_LABYRINTH) { @@ -951,16 +961,16 @@ found_stair: } // Save the created/updated level out to disk: - save_level( you.your_level, (you.level_type != LEVEL_DUNGEON), - you.where_are_you ); + save_level( you.your_level, you.level_type, you.where_are_you ); setup_environment_effects(); } // end load() -void save_level(int level_saved, bool was_a_labyrinth, char where_were_you) +void save_level(int level_saved, level_area_type old_ltype, + branch_type where_were_you) { std::string cha_fil = make_filename( you.your_name, level_saved, - where_were_you, was_a_labyrinth, + where_were_you, old_ltype, false ); you.prev_targ = MHITNOT; @@ -1059,8 +1069,7 @@ void save_game(bool leave_game) return; // must be exiting -- save level & goodbye! - save_level(you.your_level, (you.level_type != LEVEL_DUNGEON), - you.where_are_you); + save_level(you.your_level, you.level_type, you.where_are_you); clrscr(); @@ -1099,7 +1108,7 @@ void load_ghost(void) std::string cha_fil = make_filename("bones", you.your_level, you.where_are_you, - (you.level_type != LEVEL_DUNGEON), + you.level_type, true ); FILE *gfile = fopen(cha_fil.c_str(), "rb"); @@ -1386,7 +1395,7 @@ void save_ghost( bool force ) std::string cha_fil = make_filename( "bones", you.your_level, you.where_are_you, - (you.level_type != LEVEL_DUNGEON), + you.level_type, true ); FILE *gfile = fopen(cha_fil.c_str(), "rb"); diff --git a/crawl-ref/source/files.h b/crawl-ref/source/files.h index ff0af7c108..814c25b1eb 100644 --- a/crawl-ref/source/files.h +++ b/crawl-ref/source/files.h @@ -43,8 +43,8 @@ std::string get_savedir_filename(const std::string &pre, std::string get_prefs_filename(); -void load( unsigned char stair_taken, int load_mode, bool was_a_labyrinth, - char old_level, char where_were_you2 ); +void load( int stair_taken, int load_mode, bool was_a_labyrinth, + int old_level, branch_type where_were_you2 ); // last updated 12may2000 {dlb} /* *********************************************************************** @@ -72,8 +72,8 @@ void save_ghost( bool force = false ); /* *********************************************************************** * called from: files hiscores * *********************************************************************** */ -std::string make_filename( const char *prefix, int level, int where, - bool isLabyrinth, bool isGhost ); +std::string make_filename( const char *prefix, int level, int branch, + level_area_type lt, bool isGhost ); void writeShort(FILE *file, short s); diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc index 5216cc4352..d09f1484ac 100644 --- a/crawl-ref/source/ghost.cc +++ b/crawl-ref/source/ghost.cc @@ -453,6 +453,7 @@ std::vector ghost_demon::find_ghosts() ghost_demon player; player.init_player_ghost(); + announce_ghost(player); gs.push_back(player); find_extra_ghosts( gs, n_extra_ghosts() ); @@ -477,6 +478,7 @@ void ghost_demon::find_transiting_ghosts( const monsters &m = i->mons; if (m.ghost.get()) { + announce_ghost(*m.ghost); gs.push_back(*m.ghost); --n; } @@ -485,6 +487,13 @@ void ghost_demon::find_transiting_ghosts( } } +void ghost_demon::announce_ghost(const ghost_demon &g) +{ +#ifdef DEBUG_DIAGNOSTICS + mprf(MSGCH_DIAGNOSTICS, "Saving ghost: %s", g.name.c_str()); +#endif +} + void ghost_demon::find_extra_ghosts( std::vector &gs, int n ) { for (int i = 0; n > 0 && i < MAX_MONSTERS; ++i) @@ -495,6 +504,7 @@ void ghost_demon::find_extra_ghosts( std::vector &gs, int n ) if (menv[i].type == MONS_PLAYER_GHOST && menv[i].ghost.get()) { // Bingo! + announce_ghost(*menv[i].ghost); gs.push_back( *menv[i].ghost ); --n; } diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 922b5a15ce..09daf676ca 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -520,9 +520,9 @@ void merfolk_start_swimming(void) void up_stairs(void) { - unsigned char stair_find = grd[you.x_pos][you.y_pos]; - char old_where = you.where_are_you; - bool was_a_labyrinth = false; + int stair_find = grd[you.x_pos][you.y_pos]; + const branch_type old_where = you.where_are_you; + const bool was_a_labyrinth = you.level_type != LEVEL_DUNGEON; if (stair_find == DNGN_ENTER_SHOP) { @@ -571,7 +571,7 @@ void up_stairs(void) return; } - unsigned char old_level = you.your_level; + int old_level = you.your_level; // Interlevel travel data: bool collect_travel_data = you.level_type != LEVEL_LABYRINTH @@ -588,10 +588,7 @@ void up_stairs(void) // in the abyss or pandemonium a bit trouble (well the labyrinth does // provide a way out of those places, its really not that bad I suppose) if (you.level_type == LEVEL_LABYRINTH) - { you.level_type = LEVEL_DUNGEON; - was_a_labyrinth = true; - } you.your_level--; @@ -733,12 +730,12 @@ void down_stairs( bool remove_stairs, int old_level, int force_stair ) { int i; char old_level_type = you.level_type; - bool was_a_labyrinth = false; + const bool was_a_labyrinth = you.level_type != LEVEL_DUNGEON; const int stair_find = force_stair? force_stair : grd[you.x_pos][you.y_pos]; bool leave_abyss_pan = false; - char old_where = you.where_are_you; + branch_type old_where = you.where_are_you; #ifdef SHUT_LABYRINTH if (stair_find == DNGN_ENTER_LABYRINTH) @@ -851,16 +848,10 @@ void down_stairs( bool remove_stairs, int old_level, int force_stair ) if (you.level_type == LEVEL_ABYSS) save_abyss_uniques(); - if (you.level_type == LEVEL_PANDEMONIUM - && stair_find == DNGN_TRANSIT_PANDEMONIUM) - { - was_a_labyrinth = true; - } - else + if (you.level_type != LEVEL_DUNGEON + && (you.level_type != LEVEL_PANDEMONIUM + || stair_find != DNGN_TRANSIT_PANDEMONIUM)) { - if (you.level_type != LEVEL_DUNGEON) - was_a_labyrinth = true; - you.level_type = LEVEL_DUNGEON; } @@ -923,10 +914,9 @@ void down_stairs( bool remove_stairs, int old_level, int force_stair ) { std::string lname = make_filename(you.your_name, you.your_level, you.where_are_you, - true, false ); + you.level_type, false ); #if DEBUG_DIAGNOSTICS - snprintf( info, INFO_SIZE, "Deleting: %s", lname.c_str() ); - mpr( info, MSGCH_DIAGNOSTICS ); + mprf( MSGCH_DIAGNOSTICS, "Deleting: %s", lname.c_str() ); #endif unlink(lname.c_str()); } diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index dd52595fbe..5c06518fd0 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -63,13 +63,13 @@ enum habitat_type }; static bool initialized_randmons = false; -static std::vector monsters_by_habitat[NUM_HABITATS]; +static std::vector monsters_by_habitat[NUM_HABITATS]; static struct monsterentry mondata[] = { #include "mon-data.h" }; -#define MONDATASIZE (sizeof(mondata)/sizeof(struct monsterentry)) +#define MONDATASIZE (sizeof(mondata)/sizeof(monsterentry)) static int mspell_list[][7] = { #include "mon-spll.h" @@ -125,7 +125,7 @@ static void initialize_randmons() if (invalid_monster_class(m)) continue; if (monster_habitable_grid(m, grid)) - monsters_by_habitat[i].push_back(m); + monsters_by_habitat[i].push_back(static_cast(m)); } } initialized_randmons = true; @@ -142,10 +142,10 @@ monster_type random_monster_at_grid(int grid) initialize_randmons(); const habitat_type ht = grid2habitat(grid); - const std::vector &valid_mons = monsters_by_habitat[ht]; + const std::vector &valid_mons = monsters_by_habitat[ht]; ASSERT(!valid_mons.empty()); return valid_mons.empty()? MONS_PROGRAM_BUG - : monster_type(valid_mons[ random2(valid_mons.size()) ]); + : valid_mons[ random2(valid_mons.size()) ]; } monster_type get_monster_by_name(std::string name, bool exact) @@ -2389,7 +2389,13 @@ item_def *monsters::shield() std::string monsters::name(description_level_type desc) const { - return (ptr_monam(this, desc)); + const bool possessive = + (desc == DESC_NOCAP_YOUR || desc == DESC_NOCAP_ITS); + + if (possessive) + desc = DESC_NOCAP_THE; + std::string mname = ptr_monam(this, desc); + return (possessive? apostrophise(mname) : mname); } std::string monsters::name(description_level_type desc, bool force_vis) const @@ -2415,7 +2421,7 @@ std::string monsters::conj_verb(const std::string &verb) const if (verb == "are") return ("is"); - return (pluralize(verb)); + return (pluralise(verb)); } int monsters::id() const @@ -2855,7 +2861,7 @@ bool monsters::needs_transit() const && !mons_is_summoned(this)); } -void monsters::set_transit(level_id dest) +void monsters::set_transit(const level_id &dest) { add_monster_to_transit(dest, *this); } diff --git a/crawl-ref/source/mtransit.cc b/crawl-ref/source/mtransit.cc index 5ceb91449b..05f43bc543 100644 --- a/crawl-ref/source/mtransit.cc +++ b/crawl-ref/source/mtransit.cc @@ -40,13 +40,13 @@ static void cull_lost(m_transit_list &mlist, int how_many) mlist.erase( mlist.begin() ); } -m_transit_list *get_transit_list(level_id lid) +m_transit_list *get_transit_list(const level_id &lid) { monsters_in_transit::iterator i = the_lost_ones.find(lid); return (i != the_lost_ones.end()? &i->second : NULL); } -void add_monster_to_transit(level_id lid, const monsters &m) +void add_monster_to_transit(const level_id &lid, const monsters &m) { m_transit_list &mlist = the_lost_ones[lid]; mlist.push_back(m); diff --git a/crawl-ref/source/mtransit.h b/crawl-ref/source/mtransit.h index a660d73645..194ba01eef 100644 --- a/crawl-ref/source/mtransit.h +++ b/crawl-ref/source/mtransit.h @@ -31,8 +31,8 @@ typedef std::map monsters_in_transit; extern monsters_in_transit the_lost_ones; -m_transit_list *get_transit_list(level_id where); -void add_monster_to_transit(level_id dest, const monsters &m); +m_transit_list *get_transit_list(const level_id &where); +void add_monster_to_transit(const level_id &dest, const monsters &m); // Places (some of the) monsters eligible to be placed on this level. void place_transiting_monsters(); diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index 03d8c2e21c..db94e5d87e 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -857,13 +857,17 @@ void end_game( struct scorefile_entry &se ) if (tmp_file_pairs[level][dungeon]) { unlink(make_filename( you.your_name, level, dungeon, - false, false ).c_str()); + LEVEL_DUNGEON, false ).c_str()); } } } - // temp level, if any - unlink( make_filename( you.your_name, 0, 0, true, false ).c_str() ); + // temp levels, if any + unlink( make_filename( you.your_name, 0, 0, LEVEL_ABYSS, false ).c_str() ); + unlink( make_filename( you.your_name, 0, 0, + LEVEL_PANDEMONIUM, false ).c_str() ); + unlink( make_filename( you.your_name, 0, 0, + LEVEL_LABYRINTH, false ).c_str() ); // create base file name std::string basename = get_savedir_filename( you.your_name, "", "" ); diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 89ec76be60..2918e42053 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -74,6 +74,7 @@ std::string pronoun_you(description_level_type desc) case DESC_CAP_YOUR: return "Your"; case DESC_NOCAP_YOUR: + case DESC_NOCAP_ITS: return "your"; } } diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index d63c7b3c55..6611421703 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -556,6 +556,9 @@ bool allow_control_teleport( bool silent ) ret = false; } break; + + default: + break; } } diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 20616b4801..76ea339b12 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -957,14 +957,12 @@ spret_type your_spells( spell_type spc2, int powc, bool allow_fail ) int nastiness = spell_mana(spc2) * spell_mana(spc2) * (spell_fail(spc2) - spfl) + 250; - int cont_points = nastiness / 500; - // handle fraction - if (random2(500) < (nastiness % 500)) - cont_points++; + 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(spc2), + spell_fail(spc2) - spfl, 100 ); if (you.religion == GOD_XOM && random2(75) < spell_mana(spc2)) Xom_acts(coinflip(), spell_mana(spc2), false); diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index 173f94cee6..1c75c8a4b2 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -998,14 +998,14 @@ static void tag_read_you(struct tagHeader &th, char minorVersion) you.pet_target = unmarshallByte(th); you.max_level = unmarshallByte(th); - you.where_are_you = unmarshallByte(th); + you.where_are_you = static_cast( unmarshallByte(th) ); you.char_direction = unmarshallByte(th); you.your_level = unmarshallByte(th); you.is_undead = unmarshallByte(th); you.special_wield = unmarshallByte(th); you.berserker = unmarshallByte(th); you.berserk_penalty = unmarshallByte(th); - you.level_type = unmarshallByte(th); + you.level_type = static_cast( unmarshallByte(th) ); you.synch_time = unmarshallByte(th); you.disease = unmarshallByte(th); you.species = unmarshallByte(th); -- cgit v1.2.3-54-g00ecf