From 88e3815e53c866d570ab4c72e3d5cd3924aeab43 Mon Sep 17 00:00:00 2001 From: Binrui Dong Date: Sat, 2 Jan 2021 14:56:56 -0500 Subject: [PATCH 1/2] Use native 'gaspumps' in lumbermill mapgen --- data/json/mapgen/lumbermill.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/data/json/mapgen/lumbermill.json b/data/json/mapgen/lumbermill.json index 9e1b70e8ce1af..dc0934c5eecd8 100644 --- a/data/json/mapgen/lumbermill.json +++ b/data/json/mapgen/lumbermill.json @@ -51,7 +51,7 @@ "v 2 __________________________________", "v vvvvv *___________________________1 1 ____", "v vooov______________________ ____ 121 1 v", - "v voooV_____________ #.......# ____ 1 1*1 1 1 v", + "v voGoV_____________ #.......# ____ 1 1*1 1 1 v", "v vooov_________ #L.....L#* ____* 1 1 1 2 v", "v vvvvv ______ * *wL.....Lw ____1 1 1 1 *v", "v 1____ 2 #L.....L# * ____1 1* 1 v", @@ -111,8 +111,7 @@ ], "palettes": [ "lumberyard" ], "terrain": { "o": "t_concrete" }, - "place_terrain": [ { "ter": "t_gas_pump", "x": 4, "y": 39 } ], - "place_liquids": [ { "liquid": "gasoline", "x": 4, "y": 39, "repeat": [ 200, 1075 ] } ], + "gaspumps": { "G": { "fuel": "gasoline", "amount": [ 50000, 268750 ] } }, "place_vehicles": [ { "vehicle": "flatbed_truck", "x": [ 43, 45 ], "y": 33, "chance": 30, "fuel": 25, "status": 1, "rotation": 90 }, { From de21a736bcbfd46f617d6989a9a084b96b8c9e8b Mon Sep 17 00:00:00 2001 From: Binrui Dong Date: Sat, 2 Jan 2021 15:37:41 -0500 Subject: [PATCH 2/2] 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; };