diff options
-rw-r--r-- | crawl-ref/source/food.cc | 50 | ||||
-rw-r--r-- | crawl-ref/source/notes.cc | 7 |
2 files changed, 41 insertions, 16 deletions
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc index 94fdc8b718..9c0ad6d5d2 100644 --- a/crawl-ref/source/food.cc +++ b/crawl-ref/source/food.cc @@ -145,9 +145,10 @@ void weapon_switch( int targ ) wield_effects( targ, false ); } -// look for a butchering implement, prompting user if no obvious -// options exist. Returns whether a weapon was switched. -static bool find_butchering_implement() +// look for a butchering implement. If fallback is true, +// prompt the user if no obvious options exist. +// Returns whether a weapon was switched. +static bool find_butchering_implement( bool fallback ) { // look for a butchering implement in your pack for (int i = 0; i < ENDOFPACK; ++i) @@ -165,7 +166,10 @@ static bool find_butchering_implement() return true; } } - + + if ( !fallback ) + return false; + // if we didn't swap above, then we still can't cut...let's call // wield_weapon() in the "prompt the user" way... @@ -180,7 +184,6 @@ static bool find_butchering_implement() bool butchery(void) { - bool can_butcher = false; bool wpn_switch = false; bool new_cursed = false; int old_weapon = you.equip[EQ_WEAPON]; @@ -193,7 +196,14 @@ bool butchery(void) you.species == SP_GHOUL || you.mutation[MUT_CLAWS]))); - can_butcher = barehand_butcher || + bool gloved_butcher = (you.species == SP_TROLL || + you.species == SP_GHOUL || + you.mutation[MUT_CLAWS]) && + (you.equip[EQ_GLOVES] != -1 && + !item_cursed(you.inv[you.equip[EQ_GLOVES]])); + int old_gloves = you.equip[EQ_GLOVES]; + + bool can_butcher = barehand_butcher || (you.equip[EQ_WEAPON] != -1 && can_cut_meat(you.inv[you.equip[EQ_WEAPON]])); @@ -246,11 +256,23 @@ bool butchery(void) } if ( answer == 0 ) continue; + + bool removed_gloves = false; if ( Options.easy_butcher && !can_butcher ) { - // try to find a butchering implement - wpn_switch = find_butchering_implement(); + // Try to find a butchering implement. + // If you can butcher by taking off your gloves, don't prompt. + wpn_switch = find_butchering_implement(!gloved_butcher); + removed_gloves = gloved_butcher && !wpn_switch; + if ( removed_gloves ) + { + // Actually take off the gloves; this creates a + // delay. We assume later on that gloves have a 1-turn + // takeoff delay! + takeoff_armour(old_gloves); + barehand_butcher = true; + } const int wpn = you.equip[EQ_WEAPON]; if ( wpn_switch ) { @@ -260,11 +282,11 @@ bool butchery(void) item_cursed( you.inv[wpn]); } - // note that barehanded butchery would not reach this - // stage, so if wpn == -1 the user selected '-' when + // note that if wpn == -1 the user selected '-' when // switching weapons - if (!wpn_switch || wpn == -1 || !can_cut_meat(you.inv[wpn])) + if (!barehand_butcher && + (!wpn_switch || wpn == -1 || !can_cut_meat(you.inv[wpn]))) { // still can't butcher. Early out if ( wpn == -1 ) { @@ -304,7 +326,7 @@ bool butchery(void) { // If we didn't switch weapons, we get in one turn of butchery; // otherwise the work has to happen in the delay. - if (!wpn_switch) + if (!wpn_switch && !removed_gloves) ++mitm[objl].plus2; int work_req = 4 - mitm[objl].plus2; @@ -325,6 +347,10 @@ bool butchery(void) if (!new_cursed && wpn_switch) start_delay( DELAY_WEAPON_SWAP, 1, old_weapon ); + // put on the removed gloves + if ( removed_gloves ) + start_delay( DELAY_ARMOUR_ON, 1, old_gloves ); + you.turn_is_over = true; return true; } diff --git a/crawl-ref/source/notes.cc b/crawl-ref/source/notes.cc index 9b6050c9d0..bf3ddd10c8 100644 --- a/crawl-ref/source/notes.cc +++ b/crawl-ref/source/notes.cc @@ -41,8 +41,7 @@ static int real_god_power( int religion, int idx ) static bool is_noteworthy_skill_level( int level ) { - unsigned i; - for ( i = 0; i < Options.note_skill_levels.size(); ++i ) + for ( unsigned int i = 0; i < Options.note_skill_levels.size(); ++i ) if ( level == Options.note_skill_levels[i] ) return true; return false; @@ -199,7 +198,7 @@ static bool is_noteworthy( const Note& note ) return true; } -const char* number_to_ordinal( int number ) +static const char* number_to_ordinal( int number ) { const char* ordinals[5] = { "first", "second", "third", "fourth", "fifth" }; @@ -440,6 +439,6 @@ void make_user_note() if ( !validline || (!*buf) ) return; Note unote(NOTE_USER_NOTE); - unote.name = std::string(buf); + unote.name = buf; take_note(unote); } |