@@ -4,7 +4,7 @@
"id" : "Prison",
"overmaps" : [
{ "point":[-1,0,0], "overmap": "prison_3"},
{ "point":[0,0,0], "overmap": "prison_2", "connect":"road"},
{ "point":[0,0,0], "overmap": "prison_2"},
{ "point":[1,0,0], "overmap": "prison_1"},
{ "point":[-1,1,0], "overmap": "prison_6"},
{ "point":[0,1,0], "overmap": "prison_5"},
@@ -22,6 +22,9 @@
{ "point":[0,2,-1], "overmap": "prison_b"},
{ "point":[1,2,-1], "overmap": "prison_b"}
],
"connections" : [
{ "point" : [0,-1,0], "terrain" : "road" }
],
"locations" : [ "land" ],
"city_distance" : [3, -1],
"city_sizes" : [4, 12],
@@ -74,7 +77,7 @@
"overmaps" : [
{ "point":[0,0,0], "overmap": "farm_unsettled_barn"},
{ "point":[0,0,1], "overmap": "farm_unsettled_barn_f2"},
{ "point":[1,0,0], "overmap": "farm_unsettled_house", "connect": "road"},
{ "point":[1,0,0], "overmap": "farm_unsettled_house"},
{ "point":[2,0,0], "overmap": "farm_unsettled_topright"},
{ "point":[0,1,0], "overmap": "farm_unsettled_centerleft"},
{ "point":[1,1,0], "overmap": "farm_unsettled_centercenter"},
@@ -83,6 +86,9 @@
{ "point":[1,2,0], "overmap": "farm_unsettled_bottomcenter"},
{ "point":[2,2,0], "overmap": "farm_unsettled_bottomright"}
],
"connections" : [
{ "point" : [1,-1,0], "terrain" : "road" }
],
"locations" : [ "wilderness" ],
"city_distance" : [20, -1],
"city_sizes" : [1, 12],
@@ -3,9 +3,12 @@
"type" : "overmap_special",
"id" : "Evac Shelter",
"overmaps" : [
{ "point":[0,0,0], "overmap": "shelter", "connect":"road"},
{ "point":[0,0,0], "overmap": "shelter"},
{ "point":[0,0,-1], "overmap": "shelter_under"}
],
"connections" : [
{ "point" : [0,-1,0], "terrain" : "road" }
],
"locations" : [ "wilderness" ],
"city_distance" : [4, 20],
"city_sizes" : [4, 16],
@@ -29,13 +32,17 @@
"type" : "overmap_special",
"id" : "Home Improvement Superstore",
"overmaps" : [
{ "point":[0,1,0], "overmap": "hdwr_large_entrance", "connect":"road"},
{ "point":[-1,1,0], "overmap": "hdwr_large_SW", "connect":"road"},
{ "point":[0,1,0], "overmap": "hdwr_large_entrance"},
{ "point":[-1,1,0], "overmap": "hdwr_large_SW"},
{ "point":[-1,0,0], "overmap": "hdwr_large_NW"},
{ "point":[0,0,0], "overmap": "hdwr_large_NE"},
{ "point":[-1,-1,0], "overmap": "hdwr_large_backroom"},
{ "point":[0,-1,0], "overmap": "hdwr_large_loadingbay"}
],
"connections" : [
{ "point" : [0,2,0], "terrain" : "road" },
{ "point" : [-1,2,0], "terrain" : "road" }
],
"locations" : [ "wilderness" ],
"city_distance" : [0, 20],
"city_sizes" : [6, 20],
@@ -47,10 +54,13 @@
"id" : "Public Works",
"overmaps" : [
{ "point":[0,0,0], "overmap": "public_works"},
{ "point":[1,0,0], "overmap": "public_works_entrance", "connect": "road"},
{ "point":[1,0,0], "overmap": "public_works_entrance"},
{ "point":[0,1,0], "overmap": "public_works"},
{ "point":[1,1,0], "overmap": "public_works"}
],
"connections" : [
{ "point" : [1,-1,0], "terrain" : "road" }
],
"locations" : [ "wilderness" ],
"city_distance" : [0, 12],
"city_sizes" : [4, 12],
@@ -137,12 +147,15 @@
{ "point":[1,8,0], "overmap": "mall_a_74_north"},
{ "point":[2,8,0], "overmap": "mall_a_75_north"},
{ "point":[3,8,0], "overmap": "mall_a_76_north"},
{ "point":[4,8,0], "overmap": "mall_a_77_north", "connect":"road"},
{ "point":[4,8,0], "overmap": "mall_a_77_north"},
{ "point":[5,8,0], "overmap": "mall_a_78_north"},
{ "point":[6,8,0], "overmap": "mall_a_79_north"},
{ "point":[7,8,0], "overmap": "mall_a_80_north"},
{ "point":[8,8,0], "overmap": "mall_a_81_north"}
],
"connections" : [
{ "point" : [4,9,0], "terrain" : "road" }
],
"locations" : [ "land" ],
"city_distance" : [1, 20],
"city_sizes" : [5, 12],
@@ -155,9 +168,12 @@
"overmaps" : [
{ "point":[0,0,0], "overmap": "apartments_con_tower_NW_north"},
{ "point":[1,0,0], "overmap": "apartments_con_tower_NE_north"},
{ "point":[0,1,0], "overmap": "apartments_con_tower_SW_north", "connect": "road"},
{ "point":[0,1,0], "overmap": "apartments_con_tower_SW_north"},
{ "point":[1,1,0], "overmap": "apartments_con_tower_SE_north"}
],
"connections" : [
{ "point" : [0,2,0], "terrain" : "road" }
],
"locations" : [ "wilderness" ],
"city_distance" : [-1, 4],
"city_sizes" : [4, 12],
@@ -173,7 +189,7 @@
{ "point":[2,0,0], "overmap": "necropolis_a_3_north"},
{ "point":[3,0,0], "overmap": "necropolis_a_4_north"},
{ "point":[4,0,0], "overmap": "necropolis_a_5_north"},
{ "point":[5,0,0], "overmap": "necropolis_a_6_north", "connect":"road"},
{ "point":[5,0,0], "overmap": "necropolis_a_6_north"},
{ "point":[6,0,0], "overmap": "necropolis_a_7_north"},
{ "point":[7,0,0], "overmap": "necropolis_a_8_north"},
{ "point":[8,0,0], "overmap": "necropolis_a_9_north"},
@@ -231,7 +247,7 @@
{ "point":[6,6,0], "overmap": "necropolis_a_61_north"},
{ "point":[7,6,0], "overmap": "necropolis_a_62_north"},
{ "point":[8,6,0], "overmap": "necropolis_a_63_north"},
{ "point":[0,7,0], "overmap": "necropolis_a_64_north", "connect":"road"},
{ "point":[0,7,0], "overmap": "necropolis_a_64_north"},
{ "point":[1,7,0], "overmap": "necropolis_a_65_north"},
{ "point":[2,7,0], "overmap": "necropolis_a_66_north"},
{ "point":[3,7,0], "overmap": "necropolis_a_67_north"},
@@ -244,7 +260,7 @@
{ "point":[1,8,0], "overmap": "necropolis_a_74_north"},
{ "point":[2,8,0], "overmap": "necropolis_a_75_north"},
{ "point":[3,8,0], "overmap": "necropolis_a_76_north"},
{ "point":[4,8,0], "overmap": "necropolis_a_77_north", "connect":"road"},
{ "point":[4,8,0], "overmap": "necropolis_a_77_north"},
{ "point":[5,8,0], "overmap": "necropolis_a_78_north"},
{ "point":[6,8,0], "overmap": "necropolis_a_79_north"},
{ "point":[7,8,0], "overmap": "necropolis_a_80_north"},
@@ -493,6 +509,11 @@
{ "point":[7,8,-3], "overmap": "necropolis_d_80_north"},
{ "point":[8,8,-3], "overmap": "necropolis_d_81_north"}
],
"connections" : [
{ "point" : [5,-1,0], "terrain" : "road" },
{ "point" : [-1,7,0], "terrain" : "road" },
{ "point" : [4,9,0], "terrain" : "road" }
],
"locations" : [ "field" ],
"city_distance" : [1, 30],
"city_sizes" : [1, 16],
@@ -524,10 +545,13 @@
{ "point":[4,3,0], "overmap": "evac_center_20_north"},
{ "point":[0,4,0], "overmap": "evac_center_21_north"},
{ "point":[1,4,0], "overmap": "evac_center_22_north"},
{ "point":[2,4,0], "overmap": "evac_center_23_north", "connect":"road"},
{ "point":[2,4,0], "overmap": "evac_center_23_north"},
{ "point":[3,4,0], "overmap": "evac_center_24_north"},
{ "point":[4,4,0], "overmap": "evac_center_25_north"}
],
"connections" : [
{ "point" : [2,5,0], "terrain" : "road" }
],
"locations" : [ "wilderness" ],
"city_distance" : [2, 15],
"city_sizes" : [1, 16],
@@ -538,7 +562,7 @@
"id" : "FEMA Camp",
"overmaps" : [
{ "point":[0,0,0], "overmap": "fema"},
{ "point":[1,0,0], "overmap": "fema_entrance", "connect": "road"},
{ "point":[1,0,0], "overmap": "fema_entrance"},
{ "point":[2,0,0], "overmap": "fema"},
{ "point":[0,1,0], "overmap": "fema"},
{ "point":[1,1,0], "overmap": "fema"},
@@ -547,6 +571,9 @@
{ "point":[1,2,0], "overmap": "fema"},
{ "point":[2,2,0], "overmap": "fema"}
],
"connections" : [
{ "point" : [1,-1,0], "terrain" : "road" }
],
"locations" : [ "wilderness" ],
"city_distance" : [5, -1],
"city_sizes" : [12, 30],
@@ -558,7 +585,7 @@
"id" : "Megastore",
"overmaps" : [
{ "point":[0,0,0], "overmap": "megastore"},
{ "point":[1,0,0], "overmap": "megastore_entrance", "connect": "road"},
{ "point":[1,0,0], "overmap": "megastore_entrance"},
{ "point":[2,0,0], "overmap": "megastore"},
{ "point":[0,1,0], "overmap": "megastore"},
{ "point":[1,1,0], "overmap": "megastore"},
@@ -567,6 +594,9 @@
{ "point":[1,2,0], "overmap": "megastore"},
{ "point":[2,2,0], "overmap": "megastore"}
],
"connections" : [
{ "point" : [1,-1,0], "terrain" : "road" }
],
"locations" : [ "land" ],
"city_distance" : [-1, 15],
"city_sizes" : [1, 12],
@@ -577,8 +607,8 @@
"type" : "overmap_special",
"id" : "School",
"overmaps" : [
{ "point":[0,0,0], "overmap": "school_3", "connect": "road"},
{ "point":[1,0,0], "overmap": "school_2", "connect":"road"},
{ "point":[0,0,0], "overmap": "school_3"},
{ "point":[1,0,0], "overmap": "school_2"},
{ "point":[2,0,0], "overmap": "school_1"},
{ "point":[0,1,0], "overmap": "school_6"},
{ "point":[1,1,0], "overmap": "school_5"},
@@ -587,6 +617,10 @@
{ "point":[1,2,0], "overmap": "school_8"},
{ "point":[2,2,0], "overmap": "school_7"}
],
"connections" : [
{ "point" : [0,-1,0], "terrain" : "road" },
{ "point" : [1,-1,0], "terrain" : "road" }
],
"locations" : [ "wilderness" ],
"city_distance" : [0, 12],
"city_sizes" : [4, 16],
@@ -641,7 +675,10 @@
"id": "Lab",
"overmaps":
[
{ "point":[0,0,0], "overmap": "lab_stairs", "connect":"road"}
{ "point":[0,0,0], "overmap": "lab_stairs" }
],
"connections" : [
{ "point" : [0,-1,0], "terrain" : "road" }
],
"locations": [ "wilderness" ],
"city_distance": [10, -1],
@@ -653,7 +690,10 @@
"id": "Ice Lab",
"overmaps":
[
{ "point":[0,0,0], "overmap": "ice_lab_stairs", "connect":"road"}
{ "point":[0,0,0], "overmap": "ice_lab_stairs" }
],
"connections" : [
{ "point" : [0,-1,0], "terrain" : "road" }
],
"locations": [ "wilderness" ],
"city_distance": [10, -1],
@@ -678,7 +718,7 @@
"type" : "overmap_special",
"id" : "Sewage Treatment Plant",
"overmaps" : [
{ "point":[0,0,0], "overmap": "s_lot", "connect":"road"},
{ "point":[0,0,0], "overmap": "s_lot"},
{ "point":[0,1,0], "overmap": "sewage_treatment"},
{ "point":[0,1,-1], "overmap": "sewage_treatment_hub"},
{ "point":[0,0,-1], "overmap": "sewage_treatment_under"},
@@ -690,6 +730,9 @@
{ "point":[0,2,-1], "overmap": "sewage_treatment_under"},
{ "point":[1,2,-1], "overmap": "sewage_treatment_under"}
],
"connections" : [
{ "point" : [0,-1,0], "terrain" : "road" }
],
"locations" : [ "land" ],
"city_distance" : [15, 30],
"city_sizes" : [4, 12],
@@ -5,8 +5,8 @@
"overmaps" : [
{ "point":[0,0,0], "overmap": "loffice_tower_5"},
{ "point":[1,0,0], "overmap": "loffice_tower_6"},
{ "point":[0,1,0], "overmap": "loffice_tower_7", "connect": "road"},
{ "point":[1,1,0], "overmap": "loffice_tower_8", "connect": "road"},
{ "point":[0,1,0], "overmap": "loffice_tower_7"},
{ "point":[1,1,0], "overmap": "loffice_tower_8"},
{ "point":[0,0,-1], "overmap": "loffice_tower_1"},
{ "point":[1,0,-1], "overmap": "loffice_tower_2"},
{ "point":[0,1,-1], "overmap": "loffice_tower_3"},
@@ -20,19 +20,21 @@
{ "point":[0,1,2], "overmap": "loffice_tower_15"},
{ "point":[1,1,2], "overmap": "loffice_tower_16"}
],
"connections" : [
{ "point" : [0,2,0], "terrain" : "road" },
{ "point" : [1,2,0], "terrain" : "road" }
],
"locations" : [ "wilderness" ], "//":"what special locations does it spawn",
"city_distance" : [-1, 4], "//":"how far from a city it should be",
"city_sizes" : [4, 12], "//":"what city sizes should it spawn in",
"occurrences" : [2, 3], "//":"how many per overmap",
"rotate" : false, "//":"allow rotation",
"unique" : false, "//":"only allow one per city",
"required" : false, "//":"is this special required for valid city sizes",
"flags" : ["CLASSIC", "ROTATE"]
"flags" : ["CLASSIC"]
},{
"type" : "overmap_special",
"id" : "2fMotel",
"overmaps" : [
{ "point":[0,0,0], "overmap": "2fmotel_entrance_north", "connect":"road"},
{ "point":[0,0,0], "overmap": "2fmotel_entrance_north"},
{ "point":[-1,0,0], "overmap": "2fmotel_1_north"},
{ "point":[-1,1,0], "overmap": "2fmotel_2_north"},
{ "point":[0,1,0], "overmap": "2fmotel_3_north"},
@@ -44,13 +46,14 @@
{ "point":[-1,1,2], "overmap": "2fmotel_2_r_north"},
{ "point":[0,1,2], "overmap": "2fmotel_3_r_north"}
],
"locations" : [ "by_road" ], "//":"what special locations does it spawn",
"connections" : [
{ "point" : [0,-1,0], "terrain" : "road", "existing" : true }
],
"locations" : [ "land" ], "//":"what special locations does it spawn",
"city_distance" : [10, 120], "//":"how far from a city it should be",
"city_sizes" : [1, 12], "//":"what city sizes should it spawn in",
"occurrences" : [2, 5], "//":"how many per overmap",
"rotate" : true, "//":"allow rotation",
"unique" : false, "//":"only allow one per city",
"required" : false, "//":"is this special required for valid city sizes",
"flags" : [ "CLASSIC" ]
}
]
@@ -8,10 +8,14 @@
#include "string_id.h"
#include <string>
#include <vector>
#include <limits>
#include <list>
#include <set>

struct MonsterGroup;
struct city;
struct overmap_special_location;

using mongroup_id = string_id<MonsterGroup>;

class overmap;
@@ -122,17 +126,23 @@ struct overmap_special_spawns {
struct overmap_special_terrain {
overmap_special_terrain() : p( 0, 0, 0 ) { };
tripoint p;
oter_str_id connect;
oter_str_id terrain;
std::set<std::string> flags;
};

struct overmap_special_connection {
struct overmap_special_connection : public JsonDeserializer {
tripoint p = tripoint( 0, 0, 0 );
oter_str_id terrain;
tripoint p;
bool existing = false;

overmap_special_connection() = default;

bool operator==( const overmap_special_connection &rhs ) const {
return p == rhs.p && terrain == rhs.terrain;
using JsonDeserializer::deserialize;
void deserialize( JsonIn &jsin ) override {
JsonObject jo = jsin.get_object();
jo.read( "point", p );
jo.read( "terrain", terrain );
jo.read( "existing", existing );
}
};

@@ -142,24 +152,32 @@ class overmap_special
bool operator<( const overmap_special &right ) const {
return ( this->id.compare( right.id ) < 0 );
}

/** Returns terrain at the given point */
/** Returns terrain at the given point. */
const overmap_special_terrain &get_terrain_at( const tripoint &p ) const;
/** Returns whether the special depends on existing roads. */
bool requires_existing_road() const;
/** Checks the object and builds @ref connections vector. */
void finalize();
/**
* Returns whether the special can be placed on the specified terrain.
* It's true if @ref oter meets any of @ref locations.
*/
bool can_be_placed_on( const oter_id &oter ) const;
/** Returns whether this special requires a city at all. */
bool requires_city() const;
/** Returns whether the special at @ref p can belong to the specified city. */
bool can_belong_to_city( const tripoint &p, const city &cit ) const;
/** Checks the object. */
void check();

std::string id;
std::list<overmap_special_terrain> terrains;
std::vector<overmap_special_connection> connections;
int min_city_size, max_city_size;
int min_city_distance, max_city_distance;
int min_occurrences, max_occurrences;
int height, width;
int min_city_size = 0;
int max_city_size = std::numeric_limits<int>::max();
int min_city_distance = 0;
int max_city_distance = std::numeric_limits<int>::max();
int min_occurrences = 0;
int max_occurrences = 0;
bool rotatable;
overmap_special_spawns spawns;
std::set<std::string> locations;
std::set<const overmap_special_location *> locations;
std::set<std::string> flags;
};

Large diffs are not rendered by default.

@@ -147,6 +147,10 @@ struct city {
std::string name;
city(int X = -1, int Y = -1, int S = -1);

operator bool() const {
return s >= 0;
}

int get_distance_from( const tripoint &p ) const;
};

@@ -257,11 +261,12 @@ class overmap
*/
static point display_notes(int z);
/**
* Dummy value, used to indicate that a point returned by a function
* Dummy value, used to indicate that a point/rotation returned by a function
* is invalid.
*/
static const point invalid_point;
static const tripoint invalid_tripoint;
static const int invalid_rotation = -1;
/**
* Return a vector containing the absolute coordinates of
* every matching note on the current z level of the current overmap.
@@ -381,7 +386,7 @@ class overmap
void generate(const overmap* north, const overmap* east, const overmap* south, const overmap* west);
bool generate_sub(int const z);

const city *get_nearest_city( const tripoint &p ) const;
const city &get_nearest_city( const tripoint &p ) const;

void signal_hordes( const tripoint &p, int sig_power );
void process_mongroups();
@@ -444,12 +449,17 @@ class overmap
void chip_rock(int x, int y, int z);
void good_road(const std::string &base, int x, int y, int z);
void good_river(int x, int y, int z);
bool allowed_terrain( const std::vector<tripoint> &points,
const overmap_location_restictions &restrictions ) const;
bool allow_special(const overmap_special& special, const tripoint& p, int &rotate);
// Returns a vector of enabled overmap specials.
std::vector<const overmap_special *> get_enabled_specials() const;
// Returns a vector of permuted coordinates of overmap sectors.
// Each sector consists of 12x12 small maps. Coordinates of the sectors are in range [0, 15], [0, 15].
// Check OMAPX, OMAPY, and OMSPEC_FREQ to learn actual values.
std::vector<point> get_sectors() const;

int random_special_rotation( const overmap_special &special, const tripoint &p ) const;
void place_special( const overmap_special &special, const tripoint &p, int rotation, const city &cit );
// Monsters, radios, etc.
void place_specials();
void place_special(const overmap_special& special, const tripoint& p, int rotation);
void place_mongroups();
void place_radios();