Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable to cancel rename the faction base name #61040

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions src/basecamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void basecamp::add_expansion( const std::string &bldg, const tripoint_abs_omt &n

void basecamp::define_camp( const tripoint_abs_omt &p, const std::string &camp_type )
{
query_new_name();
query_new_name( true );
omt_pos = p;
const oter_id &omt_ref = overmap_buffer.ter( omt_pos );
// purging the regions guarantees all entries will start with faction_base_
Expand Down Expand Up @@ -596,18 +596,29 @@ comp_list basecamp::get_mission_workers( const mission_id &miss_id, bool contain
return available;
}

void basecamp::query_new_name()
void basecamp::query_new_name( bool force )
{
string_input_popup popup;
string_input_popup input_popup;
bool done = false;
bool need_input = true;
do {
popup.title( _( "Name this camp" ) )
input_popup.title( _( "Name this camp" ) )
.width( 40 )
.text( "" )
.max_length( 25 )
.query();
} while( popup.canceled() || popup.text().empty() );

name = popup.text();
if( input_popup.canceled() || input_popup.text().empty() ) {
if( name.empty() || force ) {
popup( _( "You need to input the base camp name." ) );
} else {
need_input = false;
}
} else {
done = true;
}
} while( !done && need_input );
if( done ) {
name = input_popup.text();
}
}

void basecamp::set_name( const std::string &new_name )
Expand Down
2 changes: 1 addition & 1 deletion src/basecamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class basecamp

//change name of camp
void set_name( const std::string &new_name );
void query_new_name();
void query_new_name( bool force = false );
void abandon_camp();
void scan_pseudo_items();
void add_expansion( const std::string &terrain, const tripoint_abs_omt &new_pos );
Expand Down