Skip to content

Commit

Permalink
Fix error for non-default color settings (CleverRaven#56610)
Browse files Browse the repository at this point in the history
* Remove strictness requirement for colors
  • Loading branch information
haveric authored Apr 6, 2022
1 parent 8c92c6d commit 6c500c8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
7 changes: 1 addition & 6 deletions src/assign.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
8 changes: 3 additions & 5 deletions src/move_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) {
Expand Down
4 changes: 2 additions & 2 deletions src/overmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

}

Expand Down Expand Up @@ -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" ) ) {
Expand Down

0 comments on commit 6c500c8

Please sign in to comment.