Skip to content

Commit

Permalink
Using defined constant rather than magic number
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrikLundell committed Aug 17, 2024
1 parent af89099 commit 8bbef0c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mapgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,11 +762,11 @@ load_mapgen_function( const JsonObject &jio, const std::string &id_base, const p
{
dbl_or_var weight = get_dbl_or_var( jio, "weight", false, 1000 );
if( weight.min.is_constant() && ( weight.min.constant() < 0 ||
weight.min.constant() >= 2147483648 ) ) {
weight.min.constant() >= INT_MAX ) ) {
jio.throw_error_at( "weight", "min value out of bounds (0 - max int)" );
}
if( weight.pair && weight.max.is_constant() && ( weight.max.constant() < 0 ||
weight.max.constant() >= 2147483648 ) ) {
weight.max.constant() >= INT_MAX ) ) {
jio.throw_error_at( "weight", "max value out of bounds (0 - max int)" );
}

Expand Down

0 comments on commit 8bbef0c

Please sign in to comment.