2017-09-01 06:13:34 -06:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2019-07-12 14:09:03 -06:00
|
|
|
#include "df/world_region_type.h"
|
2017-09-01 06:13:34 -06:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using std::array;
|
|
|
|
using std::ostringstream;
|
|
|
|
using std::string;
|
|
|
|
using std::vector;
|
|
|
|
|
2019-09-23 05:13:04 -06:00
|
|
|
#define fileresult_file_name "./data/init/embark_assistant_fileresult.txt"
|
|
|
|
|
2017-09-01 06:13:34 -06:00
|
|
|
namespace embark_assist {
|
|
|
|
namespace defs {
|
|
|
|
// Survey types
|
|
|
|
//
|
|
|
|
enum class river_sizes {
|
|
|
|
None,
|
|
|
|
Brook,
|
|
|
|
Stream,
|
|
|
|
Minor,
|
|
|
|
Medium,
|
|
|
|
Major
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mid_level_tile {
|
|
|
|
bool aquifer = false;
|
|
|
|
bool clay = false;
|
|
|
|
bool sand = false;
|
|
|
|
bool flux = false;
|
2018-12-04 06:55:16 -07:00
|
|
|
bool coal = false;
|
2017-09-01 06:13:34 -06:00
|
|
|
int8_t soil_depth;
|
|
|
|
int8_t offset;
|
|
|
|
int16_t elevation;
|
|
|
|
bool river_present = false;
|
|
|
|
int16_t river_elevation = 100;
|
2018-02-26 10:31:33 -07:00
|
|
|
int8_t adamantine_level; // -1 = none, 0 .. 3 = cavern 1 .. magma sea. Currently not used beyond present/absent.
|
|
|
|
int8_t magma_level; // -1 = none, 0 .. 3 = cavern 3 .. surface/volcano
|
2017-09-01 06:13:34 -06:00
|
|
|
int8_t biome_offset;
|
|
|
|
uint8_t savagery_level; // 0 - 2
|
|
|
|
uint8_t evilness_level; // 0 - 2
|
|
|
|
std::vector<bool> metals;
|
|
|
|
std::vector<bool> economics;
|
|
|
|
std::vector<bool> minerals;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::array<std::array<mid_level_tile, 16>, 16> mid_level_tiles;
|
|
|
|
|
|
|
|
struct region_tile_datum {
|
|
|
|
bool surveyed = false;
|
|
|
|
uint16_t aquifer_count = 0;
|
|
|
|
uint16_t clay_count = 0;
|
|
|
|
uint16_t sand_count = 0;
|
|
|
|
uint16_t flux_count = 0;
|
2018-12-04 06:55:16 -07:00
|
|
|
uint16_t coal_count = 0;
|
2017-09-01 06:13:34 -06:00
|
|
|
uint8_t min_region_soil = 10;
|
|
|
|
uint8_t max_region_soil = 0;
|
2019-07-01 05:28:40 -06:00
|
|
|
uint8_t max_waterfall = 0;
|
2017-09-01 06:13:34 -06:00
|
|
|
river_sizes river_size;
|
|
|
|
int16_t biome_index[10]; // Indexed through biome_offset; -1 = null, Index of region, [0] not used
|
|
|
|
int16_t biome[10]; // Indexed through biome_offset; -1 = null, df::biome_type, [0] not used
|
|
|
|
uint8_t biome_count;
|
2018-07-13 09:21:42 -06:00
|
|
|
int16_t min_temperature[10]; // Indexed through biome_offset; -30000 = null, Urists - 10000, [0] not used
|
|
|
|
int16_t max_temperature[10]; // Indexed through biome_offset; -30000 = null, Urists - 10000, [0] not used
|
2018-06-21 12:48:35 -06:00
|
|
|
bool blood_rain[10];
|
|
|
|
bool blood_rain_possible;
|
|
|
|
bool blood_rain_full;
|
|
|
|
bool permanent_syndrome_rain[10];
|
|
|
|
bool permanent_syndrome_rain_possible;
|
|
|
|
bool permanent_syndrome_rain_full;
|
|
|
|
bool temporary_syndrome_rain[10];
|
|
|
|
bool temporary_syndrome_rain_possible;
|
|
|
|
bool temporary_syndrome_rain_full;
|
2017-09-01 06:13:34 -06:00
|
|
|
bool reanimating[10];
|
|
|
|
bool reanimating_possible;
|
|
|
|
bool reanimating_full;
|
|
|
|
bool thralling[10];
|
|
|
|
bool thralling_possible;
|
|
|
|
bool thralling_full;
|
|
|
|
uint16_t savagery_count[3];
|
|
|
|
uint16_t evilness_count[3];
|
|
|
|
std::vector<bool> metals;
|
|
|
|
std::vector<bool> economics;
|
|
|
|
std::vector<bool> minerals;
|
2019-07-12 14:09:03 -06:00
|
|
|
mid_level_tile north_row[16];
|
|
|
|
mid_level_tile south_row[16];
|
|
|
|
mid_level_tile west_column[16];
|
|
|
|
mid_level_tile east_column[16];
|
|
|
|
uint8_t north_corner_selection[16]; // 0 - 3. For some reason DF stores everything needed for incursion
|
|
|
|
uint8_t west_corner_selection[16]; // detection in 17:th row/colum data in the region details except
|
|
|
|
// this info, so we have to go to neighboring world tiles to fetch it.
|
|
|
|
df::world_region_type region_type[16][16]; // Required for incursion override detection. We could store only the
|
|
|
|
// edges, but storing it for every tile allows for a unified fetching
|
|
|
|
// logic.
|
2017-09-01 06:13:34 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
struct geo_datum {
|
|
|
|
uint8_t soil_size = 0;
|
|
|
|
bool top_soil_only = true;
|
|
|
|
bool top_soil_aquifer_only = true;
|
|
|
|
bool aquifer_absent = true;
|
|
|
|
bool clay_absent = true;
|
|
|
|
bool sand_absent = true;
|
|
|
|
bool flux_absent = true;
|
2018-12-04 06:55:16 -07:00
|
|
|
bool coal_absent = true;
|
2017-09-01 06:13:34 -06:00
|
|
|
std::vector<bool> possible_metals;
|
|
|
|
std::vector<bool> possible_economics;
|
|
|
|
std::vector<bool> possible_minerals;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector<geo_datum> geo_data;
|
|
|
|
|
|
|
|
struct sites {
|
|
|
|
uint8_t x;
|
|
|
|
uint8_t y;
|
|
|
|
char type;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct site_infos {
|
2019-07-12 14:09:03 -06:00
|
|
|
bool incursions_processed;
|
2017-09-01 06:13:34 -06:00
|
|
|
bool aquifer;
|
|
|
|
bool aquifer_full;
|
|
|
|
uint8_t min_soil;
|
|
|
|
uint8_t max_soil;
|
2019-07-12 14:09:03 -06:00
|
|
|
bool flat;
|
2019-07-01 05:28:40 -06:00
|
|
|
uint8_t max_waterfall;
|
2017-09-01 06:13:34 -06:00
|
|
|
bool clay;
|
|
|
|
bool sand;
|
|
|
|
bool flux;
|
2018-12-04 06:55:16 -07:00
|
|
|
bool coal;
|
2019-07-12 14:09:03 -06:00
|
|
|
bool blood_rain;
|
|
|
|
bool permanent_syndrome_rain;
|
|
|
|
bool temporary_syndrome_rain;
|
|
|
|
bool reanimating;
|
|
|
|
bool thralling;
|
2017-09-01 06:13:34 -06:00
|
|
|
std::vector<uint16_t> metals;
|
|
|
|
std::vector<uint16_t> economics;
|
|
|
|
std::vector<uint16_t> minerals;
|
|
|
|
// Could add savagery, evilness, and biomes, but DF provides those easily.
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector<sites> site_lists;
|
|
|
|
|
|
|
|
typedef std::vector<std::vector<region_tile_datum>> world_tile_data;
|
|
|
|
|
|
|
|
typedef bool mlt_matches[16][16];
|
|
|
|
// An embark region match is indicated by marking the top left corner
|
|
|
|
// tile as a match. Thus, the bottom and right side won't show matches
|
|
|
|
// unless the appropriate dimension has a width of 1.
|
|
|
|
|
|
|
|
struct matches {
|
|
|
|
bool preliminary_match;
|
|
|
|
bool contains_match;
|
|
|
|
mlt_matches mlt_match;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector<std::vector<matches>> match_results;
|
|
|
|
|
|
|
|
// matcher types
|
|
|
|
//
|
|
|
|
enum class evil_savagery_values : int8_t {
|
|
|
|
NA = -1,
|
|
|
|
All,
|
|
|
|
Present,
|
|
|
|
Absent
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class evil_savagery_ranges : int8_t {
|
|
|
|
Low,
|
|
|
|
Medium,
|
|
|
|
High
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class aquifer_ranges : int8_t {
|
|
|
|
NA = -1,
|
|
|
|
All,
|
|
|
|
Present,
|
|
|
|
Partial,
|
|
|
|
Not_All,
|
|
|
|
Absent
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class river_ranges : int8_t {
|
|
|
|
NA = -1,
|
|
|
|
None,
|
|
|
|
Brook,
|
|
|
|
Stream,
|
|
|
|
Minor,
|
|
|
|
Medium,
|
|
|
|
Major
|
|
|
|
};
|
|
|
|
|
2018-02-27 02:46:06 -07:00
|
|
|
// For possible future use. That's the level of data actually collected.
|
2018-02-26 10:31:33 -07:00
|
|
|
// enum class adamantine_ranges : int8_t {
|
|
|
|
// NA = -1,
|
|
|
|
// Cavern_1,
|
|
|
|
// Cavern_2,
|
|
|
|
// Cavern_3,
|
|
|
|
// Magma_Sea
|
|
|
|
// };
|
|
|
|
|
|
|
|
enum class magma_ranges : int8_t {
|
|
|
|
NA = -1,
|
|
|
|
Cavern_3,
|
|
|
|
Cavern_2,
|
|
|
|
Cavern_1,
|
|
|
|
Volcano
|
|
|
|
};
|
|
|
|
|
2017-09-01 06:13:34 -06:00
|
|
|
enum class yes_no_ranges : int8_t {
|
|
|
|
NA = -1,
|
|
|
|
Yes,
|
|
|
|
No
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class all_present_ranges : int8_t {
|
|
|
|
All,
|
|
|
|
Present
|
|
|
|
};
|
|
|
|
enum class present_absent_ranges : int8_t {
|
|
|
|
NA = -1,
|
|
|
|
Present,
|
|
|
|
Absent
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class soil_ranges : int8_t {
|
|
|
|
NA = -1,
|
|
|
|
None,
|
|
|
|
Very_Shallow,
|
|
|
|
Shallow,
|
|
|
|
Deep,
|
|
|
|
Very_Deep
|
|
|
|
};
|
|
|
|
|
2018-06-21 12:48:35 -06:00
|
|
|
enum class syndrome_rain_ranges : int8_t {
|
|
|
|
NA = -1,
|
|
|
|
Any,
|
|
|
|
Permanent,
|
|
|
|
Temporary,
|
|
|
|
Not_Permanent,
|
|
|
|
None
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class reanimation_ranges : int8_t {
|
|
|
|
NA = -1,
|
|
|
|
Both,
|
|
|
|
Any,
|
|
|
|
Thralling,
|
|
|
|
Reanimation,
|
|
|
|
Not_Thralling,
|
|
|
|
None
|
|
|
|
};
|
|
|
|
|
2017-09-01 06:13:34 -06:00
|
|
|
enum class freezing_ranges : int8_t {
|
2018-07-13 09:21:42 -06:00
|
|
|
NA = -1,
|
|
|
|
Permanent,
|
|
|
|
At_Least_Partial,
|
|
|
|
Partial,
|
|
|
|
At_Most_Partial,
|
|
|
|
Never
|
2017-09-01 06:13:34 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
struct finders {
|
|
|
|
uint16_t x_dim;
|
|
|
|
uint16_t y_dim;
|
|
|
|
evil_savagery_values savagery[static_cast<int8_t>(evil_savagery_ranges::High) + 1];
|
|
|
|
evil_savagery_values evilness[static_cast<int8_t>(evil_savagery_ranges::High) + 1];
|
|
|
|
aquifer_ranges aquifer;
|
|
|
|
river_ranges min_river;
|
|
|
|
river_ranges max_river;
|
2019-07-01 05:28:40 -06:00
|
|
|
int8_t min_waterfall; // N/A(-1), Absent, 1-9
|
2019-07-12 14:09:03 -06:00
|
|
|
yes_no_ranges flat;
|
2017-09-01 06:13:34 -06:00
|
|
|
present_absent_ranges clay;
|
|
|
|
present_absent_ranges sand;
|
|
|
|
present_absent_ranges flux;
|
2018-12-04 06:55:16 -07:00
|
|
|
present_absent_ranges coal;
|
2017-09-01 06:13:34 -06:00
|
|
|
soil_ranges soil_min;
|
|
|
|
all_present_ranges soil_min_everywhere;
|
|
|
|
soil_ranges soil_max;
|
2018-07-13 09:21:42 -06:00
|
|
|
freezing_ranges freezing;
|
2018-06-21 12:48:35 -06:00
|
|
|
yes_no_ranges blood_rain; // Will probably blow up with the magic release arcs...
|
|
|
|
syndrome_rain_ranges syndrome_rain;
|
|
|
|
reanimation_ranges reanimation;
|
2018-02-26 10:31:33 -07:00
|
|
|
int8_t spire_count_min; // N/A(-1), 0-9
|
|
|
|
int8_t spire_count_max; // N/A(-1), 0-9
|
|
|
|
magma_ranges magma_min;
|
|
|
|
magma_ranges magma_max;
|
2017-09-01 06:13:34 -06:00
|
|
|
int8_t biome_count_min; // N/A(-1), 1-9
|
|
|
|
int8_t biome_count_max; // N/A(-1), 1-9
|
|
|
|
int8_t region_type_1; // N/A(-1), df::world_region_type
|
|
|
|
int8_t region_type_2; // N/A(-1), df::world_region_type
|
|
|
|
int8_t region_type_3; // N/A(-1), df::world_region_type
|
|
|
|
int8_t biome_1; // N/A(-1), df::biome_type
|
|
|
|
int8_t biome_2; // N/A(-1), df::biome_type
|
|
|
|
int8_t biome_3; // N/A(-1), df::biome_type
|
|
|
|
int16_t metal_1; // N/A(-1), 0-max_inorganic;
|
|
|
|
int16_t metal_2; // N/A(-1), 0-max_inorganic;
|
|
|
|
int16_t metal_3; // N/A(-1), 0-max_inorganic;
|
|
|
|
int16_t economic_1; // N/A(-1), 0-max_inorganic;
|
|
|
|
int16_t economic_2; // N/A(-1), 0-max_inorganic;
|
|
|
|
int16_t economic_3; // N/A(-1), 0-max_inorganic;
|
|
|
|
int16_t mineral_1; // N/A(-1), 0-max_inorganic;
|
|
|
|
int16_t mineral_2; // N/A(-1), 0-max_inorganic;
|
|
|
|
int16_t mineral_3; // N/A(-1), 0-max_inorganic;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct match_iterators {
|
|
|
|
bool active;
|
|
|
|
uint16_t x; // x position of focus when iteration started so we can return it.
|
|
|
|
uint16_t y; // y
|
|
|
|
uint16_t i;
|
|
|
|
uint16_t k;
|
|
|
|
bool x_right;
|
|
|
|
bool y_down;
|
|
|
|
bool inhibit_x_turn;
|
|
|
|
bool inhibit_y_turn;
|
2019-09-23 05:13:04 -06:00
|
|
|
uint16_t target_location_x;
|
|
|
|
uint16_t target_location_y;
|
2017-09-01 06:13:34 -06:00
|
|
|
uint16_t count;
|
|
|
|
finders finder;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef void(*find_callbacks) (embark_assist::defs::finders finder);
|
|
|
|
}
|
|
|
|
}
|