reworked aquifer bit fiddling

develop
PatrikLundell 2020-11-14 14:43:43 +01:00
parent d51b56c780
commit 46835c9edd
5 changed files with 82 additions and 98 deletions

@ -26,16 +26,10 @@ namespace embark_assist {
Major Major
}; };
enum class aquifer_sizes : int8_t { const uint8_t Clear_Aquifer_Bits = 0;
NA, const uint8_t None_Aquifer_Bit = 1;
None, const uint8_t Light_Aquifer_Bit = 2;
Light, const uint8_t Heavy_Aquifer_Bit = 4;
None_Light,
Heavy,
None_Heavy,
Light_Heavy,
None_Light_Heavy
};
enum class tree_levels : int8_t { enum class tree_levels : int8_t {
None, None,
@ -46,7 +40,7 @@ namespace embark_assist {
}; };
struct mid_level_tile { struct mid_level_tile {
aquifer_sizes aquifer = aquifer_sizes::NA; uint8_t aquifer = Clear_Aquifer_Bits;
bool clay = false; bool clay = false;
bool sand = false; bool sand = false;
bool flux = false; bool flux = false;
@ -74,8 +68,8 @@ namespace embark_assist {
bool survey_completed = false; 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_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. bool neighboring_sand = false; // if they actually provided an incursion. This allows the code to add these potential tiles to the ones checked.
aquifer_sizes neighboring_aquifer = aquifer_sizes::NA; uint8_t neighboring_aquifer = Clear_Aquifer_Bits;
aquifer_sizes aquifer = aquifer_sizes::NA; uint8_t aquifer = Clear_Aquifer_Bits;
uint16_t clay_count = 0; uint16_t clay_count = 0;
uint16_t sand_count = 0; uint16_t sand_count = 0;
uint16_t flux_count = 0; uint16_t flux_count = 0;
@ -151,7 +145,7 @@ namespace embark_assist {
struct site_infos { struct site_infos {
bool incursions_processed; bool incursions_processed;
aquifer_sizes aquifer; uint8_t aquifer;
uint8_t min_soil; uint8_t min_soil;
uint8_t max_soil; uint8_t max_soil;
bool flat; bool flat;

@ -314,8 +314,8 @@ command_result embark_assistant(color_ostream &out, std::vector <std::string> &
embark_assist::main::state->survey_results[i][k].survey_completed = false; 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_clay = false;
embark_assist::main::state->survey_results[i][k].neighboring_sand = 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::aquifer_sizes::NA; 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::aquifer_sizes::NA; 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].clay_count = 0;
embark_assist::main::state->survey_results[i][k].sand_count = 0; embark_assist::main::state->survey_results[i][k].sand_count = 0;
embark_assist::main::state->survey_results[i][k].flux_count = 0; embark_assist::main::state->survey_results[i][k].flux_count = 0;

@ -29,7 +29,7 @@ namespace embark_assist {
struct matcher_info { struct matcher_info {
bool savagery_found[3] = { false, false, false }; bool savagery_found[3] = { false, false, false };
bool evilness_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; bool river_found = false;
uint8_t max_waterfall = 0; uint8_t max_waterfall = 0;
uint16_t elevation; uint16_t elevation;
@ -120,14 +120,14 @@ namespace embark_assist {
} }
// Aquifer // 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) { switch (finder->aquifer) {
case embark_assist::defs::aquifer_ranges::NA: case embark_assist::defs::aquifer_ranges::NA:
break; break;
case embark_assist::defs::aquifer_ranges::None: 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; *failed_match = true;
return; return;
} }
@ -135,14 +135,14 @@ namespace embark_assist {
case embark_assist::defs::aquifer_ranges::At_Most_Light: case embark_assist::defs::aquifer_ranges::At_Most_Light:
case embark_assist::defs::aquifer_ranges::None_Plus_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; *failed_match = true;
return; return;
} }
break; break;
case embark_assist::defs::aquifer_ranges::Light: 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; *failed_match = true;
return; return;
} }
@ -150,14 +150,14 @@ namespace embark_assist {
case embark_assist::defs::aquifer_ranges::At_Least_Light: case embark_assist::defs::aquifer_ranges::At_Least_Light:
case embark_assist::defs::aquifer_ranges::Light_Plus_Heavy: 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; *failed_match = true;
return; return;
} }
break; break;
case embark_assist::defs::aquifer_ranges::None_Plus_Heavy: 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; *failed_match = true;
return; return;
} }
@ -169,7 +169,7 @@ namespace embark_assist {
break; break;
case embark_assist::defs::aquifer_ranges::Heavy: 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; *failed_match = true;
return; return;
} }
@ -645,32 +645,32 @@ namespace embark_assist {
} }
// Aquifer // 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) { switch (finder->aquifer) {
case embark_assist::defs::aquifer_ranges::NA: case embark_assist::defs::aquifer_ranges::NA:
break; break;
case embark_assist::defs::aquifer_ranges::None: 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; break;
case embark_assist::defs::aquifer_ranges::At_Most_Light: case embark_assist::defs::aquifer_ranges::At_Most_Light:
case embark_assist::defs::aquifer_ranges::None_Plus_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; break;
case embark_assist::defs::aquifer_ranges::Light: 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; break;
case embark_assist::defs::aquifer_ranges::At_Least_Light: case embark_assist::defs::aquifer_ranges::At_Least_Light:
case embark_assist::defs::aquifer_ranges::Light_Plus_Heavy: 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; break;
case embark_assist::defs::aquifer_ranges::None_Plus_Heavy: 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; break;
case embark_assist::defs::aquifer_ranges::None_Plus_At_Least_Light: case embark_assist::defs::aquifer_ranges::None_Plus_At_Least_Light:
@ -679,7 +679,7 @@ namespace embark_assist {
break; break;
case embark_assist::defs::aquifer_ranges::Heavy: 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; break;
} }
@ -1223,29 +1223,29 @@ namespace embark_assist {
break; break;
case embark_assist::defs::aquifer_ranges::None_Plus_Light: 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; break;
case embark_assist::defs::aquifer_ranges::None_Plus_At_Least_Light: case embark_assist::defs::aquifer_ranges::None_Plus_At_Least_Light:
if (result.aquifer != embark_assist::defs::aquifer_sizes::None_Light && if (result.aquifer != (embark_assist::defs::None_Aquifer_Bit | embark_assist::defs::Light_Aquifer_Bit) &&
result.aquifer != embark_assist::defs::aquifer_sizes::None_Heavy) return false; result.aquifer != (embark_assist::defs::None_Aquifer_Bit | embark_assist::defs::Heavy_Aquifer_Bit)) return false;
break; break;
case embark_assist::defs::aquifer_ranges::None_Plus_Heavy: 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; break;
case embark_assist::defs::aquifer_ranges::At_Most_Light_Plus_Heavy: case embark_assist::defs::aquifer_ranges::At_Most_Light_Plus_Heavy:
if (result.aquifer != embark_assist::defs::aquifer_sizes::None_Heavy && if (result.aquifer != (embark_assist::defs::None_Aquifer_Bit | embark_assist::defs::Heavy_Aquifer_Bit) &&
result.aquifer != embark_assist::defs::aquifer_sizes::Light_Heavy) return false; result.aquifer != (embark_assist::defs::Light_Aquifer_Bit | embark_assist::defs::Heavy_Aquifer_Bit)) return false;
break; break;
case embark_assist::defs::aquifer_ranges::Light_Plus_Heavy: 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; break;
case embark_assist::defs::aquifer_ranges::None_Light_Heavy: 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; break;
} }
@ -1504,93 +1504,83 @@ namespace embark_assist {
break; break;
case embark_assist::defs::aquifer_ranges::None: 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); if (trace) out.print("matcher::world_tile_match: Aquifer None (%i, %i)\n", x, y);
return false; return false;
} }
break; break;
case embark_assist::defs::aquifer_ranges::At_Most_Light: case embark_assist::defs::aquifer_ranges::At_Most_Light:
if (tile->aquifer == 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); if (trace) out.print("matcher::world_tile_match: Aquifer At_Most_Light (%i, %i)\n", x, y);
return false; return false;
} }
break; break;
case embark_assist::defs::aquifer_ranges::None_Plus_Light: 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)) && if (!((tile->aquifer | tile->neighboring_aquifer) & embark_assist::defs::None_Aquifer_Bit) ||
(!(static_cast<int8_t>(tile->neighboring_aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::None)))) || !((tile->aquifer | tile->neighboring_aquifer) & embark_assist::defs::Light_Aquifer_Bit)) {
(!(static_cast<int8_t>(tile->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Light)) &&
(!(static_cast<int8_t>(tile->neighboring_aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Light))))) {
if (trace) out.print("matcher::world_tile_match: Aquifer None_Plus_Light (%i, %i)\n", x, y); if (trace) out.print("matcher::world_tile_match: Aquifer None_Plus_Light (%i, %i)\n", x, y);
return false; return false;
} }
break; break;
case embark_assist::defs::aquifer_ranges::None_Plus_At_Least_Light: 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)) && if (!((tile->aquifer | tile->neighboring_aquifer) & embark_assist::defs::None_Aquifer_Bit) ||
(!(static_cast<int8_t>(tile->neighboring_aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::None)))) || ((tile->aquifer | tile->neighboring_aquifer) == embark_assist::defs::None_Aquifer_Bit)) {
(!(static_cast<int8_t>(tile->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Light_Heavy)) &&
(!(static_cast<int8_t>(tile->neighboring_aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Light_Heavy))))) {
if (trace) out.print("matcher::world_tile_match: Aquifer None_Plus_At_Least_Light (%i, %i)\n", x, y); if (trace) out.print("matcher::world_tile_match: Aquifer None_Plus_At_Least_Light (%i, %i)\n", x, y);
return false; return false;
} }
break; break;
case embark_assist::defs::aquifer_ranges::Light: 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); if (trace) out.print("matcher::world_tile_match: Aquifer Light (%i, %i)\n", x, y);
return false; return false;
} }
break; break;
case embark_assist::defs::aquifer_ranges::At_Least_Light: 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) {
((static_cast<int8_t>(tile->neighboring_aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::None)))) {
if (trace) out.print("matcher::world_tile_match: Aquifer At_Least_Light (%i, %i)\n", x, y); if (trace) out.print("matcher::world_tile_match: Aquifer At_Least_Light (%i, %i)\n", x, y);
return false; return false;
} }
break; break;
case embark_assist::defs::aquifer_ranges::None_Plus_Heavy: 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)) && if (!((tile->aquifer | tile->neighboring_aquifer) & embark_assist::defs::None_Aquifer_Bit) ||
(!(static_cast<int8_t>(tile->neighboring_aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::None)))) || !((tile->aquifer | tile->neighboring_aquifer) & embark_assist::defs::Heavy_Aquifer_Bit)) {
(!(static_cast<int8_t>(tile->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Heavy)) &&
(!(static_cast<int8_t>(tile->neighboring_aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Heavy))))) {
if (trace) out.print("matcher::world_tile_match: Aquifer None_Plus_Heavy (%i, %i)\n", x, y); if (trace) out.print("matcher::world_tile_match: Aquifer None_Plus_Heavy (%i, %i)\n", x, y);
return false; return false;
} }
break; break;
case embark_assist::defs::aquifer_ranges::At_Most_Light_Plus_Heavy: 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)) && if ((tile->aquifer | tile->neighboring_aquifer) == embark_assist::defs::Heavy_Aquifer_Bit ||
(!(static_cast<int8_t>(tile->neighboring_aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Heavy)))) || !((tile->aquifer | tile->neighboring_aquifer) & embark_assist::defs::Heavy_Aquifer_Bit)) {
(!(static_cast<int8_t>(tile->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::None_Light)) &&
(!(static_cast<int8_t>(tile->neighboring_aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::None_Light))))) {
if (trace) out.print("matcher::world_tile_match: Aquifer At_Most_Light_Plus_Heavy (%i, %i)\n", x, y); if (trace) out.print("matcher::world_tile_match: Aquifer At_Most_Light_Plus_Heavy (%i, %i)\n", x, y);
return false; return false;
} }
break; break;
case embark_assist::defs::aquifer_ranges::Light_Plus_Heavy: 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)) && if (!((tile->aquifer | tile->neighboring_aquifer) & embark_assist::defs::Light_Aquifer_Bit) ||
(!(static_cast<int8_t>(tile->neighboring_aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Light)))) || !((tile->aquifer | tile->neighboring_aquifer) & embark_assist::defs::Heavy_Aquifer_Bit)) {
(!(static_cast<int8_t>(tile->aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Heavy)) &&
(!(static_cast<int8_t>(tile->neighboring_aquifer) & static_cast<int8_t>(embark_assist::defs::aquifer_sizes::Heavy))))) {
if (trace) out.print("matcher::world_tile_match: Aquifer Light_Plus_Heavy (%i, %i)\n", x, y); if (trace) out.print("matcher::world_tile_match: Aquifer Light_Plus_Heavy (%i, %i)\n", x, y);
return false; return false;
} }
break; break;
case embark_assist::defs::aquifer_ranges::None_Light_Heavy: 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); if (trace) out.print("matcher::world_tile_match: Aquifer None_Light_Heavy (%i, %i)\n", x, y);
return false; return false;
} }
break; break;
case embark_assist::defs::aquifer_ranges::Heavy: 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); if (trace) out.print("matcher::world_tile_match: Aquifer Heavy (%i, %i)\n", x, y);
return false; return false;
} }
@ -3174,7 +3164,7 @@ uint16_t embark_assist::matcher::find(embark_assist::defs::match_iterators *iter
current->neighboring_sand |= target->south_row [15].sand; current->neighboring_sand |= target->south_row [15].sand;
current->neighboring_clay |= target->south_row[15].clay; current->neighboring_clay |= target->south_row[15].clay;
current->neighboring_aquifer = static_cast<embark_assist::defs::aquifer_sizes>(static_cast<int8_t>(current->neighboring_aquifer) | static_cast<int8_t>(target->south_row[15].aquifer)); current->neighboring_aquifer |= target->south_row[15].aquifer;
} }
if (k > 0) { if (k > 0) {
@ -3183,7 +3173,7 @@ uint16_t embark_assist::matcher::find(embark_assist::defs::match_iterators *iter
for (uint16_t l = 0; l < 16; l++) { for (uint16_t l = 0; l < 16; l++) {
current->neighboring_sand |= target->south_row[l].sand; current->neighboring_sand |= target->south_row[l].sand;
current->neighboring_clay |= target->south_row[l].clay; current->neighboring_clay |= target->south_row[l].clay;
current->neighboring_aquifer = static_cast<embark_assist::defs::aquifer_sizes>(static_cast<int8_t>(current->neighboring_aquifer) | static_cast<int8_t>(target->south_row[l].aquifer)); current->neighboring_aquifer |= target->south_row[l].aquifer;
} }
} }
@ -3192,7 +3182,7 @@ uint16_t embark_assist::matcher::find(embark_assist::defs::match_iterators *iter
current->neighboring_sand |= target->south_row[0].sand; current->neighboring_sand |= target->south_row[0].sand;
current->neighboring_clay |= target->south_row[0].clay; current->neighboring_clay |= target->south_row[0].clay;
current->neighboring_aquifer = static_cast<embark_assist::defs::aquifer_sizes>(static_cast<int8_t>(current->neighboring_aquifer) | static_cast<int8_t>(target->south_row[0].aquifer)); current->neighboring_aquifer |= target->south_row[0].aquifer;
} }
if (i > 0) { if (i > 0) {
@ -3201,7 +3191,7 @@ uint16_t embark_assist::matcher::find(embark_assist::defs::match_iterators *iter
for (uint16_t l = 0; l < 16; l++) { for (uint16_t l = 0; l < 16; l++) {
current->neighboring_sand |= target->east_column[l].sand; current->neighboring_sand |= target->east_column[l].sand;
current->neighboring_clay |= target->east_column[l].clay; current->neighboring_clay |= target->east_column[l].clay;
current->neighboring_aquifer = static_cast<embark_assist::defs::aquifer_sizes>(static_cast<int8_t>(current->neighboring_aquifer) | static_cast<int8_t>(target->east_column[l].aquifer)); current->neighboring_aquifer |= target->east_column[l].aquifer;
} }
} }
@ -3211,7 +3201,7 @@ uint16_t embark_assist::matcher::find(embark_assist::defs::match_iterators *iter
for (uint16_t l = 0; l < 16; l++) { for (uint16_t l = 0; l < 16; l++) {
current->neighboring_sand |= target->west_column[l].sand; current->neighboring_sand |= target->west_column[l].sand;
current->neighboring_clay |= target->west_column[l].clay; current->neighboring_clay |= target->west_column[l].clay;
current->neighboring_aquifer = static_cast<embark_assist::defs::aquifer_sizes>(static_cast<int8_t>(current->neighboring_aquifer) | static_cast<int8_t>(target->west_column[l].aquifer)); current->neighboring_aquifer |= target->west_column[l].aquifer;
} }
} }
@ -3220,7 +3210,7 @@ uint16_t embark_assist::matcher::find(embark_assist::defs::match_iterators *iter
current->neighboring_sand |= target->north_row[15].sand; current->neighboring_sand |= target->north_row[15].sand;
current->neighboring_clay |= target->north_row[15].clay; current->neighboring_clay |= target->north_row[15].clay;
current->neighboring_aquifer = static_cast<embark_assist::defs::aquifer_sizes>(static_cast<int8_t>(current->neighboring_aquifer) | static_cast<int8_t>(target->north_row[15].aquifer)); current->neighboring_aquifer |= target->north_row[15].aquifer;
} }
if (k < world->worldgen.worldgen_parms.dim_y - 1) { if (k < world->worldgen.worldgen_parms.dim_y - 1) {
@ -3229,7 +3219,7 @@ uint16_t embark_assist::matcher::find(embark_assist::defs::match_iterators *iter
for (uint16_t l = 0; l < 16; l++) { for (uint16_t l = 0; l < 16; l++) {
current->neighboring_sand |= target->north_row[l].sand; current->neighboring_sand |= target->north_row[l].sand;
current->neighboring_clay |= target->north_row[l].clay; current->neighboring_clay |= target->north_row[l].clay;
current->neighboring_aquifer = static_cast<embark_assist::defs::aquifer_sizes>(static_cast<int8_t>(current->neighboring_aquifer) | static_cast<int8_t>(target->north_row[l].aquifer)); current->neighboring_aquifer |= target->north_row[l].aquifer;
} }
} }
@ -3238,7 +3228,7 @@ uint16_t embark_assist::matcher::find(embark_assist::defs::match_iterators *iter
current->neighboring_sand |= target->north_row[0].sand; current->neighboring_sand |= target->north_row[0].sand;
current->neighboring_clay |= target->north_row[0].clay; current->neighboring_clay |= target->north_row[0].clay;
current->neighboring_aquifer = static_cast<embark_assist::defs::aquifer_sizes>(static_cast<int8_t>(current->neighboring_aquifer) | static_cast<int8_t>(target->north_row[0].aquifer)); 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... 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" }); 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 none = " ";
std::string light = " "; std::string light = " ";
std::string heavy = " "; std::string heavy = " ";
@ -379,34 +379,34 @@ void embark_assist::overlay::set_embark(embark_assist::defs::site_infos *site_in
std::string hv = "Hv"; std::string hv = "Hv";
switch (site_info->aquifer) { switch (site_info->aquifer) {
case embark_assist::defs::aquifer_sizes::NA: case embark_assist::defs::Clear_Aquifer_Bits:
case embark_assist::defs::aquifer_sizes::None: // Neither of these should appear case embark_assist::defs::None_Aquifer_Bit: // Neither of these should appear
break; break;
case embark_assist::defs::aquifer_sizes::Light: case embark_assist::defs::Light_Aquifer_Bit:
light = lt; light = lt;
break; break;
case embark_assist::defs::aquifer_sizes::None_Light: case embark_assist::defs::None_Aquifer_Bit | embark_assist::defs::Light_Aquifer_Bit:
none = no; none = no;
light = lt; light = lt;
break; break;
case embark_assist::defs::aquifer_sizes::Heavy: case embark_assist::defs::Heavy_Aquifer_Bit:
heavy = hv; heavy = hv;
break; break;
case embark_assist::defs::aquifer_sizes::None_Heavy: case embark_assist::defs::None_Aquifer_Bit | embark_assist::defs::Heavy_Aquifer_Bit:
none = no; none = no;
heavy = hv; heavy = hv;
break; break;
case embark_assist::defs::aquifer_sizes::Light_Heavy: case embark_assist::defs::Light_Aquifer_Bit | embark_assist::defs::Heavy_Aquifer_Bit:
light = lt; light = lt;
heavy = hv; heavy = hv;
break; 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; none = no;
light = lt; light = lt;
heavy = hv; heavy = hv;

@ -507,7 +507,7 @@ namespace embark_assist {
int16_t elevation, int16_t elevation,
uint16_t x, uint16_t x,
uint16_t y) { 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) { if (mlt->soil_depth < site_info->min_soil) {
site_info->min_soil = mlt->soil_depth; site_info->min_soil = mlt->soil_depth;
@ -805,8 +805,8 @@ void embark_assist::survey::high_level_world_survey(embark_assist::defs::geo_dat
results.survey_completed = false; results.survey_completed = false;
results.neighboring_sand = false; results.neighboring_sand = false;
results.neighboring_clay = false; results.neighboring_clay = false;
results.neighboring_aquifer = embark_assist::defs::aquifer_sizes::NA; results.neighboring_aquifer = embark_assist::defs::Clear_Aquifer_Bits;
results.aquifer = embark_assist::defs::aquifer_sizes::NA; results.aquifer = embark_assist::defs::Clear_Aquifer_Bits;
results.clay_count = 0; results.clay_count = 0;
results.sand_count = 0; results.sand_count = 0;
results.flux_count = 0; results.flux_count = 0;
@ -855,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; geo_index = world_data->region_map[adjusted.x][adjusted.y].geo_index;
if (geo_summary->at(geo_index).aquifer_absent) { 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) { 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 { 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++; if (!geo_summary->at(geo_index).clay_absent) results.clay_count++;
@ -1073,7 +1073,7 @@ void embark_assist::survey::survey_mid_level_tile(embark_assist::defs::geo_data
int16_t cur_shift = elevation + soil_erosion - 1; int16_t cur_shift = elevation + soil_erosion - 1;
aquifer = false; 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).clay = false;
mlt->at(i).at(k).sand = false; mlt->at(i).at(k).sand = false;
mlt->at(i).at(k).flux = false; mlt->at(i).at(k).flux = false;
@ -1224,13 +1224,13 @@ void embark_assist::survey::survey_mid_level_tile(embark_assist::defs::geo_data
} }
} }
if (!aquifer) { 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) { 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 { 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, mlt->at(i).at(k).trees = tree_level_of(world_data->regions[world_data->region_map[adjusted.x][adjusted.y].region_id]->type,
@ -1283,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).clay_count = 0;
survey_results->at(x).at(y).sand_count = 0; survey_results->at(x).at(y).sand_count = 0;
survey_results->at(x).at(y).flux_count = 0; survey_results->at(x).at(y).flux_count = 0;
@ -1299,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 i = 0; i < 16; i++) {
for (uint8_t k = 0; k < 16; k++) { 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).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).sand) { survey_results->at(x).at(y).sand_count++; }
if (mlt->at(i).at(k).flux) { survey_results->at(x).at(y).flux_count++; } if (mlt->at(i).at(k).flux) { survey_results->at(x).at(y).flux_count++; }
@ -2249,7 +2249,7 @@ void embark_assist::survey::survey_embark(embark_assist::defs::mid_level_tiles *
state->y = y; state->y = y;
site_info->incursions_processed = true; 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->min_soil = 10;
site_info->max_soil = 0; site_info->max_soil = 0;
site_info->flat = true; site_info->flat = true;
@ -2270,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 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++) { 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) { if (mlt->at(i).at(k).soil_depth < site_info->min_soil) {
site_info->min_soil = mlt->at(i).at(k).soil_depth; site_info->min_soil = mlt->at(i).at(k).soil_depth;