From 6c500c8d2ff26c29ee641c268de76f4bd4fd634d Mon Sep 17 00:00:00 2001 From: haveric Date: Wed, 6 Apr 2022 10:57:50 -0500 Subject: [PATCH] Fix error for non-default color settings (#56610) * Remove strictness requirement for colors --- src/assign.h | 7 +------ src/move_mode.cpp | 8 +++----- src/overmap.cpp | 4 ++-- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/assign.h b/src/assign.h index 2a1afcb3c4669..eafaf8fc517eb 100644 --- a/src/assign.h +++ b/src/assign.h @@ -579,8 +579,7 @@ inline bool assign( const JsonObject &jo, const std::string &name, units::energy return true; } -inline bool assign( const JsonObject &jo, const std::string &name, nc_color &val, - const bool strict = false ) +inline bool assign( const JsonObject &jo, const std::string &name, nc_color &val ) { if( !jo.has_member( name ) ) { return false; @@ -589,10 +588,6 @@ inline bool assign( const JsonObject &jo, const std::string &name, nc_color &val if( out == c_unset ) { jo.throw_error( "invalid color name", name ); } - if( strict && out == val ) { - report_strict_violation( jo, "cannot assign explicit value the same as default or inherited value", - name ); - } val = out; return true; } diff --git a/src/move_mode.cpp b/src/move_mode.cpp index 8b21985341715..961fafca7fc21 100644 --- a/src/move_mode.cpp +++ b/src/move_mode.cpp @@ -47,16 +47,14 @@ void move_mode::load_move_mode( const JsonObject &jo, const std::string &src ) move_mode_factory.load( jo, src ); } -void move_mode::load( const JsonObject &jo, const std::string &src ) +void move_mode::load( const JsonObject &jo, const std::string &/*src*/ ) { - bool strict = src == "dda"; - mandatory( jo, was_loaded, "character", _letter, unicode_codepoint_from_symbol_reader ); mandatory( jo, was_loaded, "name", _name ); mandatory( jo, was_loaded, "panel_char", _panel_letter, unicode_codepoint_from_symbol_reader ); - assign( jo, "panel_color", _panel_color, strict ); - assign( jo, "symbol_color", _symbol_color, strict ); + assign( jo, "panel_color", _panel_color ); + assign( jo, "symbol_color", _symbol_color ); std::string exert = jo.get_string( "exertion_level" ); if( !activity_levels_map.count( exert ) ) { diff --git a/src/overmap.cpp b/src/overmap.cpp index 3a9440c078dcc..9d4f49aff6dfc 100644 --- a/src/overmap.cpp +++ b/src/overmap.cpp @@ -465,7 +465,7 @@ void overmap_land_use_code::load( const JsonObject &jo, const std::string &src ) << id.c_str() << " (" << name << ")"; } - assign( jo, "color", color, strict ); + assign( jo, "color", color ); } @@ -740,7 +740,7 @@ void oter_type_t::load( const JsonObject &jo, const std::string &src ) assign( jo, "extras", extras, strict ); assign( jo, "mondensity", mondensity, strict ); assign( jo, "spawns", static_spawns, strict ); - assign( jo, "color", color, strict ); + assign( jo, "color", color ); assign( jo, "land_use_code", land_use_code, strict ); if( jo.has_member( "looks_like" ) ) {