Skip to content

Commit

Permalink
Added coal search to embark-assistant
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrikLundell committed Dec 4, 2018
1 parent 1ef7f07 commit 8f9cbfe
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions plugins/embark-assistant/matcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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) &&
Expand Down Expand Up @@ -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 &&
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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:
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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:
Expand Down

0 comments on commit 8f9cbfe

Please sign in to comment.