Added coal search to embark-assistant

develop
PatrikLundell 2018-12-04 14:57:23 +01:00
parent 1ef7f0746c
commit 8f9cbfeafd
1 changed files with 44 additions and 0 deletions

@ -46,6 +46,7 @@ namespace embark_assist {
bool clay_found = false;
bool sand_found = false;
bool flux_found = false;
bool coal_found = false;
uint8_t max_soil = 0;
bool uneven = false;
int16_t min_temperature = survey_results->at(x).at(y).min_temperature[mlt->at(start_x).at(start_y).biome_offset];
@ -174,6 +175,12 @@ namespace embark_assist {
flux_found = true;
}
// Coal
if (mlt->at(i).at(k).coal) {
if (finder->coal == embark_assist::defs::present_absent_ranges::Absent) return false;
coal_found = true;
}
// Min Soil
if (finder->soil_min != embark_assist::defs::soil_ranges::NA &&
mlt->at(i).at(k).soil_depth < static_cast<uint16_t>(finder->soil_min) &&
@ -335,6 +342,9 @@ namespace embark_assist {
// Flux
if (finder->flux == embark_assist::defs::present_absent_ranges::Present && !flux_found) return false;
// Coal
if (finder->coal == embark_assist::defs::present_absent_ranges::Present && !coal_found) return false;
// Min Soil
if (finder->soil_min != embark_assist::defs::soil_ranges::NA &&
finder->soil_min_everywhere == embark_assist::defs::all_present_ranges::Present &&
@ -571,6 +581,7 @@ namespace embark_assist {
case embark_assist::defs::present_absent_ranges::Present:
if (tile->clay_count == 0) return false;
break;
case embark_assist::defs::present_absent_ranges::Absent:
if (tile->clay_count > 256 - embark_size) return false;
break;
@ -584,6 +595,7 @@ namespace embark_assist {
case embark_assist::defs::present_absent_ranges::Present:
if (tile->sand_count == 0) return false;
break;
case embark_assist::defs::present_absent_ranges::Absent:
if (tile->sand_count > 256 - embark_size) return false;
break;
@ -597,11 +609,26 @@ namespace embark_assist {
case embark_assist::defs::present_absent_ranges::Present:
if (tile->flux_count == 0) return false;
break;
case embark_assist::defs::present_absent_ranges::Absent:
if (tile->flux_count > 256 - embark_size) return false;
break;
}
// Coal
switch (finder->coal) {
case embark_assist::defs::present_absent_ranges::NA:
break; // No restriction
case embark_assist::defs::present_absent_ranges::Present:
if (tile->coal_count == 0) return false;
break;
case embark_assist::defs::present_absent_ranges::Absent:
if (tile->coal_count > 256 - embark_size) return false;
break;
}
// Soil Min
switch (finder->soil_min) {
case embark_assist::defs::soil_ranges::NA:
@ -1027,6 +1054,7 @@ namespace embark_assist {
case embark_assist::defs::present_absent_ranges::Present:
if (tile->clay_count == 0) return false;
break;
case embark_assist::defs::present_absent_ranges::Absent:
if (tile->clay_count == 256) return false;
break;
@ -1040,6 +1068,7 @@ namespace embark_assist {
case embark_assist::defs::present_absent_ranges::Present:
if (tile->sand_count == 0) return false;
break;
case embark_assist::defs::present_absent_ranges::Absent:
if (tile->sand_count == 256) return false;
break;
@ -1053,11 +1082,26 @@ namespace embark_assist {
case embark_assist::defs::present_absent_ranges::Present:
if (tile->flux_count == 0) return false;
break;
case embark_assist::defs::present_absent_ranges::Absent:
if (tile->flux_count == 256) return false;
break;
}
// Coal
switch (finder->coal) {
case embark_assist::defs::present_absent_ranges::NA:
break; // No restriction
case embark_assist::defs::present_absent_ranges::Present:
if (tile->coal_count == 0) return false;
break;
case embark_assist::defs::present_absent_ranges::Absent:
if (tile->coal_count == 256) return false;
break;
}
// Soil Min
switch (finder->soil_min) {
case embark_assist::defs::soil_ranges::NA: