Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrected world level incursion search criteria #1713

Merged
merged 6 commits into from Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.txt
Expand Up @@ -50,6 +50,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `buildingplan`: new global settings for whether generic building materials should match blocks, boulders, logs, and/or bars. defaults are everything but bars.
- `quickfort`: The Dreamfort sample blueprints now have complete walkthroughs for each fort level and importable orders that automate basic fort stock management
- `quickfort`: More blueprints have been added to the blueprints library: several bedroom layouts, the Saracen Crypts, and the complete fortress example from Python Quickfort: TheQuickFortress
- `embark-assistant`: split the lair types displayed on the local map into mound, burrow, and lair
Copy link
Member

@lethosor lethosor Nov 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating this - are the other changes in this PR essentially a continuation of #1704?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's a continuation of that PR, so the line in the changelog covers it. The magic number->named number change is too internal and marginal to get a description, as it doesn't modify the functionality (apart from introduced bugs...).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks for confirming


## API
- `buildingplan`: added Lua interface API
Expand Down
39 changes: 36 additions & 3 deletions plugins/embark-assistant/defs.h
Expand Up @@ -3,6 +3,7 @@
#include <array>
#include <string>
#include <vector>
#include "df/biome_type.h"
#include "df/world_region_type.h"

using namespace std;
Expand Down Expand Up @@ -31,6 +32,35 @@ namespace embark_assist {
const uint8_t Light_Aquifer_Bit = 2;
const uint8_t Heavy_Aquifer_Bit = 4;

namespace directions {
enum directions {
Northwest,
North,
Northeast,
West,
Center,
East,
Southwest,
South,
Southeast
};
};

namespace offset_directions {
enum offset_directions {
NA, // 0 isn't used for offsets
Southwest,
South,
Southeast,
West,
Center,
East,
Northwest,
North,
Northeast
};
};

enum class tree_levels : int8_t {
None,
Very_Scarce,
Expand Down Expand Up @@ -66,9 +96,12 @@ namespace embark_assist {
struct region_tile_datum {
bool surveyed = 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_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;
bool neighboring_clay = false; // These elements are updated after the survey by checking if there are any border MLTs in neighboring tiles that
bool neighboring_sand = false; // provide the resource through an incursion.
bool neighboring_biomes[ENUM_LAST_ITEM(biome_type) + 1];
bool neighboring_region_types[ENUM_LAST_ITEM(world_region_type) + 1];
bool neighboring_savagery[3];
bool neighboring_evilness[3];
uint8_t aquifer = Clear_Aquifer_Bits;
uint16_t clay_count = 0;
uint16_t sand_count = 0;
Expand Down
14 changes: 13 additions & 1 deletion plugins/embark-assistant/embark-assistant.cpp
Expand Up @@ -314,7 +314,19 @@ 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].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;
for (uint8_t l = 0; l <= ENUM_LAST_ITEM(biome_type); l++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also a FOR_ENUM_ITEMS macro in DataDefs.h, in case you were unaware - you're perfectly welcome not to use it, though (for stylistic reasons or otherwise - it does yield values of the enum type instead of the base integer type, although I think either would work here).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I didn't know that.

embark_assist::main::state->survey_results[i][k].neighboring_biomes[l] = false;
}

for (uint8_t l = 0; l <= ENUM_LAST_ITEM(world_region_type); l++) {
embark_assist::main::state->survey_results[i][k].neighboring_region_types[l] = false;
}

for (uint8_t l = 0; l < 2; l++) {
embark_assist::main::state->survey_results[i][k].neighboring_savagery[l] = false;
embark_assist::main::state->survey_results[i][k].neighboring_evilness[l] = false;
}

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;
Expand Down
18 changes: 11 additions & 7 deletions plugins/embark-assistant/help_ui.cpp
Expand Up @@ -157,7 +157,9 @@ namespace embark_assist{
help_text.push_back("C: Camp");
help_text.push_back("c: Cave. Only displayed if the DF worldgen parameter does not display caves.");
help_text.push_back("i: Important Location. The author doesn't actually know what those are.");
help_text.push_back("l: Lair");
help_text.push_back("m: Lair (Simple Mound)");
help_text.push_back("b: Lair (Simple Burrow)");
help_text.push_back("l: Lair (Wilderness Location)");
help_text.push_back("L: Labyrinth");
help_text.push_back("M: Monument. The author is unsure how/if this is broken down further.");
help_text.push_back("S: Shrine");
Expand Down Expand Up @@ -338,7 +340,7 @@ namespace embark_assist{
help_text.push_back(" the N, followed by the one to the W, and lastly the one acting as the");
help_text.push_back(" reference. This means there's a risk embarks with such 'trouble' corners");
help_text.push_back(" may get affected corner(s) evaluated incorrectly.");
help_text.push_back("Version 0.11 2020-03-03");
help_text.push_back("Version 0.12 2020-11-17");

break;
}
Expand Down Expand Up @@ -367,11 +369,13 @@ namespace embark_assist{
embark_assist::screen::paintString(site_pen, 1, 4, "C");
embark_assist::screen::paintString(site_pen, 1, 5, "c");
embark_assist::screen::paintString(site_pen, 1, 6, "i");
embark_assist::screen::paintString(site_pen, 1, 7, "l");
embark_assist::screen::paintString(site_pen, 1, 8, "L");
embark_assist::screen::paintString(site_pen, 1, 9, "M");
embark_assist::screen::paintString(site_pen, 1, 10, "S");
embark_assist::screen::paintString(site_pen, 1, 11, "V");
embark_assist::screen::paintString(site_pen, 1, 7, "m");
embark_assist::screen::paintString(site_pen, 1, 8, "b");
embark_assist::screen::paintString(site_pen, 1, 9, "l");
embark_assist::screen::paintString(site_pen, 1, 10, "L");
embark_assist::screen::paintString(site_pen, 1, 11, "M");
embark_assist::screen::paintString(site_pen, 1, 12, "S");
embark_assist::screen::paintString(site_pen, 1, 13, "V");
break;

case pages::Finder:
Expand Down