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

hoist unvisited member options to globals #35073

Closed
Closed
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
4 changes: 2 additions & 2 deletions src/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ void JsonObject::finish()
{
#ifndef CATA_IN_TOOL
if( report_unvisited_members && !reported_unvisited_members && !std::uncaught_exception() &&
get_option<bool>( "JSON_REPORT_UNVISITED_MEMBERS" ) ) {
opt_report_unvisited_members ) {
reported_unvisited_members = true;
for( const std::pair<std::string, int> &p : positions ) {
const std::string &name = p.first;
if( !visited_members.count( name ) && !string_starts_with( name, "//" ) &&
name != "blueprint" ) {
dbg( D_ERROR ) << "Failed to visit member '" << name << "' in JsonObject at "
<< ( get_option<bool>( "JSON_POSITION_OF_UNVISITED_MEMBERS" ) ?
<< ( opt_report_unvisited_member_positions ?
jsin->line_number( start ) : "line 0:0,0" )
<< ":\n" << str() << std::endl;
}
Expand Down
5 changes: 5 additions & 0 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ int message_cooldown;
bool fov_3d;
int fov_3d_z_range;
bool tile_iso;
bool opt_report_unvisited_members;
bool opt_report_unvisited_member_positions;


std::map<std::string, std::string> TILESETS; // All found tilesets: <name, tileset_dir>
std::map<std::string, std::string> SOUNDPACKS; // All found soundpacks: <name, soundpack_dir>
Expand Down Expand Up @@ -2840,6 +2843,8 @@ bool options_manager::save()
message_cooldown = ::get_option<int>( "MESSAGE_COOLDOWN" );
fov_3d = ::get_option<bool>( "FOV_3D" );
fov_3d_z_range = ::get_option<int>( "FOV_3D_Z_RANGE" );
opt_report_unvisited_members = ::get_option<int>( "JSON_REPORT_UNVISITED_MEMBERS" );
opt_report_unvisited_member_positions = ::get_option<int>( "JSON_POSITION_OF_UNVISITED_MEMBERS" );

update_music_volume();

Expand Down
3 changes: 3 additions & 0 deletions src/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
class JsonIn;
class JsonOut;

extern bool opt_report_unvisited_members;
extern bool opt_report_unvisited_member_positions;

class options_manager
{
public:
Expand Down