From de21a736bcbfd46f617d6989a9a084b96b8c9e8b Mon Sep 17 00:00:00 2001 From: Binrui Dong Date: Sat, 2 Jan 2021 15:37:41 -0500 Subject: [PATCH] Enlarge data type of jmapgen_int to int --- src/mapgen.cpp | 4 ++-- src/mapgen.h | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mapgen.cpp b/src/mapgen.cpp index ac50a0e63c845..342131be0d35e 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -642,8 +642,8 @@ jmapgen_int::jmapgen_int( const JsonObject &jo, const std::string &tag ) } } -jmapgen_int::jmapgen_int( const JsonObject &jo, const std::string &tag, const short def_val, - const short def_valmax ) +jmapgen_int::jmapgen_int( const JsonObject &jo, const std::string &tag, const int &def_val, + const int &def_valmax ) : val( def_val ) , valmax( def_valmax ) { diff --git a/src/mapgen.h b/src/mapgen.h index 4e93be06d0a0a..635967cb5afd3 100644 --- a/src/mapgen.h +++ b/src/mapgen.h @@ -58,11 +58,11 @@ class mapgen_function_builtin : public virtual mapgen_function ///////////////////////////////////////////////////////////////////////////////// ///// json mapgen (and friends) /* - * Actually a pair of shorts that can rng, for numbers that will never exceed 32768 + * Actually a pair of integers that can rng, for numbers that will never exceed INT_MAX */ struct jmapgen_int { - short val; - short valmax; + int val; + int valmax; jmapgen_int( int v ) : val( v ), valmax( v ) {} jmapgen_int( int v, int v2 ) : val( v ), valmax( v2 ) {} jmapgen_int( point p ); @@ -74,7 +74,8 @@ struct jmapgen_int { * Throws is the json is malformed (e.g. a string not an integer, but does not throw * if the member is just missing (the default values are used instead). */ - jmapgen_int( const JsonObject &jo, const std::string &tag, short def_val, short def_valmax ); + jmapgen_int( const JsonObject &jo, const std::string &tag, const int &def_val, + const int &def_valmax ); int get() const; };