From 1dee477edbd887705ee489f960b92aa7de9e7afd Mon Sep 17 00:00:00 2001 From: dshaligram Date: Tue, 25 Sep 2007 18:12:02 +0000 Subject: * Fixed Vault:8 level being generated with no rune (cbus). * Dropped odds of statue vault. * Take note of messages received in dgamelaunch chat. * crawl -vscores, etc. should not attempt to create save/morgue directories (Marc). * Changed wording of "Foo wielding bar comes into view" to "Foo comes into view. It is wielding bar.". * Suppress curse status display of monster items. * TSO worshippers are no longer warned when stabbing monsters if TSO doesn't object to stabbing those monsters. * Wand zap status is now {zapped: N} instead of {zapped N times} to reduce verbosity. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2204 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 12 +++++++++++- crawl-ref/source/dat/mini.des | 2 ++ crawl-ref/source/dat/vaults.des | 2 +- crawl-ref/source/delay.cc | 18 +++++++++++++----- crawl-ref/source/direct.cc | 20 ++++++++++++-------- crawl-ref/source/direct.h | 4 +++- crawl-ref/source/enum.h | 4 +++- crawl-ref/source/externs.h | 4 +++- crawl-ref/source/fight.cc | 15 ++++++++------- crawl-ref/source/initfile.cc | 4 +--- crawl-ref/source/itemname.cc | 6 ++++-- crawl-ref/source/libutil.cc | 4 +++- crawl-ref/source/mon-util.cc | 9 +++++++-- crawl-ref/source/player.cc | 2 ++ crawl-ref/source/religion.cc | 7 +++++++ crawl-ref/source/religion.h | 3 +++ crawl-ref/source/view.cc | 2 +- 17 files changed, 84 insertions(+), 34 deletions(-) diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 2c0801e494..1419e6348b 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -2785,12 +2785,19 @@ static void show_message_line(std::string line) mpr(line.c_str()); else { + take_note(Note( NOTE_MESSAGE, MSGCH_PLAIN, 0, line.c_str() )); + std::string sender = line.substr(0, sender_pos); line = line.substr(sender_pos + 1); trim_string(line); // XXX: Eventually fix mpr so it can do a different colour for // the sender. - mprf("%s: %s", sender.c_str(), line.c_str()); + formatted_string fs; + fs.textcolor(WHITE); + fs.cprintf("%s: ", sender.c_str()); + fs.textcolor(LIGHTGREY); + fs.cprintf("%s", line.c_str()); + formatted_mpr(fs, MSGCH_PLAIN, 0); } } @@ -3289,6 +3296,8 @@ static void close_door(int door_x, int door_y) // returns true if a new character static bool initialise(void) { + Options.fixup_options(); + you.symbol = '@'; you.colour = LIGHTGREY; @@ -3407,6 +3416,7 @@ static bool initialise(void) clua.runhook("chk_startgame", "b", newc); std::string yname = you.your_name; read_init_file(true); + Options.fixup_options(); strncpy(you.your_name, yname.c_str(), kNameLen); you.your_name[kNameLen - 1] = 0; diff --git a/crawl-ref/source/dat/mini.des b/crawl-ref/source/dat/mini.des index 7b61b7d847..267a4f1a6a 100644 --- a/crawl-ref/source/dat/mini.des +++ b/crawl-ref/source/dat/mini.des @@ -367,6 +367,8 @@ ENDMAP # Greed's colour NAME: david_greed +TAGS: uniq +CHANCE: 4 DEPTH: 10-26, !Orc, !Lair, !Swamp, !Shoal ITEM: nothing / any good_item MONS: silver statue / orange crystal statue / ice statue diff --git a/crawl-ref/source/dat/vaults.des b/crawl-ref/source/dat/vaults.des index 361e6fe30e..d2325e89a4 100644 --- a/crawl-ref/source/dat/vaults.des +++ b/crawl-ref/source/dat/vaults.des @@ -190,7 +190,7 @@ KMONS: O = 8 / 9 / w:80 nothing NSUBST: O = O / o KITEM: o = any good_item KFEAT: o = w:120 . / any shop -KFEAT: O = . + # # NW SHUFFLE: AC/BD, EG/FH, IKN/NJL, '" diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index e0252c502b..941d82d223 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -1035,20 +1035,28 @@ inline static void monster_warning(activity_interrupt_type ai, mon->name(DESC_CAP_THE).c_str()); break; case 2: - mprf(MSGCH_WARN, "You feel that %s is too close now for comfort.", + mprf(MSGCH_WARN, + "You feel that %s is too close now for comfort.", mon->name(DESC_NOCAP_THE).c_str()); break; default: - mprf(MSGCH_WARN, "%s's presence makes you stop your activity.", + mprf(MSGCH_WARN, + "%s's presence makes you stop your activity.", mon->name(DESC_CAP_THE).c_str()); break; } } else { - std::string text = get_monster_desc(mon, false); - text += " comes into view."; - print_formatted_paragraph(text, get_number_of_cols(), MSGCH_WARN); + const std::string mweap = + get_monster_desc(mon, false, DESC_NONE); + std::string text = mon->name(DESC_CAP_A) + " comes into view."; + if (!mweap.empty()) + text += " " + mon->pronoun(PRONOUN_CAP) + + " is" + mweap + "."; + print_formatted_paragraph(text, + get_number_of_cols(), + MSGCH_WARN); } } diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index 07d0da5cd3..fb2884c267 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -1444,6 +1444,8 @@ static std::string feature_do_grammar(description_level_type dtype, return article_a(desc, false); case DESC_NOCAP_A: return article_a(desc, true); + case DESC_NONE: + return (""); default: return (desc); } @@ -1775,11 +1777,13 @@ static std::string describe_monster_weapon(const monsters *mons) std::string name1, name2; const item_def *weap = mons->mslot_item(MSLOT_WEAPON); const item_def *alt = mons->mslot_item(MSLOT_ALT_WEAPON); - + if (weap) - name1 = weap->name(DESC_NOCAP_A); + name1 = weap->name(DESC_NOCAP_A, false, false, true, + false, ISFLAG_KNOW_CURSE); if (alt && (!weap || mons_wields_two_weapons(mons))) - name2 = alt->name(DESC_NOCAP_A); + name2 = alt->name(DESC_NOCAP_A, false, false, true, + false, ISFLAG_KNOW_CURSE); if (name1.empty() && !name2.empty()) name1.swap(name2); @@ -1788,7 +1792,8 @@ static std::string describe_monster_weapon(const monsters *mons) { item_def dup = *weap; ++dup.quantity; - name1 = dup.name(DESC_NOCAP_A, false, false, true, true); + name1 = dup.name(DESC_NOCAP_A, false, false, true, true, + ISFLAG_KNOW_CURSE); name2.clear(); } @@ -1807,8 +1812,6 @@ static std::string describe_monster_weapon(const monsters *mons) return (desc); } - - #ifdef DEBUG_DIAGNOSTICS static std::string stair_destination_description(const coord_def &pos) { @@ -1910,9 +1913,10 @@ static void describe_monster(const monsters *mon) } } -std::string get_monster_desc(const monsters *mon, bool full_desc) +std::string get_monster_desc(const monsters *mon, bool full_desc, + description_level_type mondtype) { - std::string desc = mon->name(DESC_CAP_A); + std::string desc = mon->name(mondtype); const int mon_arm = mon->inv[MSLOT_ARMOUR]; std::string weap = ""; diff --git a/crawl-ref/source/direct.h b/crawl-ref/source/direct.h index 93ea85d89a..9d9198b1a1 100644 --- a/crawl-ref/source/direct.h +++ b/crawl-ref/source/direct.h @@ -146,7 +146,9 @@ bool in_vlos(const coord_def &pos); void terse_describe_square(const coord_def &c); void full_describe_square(const coord_def &c); void describe_floor(); -std::string get_monster_desc(const monsters *mon, bool full_desc = true); +std::string get_monster_desc(const monsters *mon, + bool full_desc = true, + description_level_type mondtype = DESC_CAP_A); int dos_direction_unmunge(int doskey); diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 558af36ed9..4d9ac82043 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -756,8 +756,10 @@ enum description_level_type // Partial item names. DESC_BASENAME, // Base name of item subtype - DESC_QUALNAME // Name without articles, quantities, + DESC_QUALNAME, // Name without articles, quantities, // enchantments. + + DESC_NONE }; enum game_direction_type diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 09104bd3d2..a605bc89f1 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -1655,6 +1655,9 @@ public: std::string o_str(const char *name, const char *def = NULL) const; int o_colour(const char *name, int def = LIGHTGREY) const; + // Fix option values if necessary, specifically file paths. + void fixup_options(); + private: std::string unalias(const std::string &key) const; void add_alias(const std::string &alias, const std::string &name); @@ -1685,7 +1688,6 @@ private: void new_dump_fields(const std::string &text, bool add = true); void do_kill_map(const std::string &from, const std::string &to); int read_explore_stop_conditions(const std::string &) const; - void validate_options(); void split_parse(const std::string &s, const std::string &separator, void (game_options::*add)(const std::string &)); diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 673233710f..821120b0eb 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -401,6 +401,8 @@ std::string melee_attack::anon_name(description_level_type desc, case DESC_NOCAP_YOUR: case DESC_NOCAP_ITS: return ("its"); + case DESC_NONE: + return (""); case DESC_NOCAP_THE: case DESC_NOCAP_A: case DESC_PLAIN: @@ -1193,12 +1195,9 @@ int melee_attack::player_stab(int damage) stab_message( def, stab_bonus ); exercise(SK_STABBING, 1 + random2avg(5, 4)); - - if (mons_holiness(def) == MH_NATURAL - || mons_holiness(def) == MH_HOLY) - { + + if (!tso_stab_safe_monster(defender)) did_god_conduct(DID_STABBING, 4); - } } else { @@ -2475,10 +2474,12 @@ void melee_attack::player_stab_check() if (stab_attempt && roll_needed) stab_attempt = (random2(roll) <= you.skills[SK_STABBING] + you.dex); - if (stab_attempt && you.religion == GOD_SHINING_ONE + if (stab_attempt + && you.religion == GOD_SHINING_ONE && !you.duration[DUR_BERSERKER]) { - if (!yesno("Really attack this helpless creature?", false, 'n')) + if (!tso_stab_safe_monster(defender) + && !yesno("Really attack this helpless creature?", false, 'n')) { stab_attempt = false; cancel_attack = true; diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 5fc1f998ba..3a32320755 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -1297,11 +1297,9 @@ void game_options::read_options(InitLineInput &il, bool runscript) #endif Options.explore_stop |= Options.explore_stop_prompt; - - validate_options(); } -void game_options::validate_options() +void game_options::fixup_options() { // Validate save_dir if (!check_dir("Save directory", save_dir)) diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc index 79f8a34fe4..1cc95497dd 100644 --- a/crawl-ref/source/itemname.cc +++ b/crawl-ref/source/itemname.cc @@ -76,6 +76,9 @@ std::string item_def::name(description_level_type descrip, bool quantity_words, unsigned long ignore_flags) const { + if (descrip == DESC_NONE) + return (""); + std::ostringstream buff; const std::string auxname = this->name_aux(descrip, terse, ident, @@ -1205,8 +1208,7 @@ std::string item_def::name_aux( description_level_type desc, else if (item_plus2 == ZAPCOUNT_EMPTY) buff << " {empty}"; else if (item_plus2 > 0) - buff << " {zapped " << item_plus2 - << ((item_plus2 > 1) ? " times" : " time") + buff << " {zapped: " << item_plus2 << '}'; break; diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc index e2298ecb3a..001e3c7128 100644 --- a/crawl-ref/source/libutil.cc +++ b/crawl-ref/source/libutil.cc @@ -69,6 +69,8 @@ description_level_type description_type_by_name(const char *desc) return DESC_INVENTORY_EQUIP; else if (!strcmp("inv", desc)) return DESC_INVENTORY; + else if (!strcmp("none", desc)) + return DESC_NONE; return DESC_PLAIN; } @@ -101,7 +103,7 @@ void play_sound( const char *file ) std::string strip_filename_unsafe_chars(const std::string &s) { - return replace_all_of(s, " .&`\"\'|;:/\\{}()[]<>*%$#@!~?", ""); + return replace_all_of(s, " .&`\"\'|;{}()[]<>*%$#@!~?", ""); } std::string make_stringf(const char *s, ...) diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index fe555c2108..8246b685dd 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -1457,6 +1457,9 @@ void define_monster(int index) static std::string str_monam(const monsters& mon, description_level_type desc, bool force_seen) { + if (desc == DESC_NONE) + return (""); + // Handle non-visible case first if ( !force_seen && !player_monster_visible(&mon) ) { @@ -2485,7 +2488,8 @@ void monsters::equip_weapon(item_def &item, int near) { if (need_message(near)) mprf("%s wields %s.", name(DESC_CAP_THE).c_str(), - item.name(DESC_NOCAP_A).c_str()); + item.name(DESC_NOCAP_A, false, false, true, + false, ISFLAG_CURSED).c_str()); const int brand = get_weapon_brand(item); if (brand == SPWPN_PROTECTION) @@ -2574,7 +2578,8 @@ void monsters::unequip_weapon(item_def &item, int near) { if (need_message(near)) mprf("%s unwields %s.", name(DESC_CAP_THE).c_str(), - item.name(DESC_NOCAP_A).c_str()); + item.name(DESC_NOCAP_A, false, false, true, + false, ISFLAG_CURSED).c_str()); const int brand = get_weapon_brand(item); if (brand == SPWPN_PROTECTION) diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 54bafb69a9..6edcedd0b4 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -75,6 +75,8 @@ std::string pronoun_you(description_level_type desc) { switch (desc) { + case DESC_NONE: + return ""; case DESC_CAP_A: case DESC_CAP_THE: return "You"; case DESC_NOCAP_A: case DESC_NOCAP_THE: diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 6450879856..0fd8322171 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -3454,3 +3454,10 @@ int piety_breakpoint(int i) else return breakpoints[i]; } + +// Returns true if The Shining One doesn't mind you stabbing this creature. +bool tso_stab_safe_monster(const actor *act) +{ + const mon_holy_type holy = act->holiness(); + return (holy != MH_NATURAL && holy != MH_HOLY); +} diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h index dfefbc0496..4a1dcbe291 100644 --- a/crawl-ref/source/religion.h +++ b/crawl-ref/source/religion.h @@ -51,6 +51,9 @@ void beogh_idol_revenge(); bool ely_destroy_weapons(); void trog_burn_books(); +class actor; +bool tso_stab_safe_monster(const actor *act); + inline void xom_acts(int sever) { xom_acts(xom_is_nice(), sever); diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index f297783b93..2ffddb5d96 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -565,7 +565,7 @@ screen_buffer_t colour_code_map( int x, int y, bool item_colour, else if (Options.trap_item_brand && grid_is_trap(grid_value) && igrd[x][y] != NON_ITEM) { - tc |= COLFLAG_TRAP_ITEM; + tc |= COLFLAG_TRAP_ITEM; } return real_colour(tc); -- cgit v1.2.3-54-g00ecf