Skip to content

Commit

Permalink
Boats' "engines" will start at first attempt (#31305)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Burmistrov authored and ZhilkinSerg committed Jun 10, 2019
1 parent 9892c12 commit 028d92f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/activity_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2050,6 +2050,7 @@ void activity_handlers::start_engines_finish( player_activity *act, player *p )
int non_muscle_attempted = 0;
int started = 0;
int non_muscle_started = 0;
int non_combustion_started = 0;
const bool take_control = act->values[0];

for( size_t e = 0; e < veh->engines.size(); ++e ) {
Expand All @@ -2062,6 +2063,8 @@ void activity_handlers::start_engines_finish( player_activity *act, player *p )
started++;
if( !veh->is_engine_type( e, "muscle" ) && !veh->is_engine_type( e, "animal" ) ) {
non_muscle_started++;
} else {
non_combustion_started++;
}
}
}
Expand All @@ -2084,6 +2087,9 @@ void activity_handlers::start_engines_finish( player_activity *act, player *p )
//Only some of the non-muscle engines started
add_msg( ngettext( "One of the %s's engines start up.",
"Some of the %s's engines start up.", non_muscle_started ), veh->name );
} else if( non_combustion_started > 0 ) {
//Non-combustions "engines" started
add_msg( "The %s is ready for movement.", veh->name );
} else {
//All of the non-muscle engines failed
add_msg( m_bad, ngettext( "The %s's engine fails to start.",
Expand Down
6 changes: 3 additions & 3 deletions src/vehicle_use.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,17 +823,17 @@ bool vehicle::start_engine( const int e )
if( einfo.has_flag( "MUSCLE_ARMS" ) && ( g->u.hp_cur[hp_arm_l] == 0 ||
g->u.hp_cur[hp_arm_r] == 0 ) ) {
add_msg( _( "You cannot use %s with a broken arm." ), eng.name() );
return false;
} else if( einfo.has_flag( "MUSCLE_LEGS" ) && ( g->u.hp_cur[hp_leg_l] == 0 ||
g->u.hp_cur[hp_leg_r] == 0 ) ) {
add_msg( _( "You cannot use %s with a broken leg." ), eng.name() );
} else {
add_msg( _( "The %s's mechanism is out of reach!" ), name );
return false;
}
} else {
add_msg( _( "Looks like the %1$s is out of %2$s." ), eng.name(),
item::nname( einfo.fuel_type ) );
return false;
}
return false;
}

const double dmg = parts[engines[e]].damage_percent();
Expand Down

0 comments on commit 028d92f

Please sign in to comment.