Skip to content

Commit

Permalink
block/remove surveys that can't be performed
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrikLundell committed Dec 9, 2023
1 parent ff27311 commit 980cfa1
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions src/faction_camp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,17 @@ void basecamp::get_available_missions( mission_data &mission_key, map &here )
// Missions that belong exclusively to the central tile
{
if( directions.size() < 8 ) {
{
bool free_non_field_found = false;

for( const auto &dir : base_camps::all_directions ) {
if( dir.first != base_camps::base_dir && expansions.find( dir.first ) == expansions.end() &&
overmap_buffer.ter_existing( omt_pos + dir.first ) != oter_id( "field" ) ) {
free_non_field_found = true;
break;
}
}

if( free_non_field_found ) {
const mission_id miss_id = { Camp_Survey_Field, "", {}, base_dir };
comp_list npc_list = get_mission_workers( miss_id );
entry = string_format( _( "Notes:\n"
Expand Down Expand Up @@ -1417,6 +1427,20 @@ void basecamp::get_available_missions( mission_data &mission_key, map &here )
}
}

bool possible_expansion_found = false;

for( const auto &dir : base_camps::all_directions ) {
if( dir.first != base_camps::base_dir && expansions.find( dir.first ) == expansions.end() ) {
const oter_id &omt_ref = overmap_buffer.ter( omt_pos + dir.first );
const auto &pos_expansions = recipe_group::get_recipes_by_id( "all_faction_base_expansions",
omt_ref.id().c_str() );
if( !pos_expansions.empty() ) {
possible_expansion_found = true;
break;
}
}
}

const mission_id miss_id = { Camp_Survey_Expansion, "", {}, base_dir };
comp_list npc_list = get_mission_workers( miss_id );
entry = string_format( _( "Notes:\n"
Expand All @@ -1437,7 +1461,7 @@ void basecamp::get_available_missions( mission_data &mission_key, map &here )
"Time: 3 Hours\n"
"Positions: %d/1\n" ), npc_list.size() );
mission_key.add_start( miss_id, name_display_of( miss_id ),
entry, npc_list.empty() );
entry, npc_list.empty() && possible_expansion_found );
if( !npc_list.empty() ) {
entry = action_of( miss_id.id );
bool avail = update_time_left( entry, npc_list );
Expand Down

0 comments on commit 980cfa1

Please sign in to comment.