Skip to content

Commit

Permalink
Overhaul faction mission travel. Also map prompt messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
sparr committed Oct 28, 2024
1 parent f633a1b commit e9cc67f
Show file tree
Hide file tree
Showing 25 changed files with 678 additions and 352 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"sym": "+",
"color": "white",
"see_cost": "none",
"flags": [ "NO_ROTATE", "SOURCE_PEOPLE", "SHOULD_NOT_SPAWN" ]
"flags": [ "NO_ROTATE", "SOURCE_PEOPLE", "SHOULD_NOT_SPAWN" ],
"travel_cost_type": "field"
},
{
"type": "overmap_terrain",
Expand Down
1 change: 1 addition & 0 deletions src/basecamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ static const time_duration work_day_hours_time = work_day_hours * 1_hours;

time_duration base_camps::to_workdays( const time_duration &work_time )
{
// logic here is duplicated in reverse in basecamp::time_to_food
if( work_time < ( work_day_hours + 1 ) * 1_hours ) {
return work_time;
}
Expand Down
14 changes: 9 additions & 5 deletions src/basecamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ class basecamp
/// Constructs a new nutrients struct in place and forwards it. Passed argument should be in kilocalories.
nutrients camp_food_supply( int change );
/// Calculates raw kcal cost from duration of work and exercise, then forwards it to above
nutrients camp_food_supply( time_duration work, float exertion_level = NO_EXERCISE );
nutrients camp_food_supply( const time_duration &work, float exertion_level = NO_EXERCISE,
const time_duration &travel_time = 0_hours );
/// Evenly distributes the actual consumed food from a work project to the workers assigned to it
void feed_workers( const std::vector<std::reference_wrapper <Character>> &workers, nutrients food,
bool is_player_meal = false );
Expand All @@ -268,7 +269,8 @@ class basecamp
/// The number of days the current camp supplies lasts at the given exertion level.
int camp_food_supply_days( float exertion_level ) const;
/// Returns the total charges of food time_duration @ref work costs
int time_to_food( time_duration work, float exertion_level = NO_EXERCISE ) const;
int time_to_food( time_duration total_time, float work_exertion_level = NO_EXERCISE,
time_duration travel_time = 0_hours ) const;
/// Changes the faction respect for you by @ref change, returns respect
int camp_discipline( int change = 0 ) const;
/// Changes the faction opinion for you by @ref change, returns opinion
Expand Down Expand Up @@ -361,11 +363,13 @@ class basecamp
npc_ptr start_mission( const mission_id &miss_id, time_duration duration,
bool must_feed, const std::string &desc, bool group,
const std::vector<item *> &equipment,
const skill_id &skill_tested, int skill_level, float exertion_level );
const skill_id &skill_tested, int skill_level,
float exertion_level, const time_duration &travel_time = 0_hours );
npc_ptr start_mission( const mission_id &miss_id, time_duration duration,
bool must_feed, const std::string &desc, bool group,
const std::vector<item *> &equipment, float exertion_level,
const std::map<skill_id, int> &required_skills = {} );
const std::vector<item *> &equipment,
const std::map<skill_id, int> &required_skills = {},
float exertion_level = 1.0f, const time_duration &travel_time = 0_hours );
comp_list start_multi_mission( const mission_id &miss_id,
bool must_feed, const std::string &desc,
// const std::vector<item*>& equipment, // No support for extracting equipment from recipes currently..
Expand Down
3 changes: 2 additions & 1 deletion src/computer_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,8 @@ void computer_session::action_miss_disarm()
void computer_session::action_miss_launch()
{
// Target Acquisition.
const tripoint_abs_omt target( ui::omap::choose_point( 0 ) );
const tripoint_abs_omt target( ui::omap::choose_point(
_( "Choose a target for the nuclear missile." ), 0 ) );
if( target == overmap::invalid_tripoint ) {
add_msg( m_info, _( "Target acquisition canceled." ) );
return;
Expand Down
6 changes: 4 additions & 2 deletions src/debug_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1660,7 +1660,8 @@ static void teleport_short()

static void teleport_long()
{
const tripoint_abs_omt where( ui::omap::choose_point( true ) );
const tripoint_abs_omt where( ui::omap::choose_point( _( "Choose a teleport destination." ),
true ) );
if( where == overmap::invalid_tripoint ) {
return;
}
Expand Down Expand Up @@ -3464,7 +3465,8 @@ static void map_extra()
mx_menu.query();
int mx_choice = mx_menu.ret;
if( mx_choice >= 0 && mx_choice < static_cast<int>( mx_str.size() ) ) {
const tripoint_abs_omt where_omt( ui::omap::choose_point( true ) );
const tripoint_abs_omt where_omt( ui::omap::choose_point(
_( "Select location to spawn map extra." ), true ) );
if( where_omt != overmap::invalid_tripoint ) {
smallmap mx_map;
mx_map.load( where_omt, false );
Expand Down
2 changes: 1 addition & 1 deletion src/do_turn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ void overmap_npc_move()
}
if( elem->omt_path.empty() ) {
elem->omt_path = overmap_buffer.get_travel_path( elem->global_omt_location(), elem->goal,
overmap_path_params::for_npc() );
overmap_path_params::for_npc() ).points;
if( elem->omt_path.empty() ) { // goal is unreachable, or already reached goal, reset it
elem->goal = npc::no_goal_point;
}
Expand Down
Loading

0 comments on commit e9cc67f

Please sign in to comment.