Skip to content

Commit

Permalink
More obvious hint before going to sleep (UPDATED) (#38722)
Browse files Browse the repository at this point in the history
* colorize ask for deactivation

* change default selection sleep menu to NO

* undo astyle

* show player all active inv-ob that use up charges

* color and text

* Add test to check for lit items (cigar ...)

* Add missing parentheses

* typo

* Update src/handle_action.cpp

* Update src/handle_action.cpp

Co-authored-by: Kevin Granade <[email protected]>
  • Loading branch information
kevingranade authored Mar 14, 2020
2 parents 62e4015 + 1339576 commit 8ffbe67
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/handle_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,23 +901,23 @@ static void sleep()
return;
}
uilist as_m;
as_m.text = _( "Are you sure you want to sleep?" );
as_m.text = _( "<color_white>Are you sure you want to sleep?</color>" );
// (Y)es/(S)ave before sleeping/(N)o
as_m.entries.emplace_back( 0, true,
get_option<bool>( "FORCE_CAPITAL_YN" ) ? 'Y' : 'y',
_( "Yes." ) );
as_m.entries.emplace_back( 1, g->get_moves_since_last_save(),
get_option<bool>( "FORCE_CAPITAL_YN" ) ? 'S' : 's',
_( "Yes, and save game before sleeping." ) );
as_m.entries.emplace_back( 2, true,
get_option<bool>( "FORCE_CAPITAL_YN" ) ? 'N' : 'n',
_( "No." ) );
as_m.entries.emplace_back( 1, g->get_moves_since_last_save(),
get_option<bool>( "FORCE_CAPITAL_YN" ) ? 'S' : 's',
_( "Yes, and save game before sleeping." ) );
as_m.entries.emplace_back( 0, true,
get_option<bool>( "FORCE_CAPITAL_YN" ) ? 'Y' : 'y',
_( "Yes." ) );

// List all active items, bionics or mutations so player can deactivate them
std::vector<std::string> active;
for( auto &it : u.inv_dump() ) {
if( it->active && ( it->charges > 0 || it->units_remaining( u ) > 0 ) &&
it->is_transformable() ) {
if( it->has_flag( flag_LITCIG ) ||
( it->active && ( it->charges > 0 || it->units_remaining( u ) > 0 ) && it->is_tool() ) ) {
active.push_back( it->tname() );
}
}
Expand Down Expand Up @@ -959,10 +959,10 @@ static void sleep()
std::stringstream data;
if( !active.empty() ) {
data << as_m.text << std::endl;
data << _( "You may want to deactivate these before you sleep." ) << std::endl;
data << _( "You may want to turn off:" ) << std::endl;
data << " " << std::endl;
for( auto &a : active ) {
data << a << std::endl;
data << "<color_red>" << a << "</color>" << std::endl;
}
as_m.text = data.str();
}
Expand Down

0 comments on commit 8ffbe67

Please sign in to comment.