Skip to content

Commit

Permalink
Enlarge data type of jmapgen_int to int
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettDong committed Jan 2, 2021
1 parent 88e3815 commit de21a73
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/mapgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down
9 changes: 5 additions & 4 deletions src/mapgen.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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;
};
Expand Down

0 comments on commit de21a73

Please sign in to comment.