Merge remote-tracking branch 'PatrikLundell/embark-assistant' into develop

develop
lethosor 2020-11-14 15:08:22 -05:00
commit 4921cb4ac7
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
6 changed files with 177 additions and 116 deletions

@ -64,6 +64,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `search`: fixed an issue causing item counts on the trade screen to display inconsistently when searching
- `stockpiles`: fixed a crash when loading food stockpiles
- `stockpiles`: fixed an error when saving furniture stockpiles
- `embark-assistant`: Fixed issue causing incursion resource matching to skip the checks if those resources were provided only through incursions.
## Misc Improvements
- `createitem`: added support for plant growths (fruit, berries, leaves, etc.)

@ -26,16 +26,10 @@ namespace embark_assist {
Major
};
enum class aquifer_sizes : int8_t {
NA,
None,
Light,
None_Light,
Heavy,
None_Heavy,
Light_Heavy,
None_Light_Heavy
};
const uint8_t Clear_Aquifer_Bits = 0;
const uint8_t None_Aquifer_Bit = 1;
const uint8_t Light_Aquifer_Bit = 2;
const uint8_t Heavy_Aquifer_Bit = 4;
enum class tree_levels : int8_t {
None,
@ -46,7 +40,7 @@ namespace embark_assist {
};
struct mid_level_tile {
aquifer_sizes aquifer = aquifer_sizes::NA;
uint8_t aquifer = Clear_Aquifer_Bits;
bool clay = false;
bool sand = false;
bool flux = false;
@ -71,7 +65,11 @@ namespace embark_assist {
struct region_tile_datum {
bool surveyed = false;
aquifer_sizes aquifer = aquifer_sizes::NA;
bool survey_completed = false;
bool neighboring_clay = false; // These elements are updated after the survey by checking if there are any border MLTs in neighboring tiles that would would provide the resource
bool neighboring_sand = false; // if they actually provided an incursion. This allows the code to add these potential tiles to the ones checked.
uint8_t neighboring_aquifer = Clear_Aquifer_Bits;
uint8_t aquifer = Clear_Aquifer_Bits;
uint16_t clay_count = 0;
uint16_t sand_count = 0;
uint16_t flux_count = 0;
@ -147,7 +145,7 @@ namespace embark_assist {
struct site_infos {
bool incursions_processed;
aquifer_sizes aquifer;
uint8_t aquifer;
uint8_t min_soil;
uint8_t max_soil;
bool flat;

@ -311,7 +311,11 @@ command_result embark_assistant(color_ostream &out, std::vector <std::string> &
for (uint16_t k = 0; k < world->worldgen.worldgen_parms.dim_y; k++) {
embark_assist::main::state->survey_results[i][k].surveyed = false;
embark_assist::main::state->survey_results[i][k].aquifer = embark_assist::defs::aquifer_sizes::NA;
embark_assist::main::state->survey_results[i][k].survey_completed = false;
embark_assist::main::state->survey_results[i][k].neighboring_clay = false;
embark_assist::main::state->survey_results[i][k].neighboring_sand = false;
embark_assist::main::state->survey_results[i][k].neighboring_aquifer = embark_assist::defs::Clear_Aquifer_Bits;
embark_assist::main::state->survey_results[i][k].aquifer = embark_assist::defs::Clear_Aquifer_Bits;
embark_assist::main::state->survey_results[i][k].clay_count = 0;
embark_assist::main::state->survey_results[i][k].sand_count = 0;
embark_assist::main::state->survey_results[i][k].flux_count = 0;

@ -29,7 +29,7 @@ namespace embark_assist {
struct matcher_info {
bool savagery_found[3] = { false, false, false };
bool evilness_found[3] = { false, false, false };
embark_assist::defs::aquifer_sizes aquifer = embark_assist::defs::aquifer_sizes::NA;
uint8_t aquifer = embark_assist::defs::Clear_Aquifer_Bits;
bool river_found = false;
uint8_t max_waterfall = 0;
uint16_t elevation;
@ -120,14 +120,14 @@ namespace embark_assist {
}
// Aquifer
result->aquifer = static_cast<embark_assist::defs::aquifer_sizes>(static_cast<int8_t>(result->aquifer) | static_cast<int8_t>(mlt->aquifer));
result->aquifer |= mlt->aquifer;
switch (finder->aquifer) {
case embark_assist::defs::aquifer_ranges::NA:
break;
case embark_assist::defs::aquifer_ranges::None:
if (result->aquifer != embark_assist::defs::aquifer_sizes::None) {
if (result->aquifer != embark_assist::defs::None_Aquifer_Bit) {
*failed_match = true;
return;
}
@ -135,14 +135,14 @@ namespace embark_assist {
case embark_assist::defs::aquifer_ranges::At_Most_Light:
case embark_assist::defs::aquifer_ranges::None_Plus_Light:
if (static_cast<int8_t>(result->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Heavy)) {
if (result->aquifer & embark_assist::defs::Heavy_Aquifer_Bit) {
*failed_match = true;
return;
}
break;
case embark_assist::defs::aquifer_ranges::Light:
if (result->aquifer != embark_assist::defs::aquifer_sizes::Light) {
if (result->aquifer != embark_assist::defs::Light_Aquifer_Bit) {
*failed_match = true;
return;
}
@ -150,14 +150,14 @@ namespace embark_assist {
case embark_assist::defs::aquifer_ranges::At_Least_Light:
case embark_assist::defs::aquifer_ranges::Light_Plus_Heavy:
if (static_cast<int8_t>(result->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::None)) {
if (result->aquifer & embark_assist::defs::None_Aquifer_Bit) {
*failed_match = true;
return;
}
break;
case embark_assist::defs::aquifer_ranges::None_Plus_Heavy:
if (static_cast<int8_t>(result->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Light)) {
if (result->aquifer & embark_assist::defs::Light_Aquifer_Bit) {
*failed_match = true;
return;
}
@ -169,7 +169,7 @@ namespace embark_assist {
break;
case embark_assist::defs::aquifer_ranges::Heavy:
if (result->aquifer != embark_assist::defs::aquifer_sizes::Heavy) {
if (result->aquifer != embark_assist::defs::Heavy_Aquifer_Bit) {
*failed_match = true;
return;
}
@ -645,32 +645,32 @@ namespace embark_assist {
}
// Aquifer
result.aquifer = static_cast<embark_assist::defs::aquifer_sizes>(static_cast<int8_t>(result.aquifer) | static_cast<int8_t>(mlt->at(i).at(k).aquifer));
result.aquifer |= mlt->at(i).at(k).aquifer;
switch (finder->aquifer) {
case embark_assist::defs::aquifer_ranges::NA:
break;
case embark_assist::defs::aquifer_ranges::None:
if (result.aquifer != embark_assist::defs::aquifer_sizes::None) return false;
if (result.aquifer != embark_assist::defs::None_Aquifer_Bit) return false;
break;
case embark_assist::defs::aquifer_ranges::At_Most_Light:
case embark_assist::defs::aquifer_ranges::None_Plus_Light:
if (static_cast<int8_t>(result.aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Heavy)) return false;
if (result.aquifer & embark_assist::defs::Heavy_Aquifer_Bit) return false;
break;
case embark_assist::defs::aquifer_ranges::Light:
if (result.aquifer != embark_assist::defs::aquifer_sizes::Light) return false;
if (result.aquifer != embark_assist::defs::Light_Aquifer_Bit) return false;
break;
case embark_assist::defs::aquifer_ranges::At_Least_Light:
case embark_assist::defs::aquifer_ranges::Light_Plus_Heavy:
if (static_cast<int8_t>(result.aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::None)) return false;
if (result.aquifer & embark_assist::defs::None_Aquifer_Bit) return false;
break;
case embark_assist::defs::aquifer_ranges::None_Plus_Heavy:
if (static_cast<int8_t>(result.aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Light)) return false;
if (result.aquifer & embark_assist::defs::Light_Aquifer_Bit) return false;
break;
case embark_assist::defs::aquifer_ranges::None_Plus_At_Least_Light:
@ -679,7 +679,7 @@ namespace embark_assist {
break;
case embark_assist::defs::aquifer_ranges::Heavy:
if (result.aquifer != embark_assist::defs::aquifer_sizes::Heavy) return false;
if (result.aquifer != embark_assist::defs::Heavy_Aquifer_Bit) return false;
break;
}
@ -1223,29 +1223,29 @@ namespace embark_assist {
break;
case embark_assist::defs::aquifer_ranges::None_Plus_Light:
if (result.aquifer != embark_assist::defs::aquifer_sizes::None_Light) return false;
if (result.aquifer != (embark_assist::defs::None_Aquifer_Bit | embark_assist::defs::Light_Aquifer_Bit)) return false;
break;
case embark_assist::defs::aquifer_ranges::None_Plus_At_Least_Light:
if (result.aquifer != embark_assist::defs::aquifer_sizes::None_Light &&
result.aquifer != embark_assist::defs::aquifer_sizes::None_Heavy) return false;
if (result.aquifer != (embark_assist::defs::None_Aquifer_Bit | embark_assist::defs::Light_Aquifer_Bit) &&
result.aquifer != (embark_assist::defs::None_Aquifer_Bit | embark_assist::defs::Heavy_Aquifer_Bit)) return false;
break;
case embark_assist::defs::aquifer_ranges::None_Plus_Heavy:
if (result.aquifer != embark_assist::defs::aquifer_sizes::None_Heavy) return false;
if (result.aquifer != (embark_assist::defs::None_Aquifer_Bit | embark_assist::defs::Heavy_Aquifer_Bit)) return false;
break;
case embark_assist::defs::aquifer_ranges::At_Most_Light_Plus_Heavy:
if (result.aquifer != embark_assist::defs::aquifer_sizes::None_Heavy &&
result.aquifer != embark_assist::defs::aquifer_sizes::Light_Heavy) return false;
if (result.aquifer != (embark_assist::defs::None_Aquifer_Bit | embark_assist::defs::Heavy_Aquifer_Bit) &&
result.aquifer != (embark_assist::defs::Light_Aquifer_Bit | embark_assist::defs::Heavy_Aquifer_Bit)) return false;
break;
case embark_assist::defs::aquifer_ranges::Light_Plus_Heavy:
if (result.aquifer != embark_assist::defs::aquifer_sizes::Light_Heavy) return false;
if (result.aquifer != (embark_assist::defs::Light_Aquifer_Bit | embark_assist::defs::Heavy_Aquifer_Bit)) return false;
break;
case embark_assist::defs::aquifer_ranges::None_Light_Heavy:
if (result.aquifer != embark_assist::defs::aquifer_sizes::None_Light_Heavy) return false;
if (result.aquifer != (embark_assist::defs::None_Aquifer_Bit | embark_assist::defs::Light_Aquifer_Bit | embark_assist::defs::Heavy_Aquifer_Bit)) return false;
break;
}
@ -1496,87 +1496,91 @@ namespace embark_assist {
}
// Aquifer
// Survey can only augment results with incursions, but single results can't be achieved without the native tile matching it,
// so extra checks are needed only for combinations. Also note that while two incursions won't be sufficient to actually get a match,
// the important thing here is not to miss matches due to aborting too early.
switch (finder->aquifer) {
case embark_assist::defs::aquifer_ranges::NA:
break;
case embark_assist::defs::aquifer_ranges::None:
if (!(static_cast<int8_t>(tile->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::None))) {
if (!(tile->aquifer & embark_assist::defs::None_Aquifer_Bit)) {
if (trace) out.print("matcher::world_tile_match: Aquifer None (%i, %i)\n", x, y);
return false;
}
break;
case embark_assist::defs::aquifer_ranges::At_Most_Light:
if (tile->aquifer == embark_assist::defs::aquifer_sizes::Heavy) {
if (trace) out.print("matcher::world_tile_match: Aquifer Heavy (%i, %i)\n", x, y);
if (tile->aquifer == embark_assist::defs::Heavy_Aquifer_Bit) {
if (trace) out.print("matcher::world_tile_match: Aquifer At_Most_Light (%i, %i)\n", x, y);
return false;
}
break;
case embark_assist::defs::aquifer_ranges::None_Plus_Light:
if (!(static_cast<int8_t>(tile->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::None)) ||
!(static_cast<int8_t>(tile->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Light))) {
if (!((tile->aquifer | tile->neighboring_aquifer) & embark_assist::defs::None_Aquifer_Bit) ||
!((tile->aquifer | tile->neighboring_aquifer) & embark_assist::defs::Light_Aquifer_Bit)) {
if (trace) out.print("matcher::world_tile_match: Aquifer None_Plus_Light (%i, %i)\n", x, y);
return false;
}
break;
case embark_assist::defs::aquifer_ranges::None_Plus_At_Least_Light:
if (!(static_cast<int8_t>(tile->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::None)) ||
!(static_cast<int8_t>(tile->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Light_Heavy))) {
if (!((tile->aquifer | tile->neighboring_aquifer) & embark_assist::defs::None_Aquifer_Bit) ||
((tile->aquifer | tile->neighboring_aquifer) == embark_assist::defs::None_Aquifer_Bit)) {
if (trace) out.print("matcher::world_tile_match: Aquifer None_Plus_At_Least_Light (%i, %i)\n", x, y);
return false;
}
break;
case embark_assist::defs::aquifer_ranges::Light:
if (!(static_cast<int8_t>(tile->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Light))) {
if (!(tile->aquifer & embark_assist::defs::Light_Aquifer_Bit)) {
if (trace) out.print("matcher::world_tile_match: Aquifer Light (%i, %i)\n", x, y);
return false;
}
break;
case embark_assist::defs::aquifer_ranges::At_Least_Light:
if (tile->aquifer == embark_assist::defs::aquifer_sizes::None) {
if ((tile->aquifer | tile->neighboring_aquifer) == embark_assist::defs::None_Aquifer_Bit) {
if (trace) out.print("matcher::world_tile_match: Aquifer At_Least_Light (%i, %i)\n", x, y);
return false;
}
break;
case embark_assist::defs::aquifer_ranges::None_Plus_Heavy:
if (!(static_cast<int8_t>(tile->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::None)) ||
!(static_cast<int8_t>(tile->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Heavy))) {
if (!((tile->aquifer | tile->neighboring_aquifer) & embark_assist::defs::None_Aquifer_Bit) ||
!((tile->aquifer | tile->neighboring_aquifer) & embark_assist::defs::Heavy_Aquifer_Bit)) {
if (trace) out.print("matcher::world_tile_match: Aquifer None_Plus_Heavy (%i, %i)\n", x, y);
return false;
}
break;
case embark_assist::defs::aquifer_ranges::At_Most_Light_Plus_Heavy:
if (!(static_cast<int8_t>(tile->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Heavy)) ||
!(static_cast<int8_t>(tile->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::None_Light))) {
if ((tile->aquifer | tile->neighboring_aquifer) == embark_assist::defs::Heavy_Aquifer_Bit ||
!((tile->aquifer | tile->neighboring_aquifer) & embark_assist::defs::Heavy_Aquifer_Bit)) {
if (trace) out.print("matcher::world_tile_match: Aquifer At_Most_Light_Plus_Heavy (%i, %i)\n", x, y);
return false;
}
break;
case embark_assist::defs::aquifer_ranges::Light_Plus_Heavy:
if (!(static_cast<int8_t>(tile->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Light)) ||
!(static_cast<int8_t>(tile->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Heavy))) {
if (!((tile->aquifer | tile->neighboring_aquifer) & embark_assist::defs::Light_Aquifer_Bit) ||
!((tile->aquifer | tile->neighboring_aquifer) & embark_assist::defs::Heavy_Aquifer_Bit)) {
if (trace) out.print("matcher::world_tile_match: Aquifer Light_Plus_Heavy (%i, %i)\n", x, y);
return false;
}
break;
case embark_assist::defs::aquifer_ranges::None_Light_Heavy:
if (tile->aquifer != embark_assist::defs::aquifer_sizes::None_Light_Heavy) {
if ((tile->aquifer | tile->neighboring_aquifer) !=
(embark_assist::defs::None_Aquifer_Bit | embark_assist::defs::Light_Aquifer_Bit | embark_assist::defs::Heavy_Aquifer_Bit)) {
if (trace) out.print("matcher::world_tile_match: Aquifer None_Light_Heavy (%i, %i)\n", x, y);
return false;
}
break;
case embark_assist::defs::aquifer_ranges::Heavy:
if (!(static_cast<int8_t>(tile->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Heavy))) {
if (!(tile->aquifer & embark_assist::defs::Heavy_Aquifer_Bit)) {
if (trace) out.print("matcher::world_tile_match: Aquifer Heavy (%i, %i)\n", x, y);
return false;
}
@ -1648,7 +1652,8 @@ namespace embark_assist {
break; // No restriction
case embark_assist::defs::present_absent_ranges::Present:
if (tile->clay_count == 0) {
if (tile->clay_count == 0 &&
!tile->neighboring_clay) {
if (trace) out.print("matcher::world_tile_match: Clay Present (%i, %i)\n", x, y);
return false;
}
@ -1668,7 +1673,8 @@ namespace embark_assist {
break; // No restriction
case embark_assist::defs::present_absent_ranges::Present:
if (tile->sand_count == 0) {
if (tile->sand_count == 0 &&
!tile->neighboring_sand) {
if (trace) out.print("matcher::world_tile_match: Sand Present (%i, %i)\n", x, y);
return false;
}
@ -2382,44 +2388,10 @@ namespace embark_assist {
// Flat. No world tile checks. Need to look at the details
// Clay
switch (finder->clay) {
case embark_assist::defs::present_absent_ranges::NA:
break; // No restriction
case embark_assist::defs::present_absent_ranges::Present:
if (tile->clay_count == 0) {
if (trace) out.print("matcher::world_tile_match: NS Clay Present (%i, %i)\n", x, y);
return false;
}
break;
case embark_assist::defs::present_absent_ranges::Absent:
if (tile->clay_count == 256) {
if (trace) out.print("matcher::world_tile_match: NS Clay Absent (%i, %i)\n", x, y);
return false;
}
break;
}
// With no preliminary survey we don't know if incursions might bring clay, so we can't really exclude any tiles.
// Sand
switch (finder->sand) {
case embark_assist::defs::present_absent_ranges::NA:
break; // No restriction
case embark_assist::defs::present_absent_ranges::Present:
if (tile->sand_count == 0) {
if (trace) out.print("matcher::world_tile_match: NS Sand Present (%i, %i)\n", x, y);
return false;
}
break;
case embark_assist::defs::present_absent_ranges::Absent:
if (tile->sand_count == 256) {
if (trace) out.print("matcher::world_tile_match: NS Sand Absent (%i, %i)\n", x, y);
return false;
}
break;
}
// Same as with clay.
// Flux
switch (finder->flux) {
@ -3181,6 +3153,88 @@ uint16_t embark_assist::matcher::find(embark_assist::defs::match_iterators *iter
if (!iterator->active) {
embark_assist::matcher::move_cursor(iterator->x, iterator->y);
if (!survey_results->at(0).at(0).survey_completed) { // Every world tile has gone through preliminary survey, so add possible incursion resources to each tile.
for (uint16_t i = 0; i < world->worldgen.worldgen_parms.dim_x; i++) {
for (uint16_t k = 0; k < world->worldgen.worldgen_parms.dim_y; k++) {
embark_assist::defs::region_tile_datum* current = &survey_results->at(i).at(k);
if (i > 0 && k > 0) {
embark_assist::defs::region_tile_datum* target = &survey_results->at(i - 1).at(k - 1);
current->neighboring_sand |= target->south_row [15].sand;
current->neighboring_clay |= target->south_row[15].clay;
current->neighboring_aquifer |= target->south_row[15].aquifer;
}
if (k > 0) {
embark_assist::defs::region_tile_datum* target = &survey_results->at(i).at(k - 1);
for (uint16_t l = 0; l < 16; l++) {
current->neighboring_sand |= target->south_row[l].sand;
current->neighboring_clay |= target->south_row[l].clay;
current->neighboring_aquifer |= target->south_row[l].aquifer;
}
}
if (i < world->worldgen.worldgen_parms.dim_x - 1 && k > 0) {
embark_assist::defs::region_tile_datum* target = &survey_results->at(i + 1).at(k - 1);
current->neighboring_sand |= target->south_row[0].sand;
current->neighboring_clay |= target->south_row[0].clay;
current->neighboring_aquifer |= target->south_row[0].aquifer;
}
if (i > 0) {
embark_assist::defs::region_tile_datum* target = &survey_results->at(i - 1).at(k);
for (uint16_t l = 0; l < 16; l++) {
current->neighboring_sand |= target->east_column[l].sand;
current->neighboring_clay |= target->east_column[l].clay;
current->neighboring_aquifer |= target->east_column[l].aquifer;
}
}
if (i < world->worldgen.worldgen_parms.dim_x - 1) {
embark_assist::defs::region_tile_datum* target = &survey_results->at(i + 1).at(k);
for (uint16_t l = 0; l < 16; l++) {
current->neighboring_sand |= target->west_column[l].sand;
current->neighboring_clay |= target->west_column[l].clay;
current->neighboring_aquifer |= target->west_column[l].aquifer;
}
}
if (i > 0 && k < world->worldgen.worldgen_parms.dim_y - 1) {
embark_assist::defs::region_tile_datum* target = &survey_results->at(i - 1).at(k + 1);
current->neighboring_sand |= target->north_row[15].sand;
current->neighboring_clay |= target->north_row[15].clay;
current->neighboring_aquifer |= target->north_row[15].aquifer;
}
if (k < world->worldgen.worldgen_parms.dim_y - 1) {
embark_assist::defs::region_tile_datum* target = &survey_results->at(i).at(k + 1);
for (uint16_t l = 0; l < 16; l++) {
current->neighboring_sand |= target->north_row[l].sand;
current->neighboring_clay |= target->north_row[l].clay;
current->neighboring_aquifer |= target->north_row[l].aquifer;
}
}
if (i < world->worldgen.worldgen_parms.dim_x - 1 && k < world->worldgen.worldgen_parms.dim_y - 1) {
embark_assist::defs::region_tile_datum* target = &survey_results->at(i + 1).at(k + 1);
current->neighboring_sand |= target->north_row[0].sand;
current->neighboring_clay |= target->north_row[0].clay;
current->neighboring_aquifer |= target->north_row[0].aquifer;
}
survey_results->at(i).at(k).survey_completed = true; // A bit wasteful to add a flag to every entry when only the very first one is ever read...
}
}
}
}
}

@ -370,7 +370,7 @@ void embark_assist::overlay::set_embark(embark_assist::defs::site_infos *site_in
state->embark_info.push_back({ Screen::Pen(' ', COLOR_BROWN), "Flat" });
}
if (site_info->aquifer != embark_assist::defs::aquifer_sizes::None) {
if (site_info->aquifer != embark_assist::defs::None_Aquifer_Bit) {
std::string none = " ";
std::string light = " ";
std::string heavy = " ";
@ -379,34 +379,34 @@ void embark_assist::overlay::set_embark(embark_assist::defs::site_infos *site_in
std::string hv = "Hv";
switch (site_info->aquifer) {
case embark_assist::defs::aquifer_sizes::NA:
case embark_assist::defs::aquifer_sizes::None: // Neither of these should appear
case embark_assist::defs::Clear_Aquifer_Bits:
case embark_assist::defs::None_Aquifer_Bit: // Neither of these should appear
break;
case embark_assist::defs::aquifer_sizes::Light:
case embark_assist::defs::Light_Aquifer_Bit:
light = lt;
break;
case embark_assist::defs::aquifer_sizes::None_Light:
case embark_assist::defs::None_Aquifer_Bit | embark_assist::defs::Light_Aquifer_Bit:
none = no;
light = lt;
break;
case embark_assist::defs::aquifer_sizes::Heavy:
case embark_assist::defs::Heavy_Aquifer_Bit:
heavy = hv;
break;
case embark_assist::defs::aquifer_sizes::None_Heavy:
case embark_assist::defs::None_Aquifer_Bit | embark_assist::defs::Heavy_Aquifer_Bit:
none = no;
heavy = hv;
break;
case embark_assist::defs::aquifer_sizes::Light_Heavy:
case embark_assist::defs::Light_Aquifer_Bit | embark_assist::defs::Heavy_Aquifer_Bit:
light = lt;
heavy = hv;
break;
case embark_assist::defs::aquifer_sizes::None_Light_Heavy:
case embark_assist::defs::None_Aquifer_Bit | embark_assist::defs::Light_Aquifer_Bit | embark_assist::defs::Heavy_Aquifer_Bit:
none = no;
light = lt;
heavy = hv;

@ -507,7 +507,7 @@ namespace embark_assist {
int16_t elevation,
uint16_t x,
uint16_t y) {
site_info->aquifer = static_cast<embark_assist::defs::aquifer_sizes>(static_cast<int8_t>(mlt->aquifer) | static_cast<int8_t>(site_info->aquifer));
site_info->aquifer |= mlt->aquifer;
if (mlt->soil_depth < site_info->min_soil) {
site_info->min_soil = mlt->soil_depth;
@ -802,7 +802,11 @@ void embark_assist::survey::high_level_world_survey(embark_assist::defs::geo_dat
uint8_t offset_count = 0;
auto &results = survey_results->at(i).at(k);
results.surveyed = false;
results.aquifer = embark_assist::defs::aquifer_sizes::NA;
results.survey_completed = false;
results.neighboring_sand = false;
results.neighboring_clay = false;
results.neighboring_aquifer = embark_assist::defs::Clear_Aquifer_Bits;
results.aquifer = embark_assist::defs::Clear_Aquifer_Bits;
results.clay_count = 0;
results.sand_count = 0;
results.flux_count = 0;
@ -851,13 +855,13 @@ void embark_assist::survey::high_level_world_survey(embark_assist::defs::geo_dat
geo_index = world_data->region_map[adjusted.x][adjusted.y].geo_index;
if (geo_summary->at(geo_index).aquifer_absent) {
results.aquifer = static_cast<embark_assist::defs::aquifer_sizes>(static_cast<int8_t>(results.aquifer) | 1);
results.aquifer |= embark_assist::defs::None_Aquifer_Bit;
}
else if (world_data->region_map[adjusted.x][adjusted.y].drainage % 20 == 7) {
results.aquifer = static_cast<embark_assist::defs::aquifer_sizes>(static_cast<int8_t>(results.aquifer) | 4);
results.aquifer |= embark_assist::defs::Heavy_Aquifer_Bit;
}
else {
results.aquifer = static_cast<embark_assist::defs::aquifer_sizes>(static_cast<int8_t>(results.aquifer) | 2);
results.aquifer |= embark_assist::defs::Light_Aquifer_Bit;
}
if (!geo_summary->at(geo_index).clay_absent) results.clay_count++;
@ -1069,7 +1073,7 @@ void embark_assist::survey::survey_mid_level_tile(embark_assist::defs::geo_data
int16_t cur_shift = elevation + soil_erosion - 1;
aquifer = false;
mlt->at(i).at(k).aquifer = embark_assist::defs::aquifer_sizes::NA;
mlt->at(i).at(k).aquifer = embark_assist::defs::Clear_Aquifer_Bits;
mlt->at(i).at(k).clay = false;
mlt->at(i).at(k).sand = false;
mlt->at(i).at(k).flux = false;
@ -1220,13 +1224,13 @@ void embark_assist::survey::survey_mid_level_tile(embark_assist::defs::geo_data
}
}
if (!aquifer) {
mlt->at(i).at(k).aquifer = embark_assist::defs::aquifer_sizes::None;
mlt->at(i).at(k).aquifer = embark_assist::defs::None_Aquifer_Bit;
}
else if (world_data->region_map[adjusted.x][adjusted.y].drainage % 20 == 7) {
mlt->at(i).at(k).aquifer = embark_assist::defs::aquifer_sizes::Heavy;
mlt->at(i).at(k).aquifer = embark_assist::defs::Heavy_Aquifer_Bit;
}
else {
mlt->at(i).at(k).aquifer = embark_assist::defs::aquifer_sizes::Light;
mlt->at(i).at(k).aquifer = embark_assist::defs::Light_Aquifer_Bit;
}
mlt->at(i).at(k).trees = tree_level_of(world_data->regions[world_data->region_map[adjusted.x][adjusted.y].region_id]->type,
@ -1279,7 +1283,7 @@ void embark_assist::survey::survey_mid_level_tile(embark_assist::defs::geo_data
}
}
survey_results->at(x).at(y).aquifer = embark_assist::defs::aquifer_sizes::NA;
survey_results->at(x).at(y).aquifer = embark_assist::defs::Clear_Aquifer_Bits;
survey_results->at(x).at(y).clay_count = 0;
survey_results->at(x).at(y).sand_count = 0;
survey_results->at(x).at(y).flux_count = 0;
@ -1295,7 +1299,7 @@ void embark_assist::survey::survey_mid_level_tile(embark_assist::defs::geo_data
for (uint8_t i = 0; i < 16; i++) {
for (uint8_t k = 0; k < 16; k++) {
survey_results->at(x).at(y).aquifer = static_cast<embark_assist::defs::aquifer_sizes>(static_cast<int8_t>(survey_results->at(x).at(y).aquifer) | static_cast<int8_t>(mlt->at(i).at(k).aquifer));
survey_results->at(x).at(y).aquifer |= mlt->at(i).at(k).aquifer;
if (mlt->at(i).at(k).clay) { survey_results->at(x).at(y).clay_count++; }
if (mlt->at(i).at(k).sand) { survey_results->at(x).at(y).sand_count++; }
if (mlt->at(i).at(k).flux) { survey_results->at(x).at(y).flux_count++; }
@ -2245,7 +2249,7 @@ void embark_assist::survey::survey_embark(embark_assist::defs::mid_level_tiles *
state->y = y;
site_info->incursions_processed = true;
site_info->aquifer = embark_assist::defs::aquifer_sizes::NA;
site_info->aquifer = embark_assist::defs::Clear_Aquifer_Bits;
site_info->min_soil = 10;
site_info->max_soil = 0;
site_info->flat = true;
@ -2266,7 +2270,7 @@ void embark_assist::survey::survey_embark(embark_assist::defs::mid_level_tiles *
for (uint8_t i = state->local_min_x; i <= state->local_max_x; i++) {
for (uint8_t k = state->local_min_y; k <= state->local_max_y; k++) {
site_info->aquifer = static_cast<embark_assist::defs::aquifer_sizes>(static_cast<int8_t>(site_info->aquifer) | static_cast<int8_t>(mlt->at(i).at(k).aquifer));
site_info->aquifer |= mlt->at(i).at(k).aquifer;
if (mlt->at(i).at(k).soil_depth < site_info->min_soil) {
site_info->min_soil = mlt->at(i).at(k).soil_depth;