Merge remote-tracking branch 'bseiller/ea_improve_survey_performance_keep_mlts_on_heap' into develop

develop
lethosor 2021-02-23 00:21:35 -05:00
commit af34b5d614
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
5 changed files with 52 additions and 16 deletions

@ -34,6 +34,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
# Future # Future
## Misc Improvements ## Misc Improvements
- `embark-assistant`: slightly improved performance of surveying
- `quickfort`: Dreamfort blueprint set improvements: `significant <http://www.bay12forums.com/smf/index.php?topic=176889.msg8239017#msg8239017>`_ refinements across the entire blueprint set. Dreamfort is now much faster, much more efficient, and much easier to use. The `checklist <https://docs.google.com/spreadsheets/d/13PVZ2h3Mm3x_G1OXQvwKd7oIR2lK4A1Ahf6Om1kFigw/edit#gid=1459509569>`__ now includes a mini-walkthrough for quick reference. The spreadsheet now also includes `embark profile suggestions <https://docs.google.com/spreadsheets/d/13PVZ2h3Mm3x_G1OXQvwKd7oIR2lK4A1Ahf6Om1kFigw/edit#gid=149144025>`__ - `quickfort`: Dreamfort blueprint set improvements: `significant <http://www.bay12forums.com/smf/index.php?topic=176889.msg8239017#msg8239017>`_ refinements across the entire blueprint set. Dreamfort is now much faster, much more efficient, and much easier to use. The `checklist <https://docs.google.com/spreadsheets/d/13PVZ2h3Mm3x_G1OXQvwKd7oIR2lK4A1Ahf6Om1kFigw/edit#gid=1459509569>`__ now includes a mini-walkthrough for quick reference. The spreadsheet now also includes `embark profile suggestions <https://docs.google.com/spreadsheets/d/13PVZ2h3Mm3x_G1OXQvwKd7oIR2lK4A1Ahf6Om1kFigw/edit#gid=149144025>`__
- `quickfort`: added aliases for configuring masterwork and artifact core quality for all stockpile categories that have them; made it possible to take from multiple stockpiles in the ``quantumstop`` alias - `quickfort`: added aliases for configuring masterwork and artifact core quality for all stockpile categories that have them; made it possible to take from multiple stockpiles in the ``quantumstop`` alias

@ -47,6 +47,7 @@ namespace embark_assist {
embark_assist::defs::match_results match_results; embark_assist::defs::match_results match_results;
embark_assist::defs::match_iterators match_iterator; embark_assist::defs::match_iterators match_iterator;
uint16_t max_inorganic; uint16_t max_inorganic;
embark_assist::defs::mid_level_tiles mlt;
}; };
static states *state = nullptr; static states *state = nullptr;
@ -64,14 +65,12 @@ namespace embark_assist {
} }
auto screen = Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0); auto screen = Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0);
embark_assist::defs::mid_level_tiles mlt;
embark_assist::survey::initiate(&mlt);
embark_assist::survey::survey_mid_level_tile(&state->geo_summary, embark_assist::survey::survey_mid_level_tile(&state->geo_summary,
&state->survey_results, &state->survey_results,
&mlt); &state->mlt);
embark_assist::survey::survey_embark(&mlt, embark_assist::survey::survey_embark(&state->mlt,
&state->survey_results, &state->survey_results,
&state->site_info, &state->site_info,
false); false);
@ -129,6 +128,7 @@ namespace embark_assist {
void shutdown() { void shutdown() {
// color_ostream_proxy out(Core::getInstance().getConsole()); // color_ostream_proxy out(Core::getInstance().getConsole());
embark_assist::survey::shutdown(); embark_assist::survey::shutdown();
embark_assist::matcher::shutdown();
embark_assist::finder_ui::shutdown(); embark_assist::finder_ui::shutdown();
embark_assist::overlay::shutdown(); embark_assist::overlay::shutdown();
delete state; delete state;
@ -309,6 +309,8 @@ command_result embark_assistant(color_ostream &out, std::vector <std::string> &
} }
embark_assist::survey::setup(embark_assist::main::state->max_inorganic); embark_assist::survey::setup(embark_assist::main::state->max_inorganic);
embark_assist::survey::initiate(&embark_assist::main::state->mlt);
embark_assist::matcher::setup();
embark_assist::main::state->geo_summary.resize(world_data->geo_biomes.size()); embark_assist::main::state->geo_summary.resize(world_data->geo_biomes.size());
embark_assist::main::state->survey_results.resize(world->worldgen.worldgen_parms.dim_x); embark_assist::main::state->survey_results.resize(world->worldgen.worldgen_parms.dim_x);
@ -378,7 +380,7 @@ command_result embark_assistant(color_ostream &out, std::vector <std::string> &
embark_assist::survey::survey_region_sites(&embark_assist::main::state->region_sites); embark_assist::survey::survey_region_sites(&embark_assist::main::state->region_sites);
embark_assist::overlay::set_sites(&embark_assist::main::state->region_sites); embark_assist::overlay::set_sites(&embark_assist::main::state->region_sites);
embark_assist::defs::mid_level_tiles mlt; embark_assist::defs::mid_level_tiles &mlt = embark_assist::main::state->mlt;
embark_assist::survey::survey_mid_level_tile(&embark_assist::main::state->geo_summary, &embark_assist::main::state->survey_results, &mlt); embark_assist::survey::survey_mid_level_tile(&embark_assist::main::state->geo_summary, &embark_assist::main::state->survey_results, &mlt);
embark_assist::survey::survey_embark(&mlt, &embark_assist::main::state->survey_results, &embark_assist::main::state->site_info, false); embark_assist::survey::survey_embark(&mlt, &embark_assist::main::state->survey_results, &embark_assist::main::state->site_info, false);
embark_assist::overlay::set_embark(&embark_assist::main::state->site_info); embark_assist::overlay::set_embark(&embark_assist::main::state->site_info);

@ -64,6 +64,12 @@ namespace embark_assist {
bool mineral_3; bool mineral_3;
}; };
struct states {
embark_assist::defs::mid_level_tiles mlt;
};
static states *state = nullptr;
//======================================================================================= //=======================================================================================
void process_embark_incursion(matcher_info *result, void process_embark_incursion(matcher_info *result,
@ -2681,14 +2687,13 @@ namespace embark_assist {
uint16_t y) { uint16_t y) {
// color_ostream_proxy out(Core::getInstance().getConsole()); // color_ostream_proxy out(Core::getInstance().getConsole());
embark_assist::defs::mid_level_tiles mlt;
embark_assist::survey::survey_mid_level_tile(geo_summary, embark_assist::survey::survey_mid_level_tile(geo_summary,
survey_results, survey_results,
&mlt); &state->mlt);
mid_level_tile_match(survey_results, mid_level_tile_match(survey_results,
&mlt, &state->mlt,
x, x,
y, y,
finder, finder,
@ -2717,6 +2722,20 @@ namespace embark_assist {
// Visible operations // Visible operations
//======================================================================================= //=======================================================================================
void embark_assist::matcher::setup() {
embark_assist::matcher::state = new(embark_assist::matcher::states);
embark_assist::survey::initiate(&state->mlt);
}
//=======================================================================================
void embark_assist::matcher::shutdown() {
delete state;
state = nullptr;
}
//=======================================================================================
void embark_assist::matcher::move_cursor(uint16_t x, uint16_t y) { void embark_assist::matcher::move_cursor(uint16_t x, uint16_t y) {
// color_ostream_proxy out(Core::getInstance().getConsole()); // color_ostream_proxy out(Core::getInstance().getConsole());
auto screen = Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0); auto screen = Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0);

@ -17,5 +17,8 @@ namespace embark_assist {
embark_assist::defs::geo_data *geo_summary, embark_assist::defs::geo_data *geo_summary,
embark_assist::defs::world_tile_data *survey_results, embark_assist::defs::world_tile_data *survey_results,
embark_assist::defs::match_results *match_results); embark_assist::defs::match_results *match_results);
void setup();
void shutdown();
} }
} }

@ -75,7 +75,7 @@ namespace embark_assist {
uint16_t max_inorganic; uint16_t max_inorganic;
}; };
static states *state; static states *state = nullptr;
//======================================================================================= //=======================================================================================
@ -908,6 +908,22 @@ void inline copy_incursion_values(embark_assist::defs::mid_level_tile_incursion_
//================================================================================= //=================================================================================
void reset_mlt_inorganics(embark_assist::defs::mid_level_tiles &mlts) {
const uint16_t size = mlts[0][0].metals.size();
for (uint8_t i = 0; i < 16; i++) {
for (uint8_t k = 0; k < 16; k++) {
embark_assist::defs::mid_level_tile &mlt = mlts[i][k];
for (uint16_t l = 0; l < size; l++) {
mlt.metals[l] = false;
mlt.economics[l] = false;
mlt.minerals[l] = false;
}
}
}
}
//=================================================================================
void embark_assist::survey::survey_mid_level_tile(embark_assist::defs::geo_data *geo_summary, void embark_assist::survey::survey_mid_level_tile(embark_assist::defs::geo_data *geo_summary,
embark_assist::defs::world_tile_data *survey_results, embark_assist::defs::world_tile_data *survey_results,
embark_assist::defs::mid_level_tiles *mlt) { embark_assist::defs::mid_level_tiles *mlt) {
@ -940,13 +956,7 @@ void embark_assist::survey::survey_mid_level_tile(embark_assist::defs::geo_data
tile.minerals[i] = 0; tile.minerals[i] = 0;
} }
for (uint8_t i = 0; i < 16; i++) { reset_mlt_inorganics(*mlt);
for (uint8_t k = 0; k < 16; k++) {
mlt->at(i).at(k).metals.resize(state->max_inorganic);
mlt->at(i).at(k).economics.resize(state->max_inorganic);
mlt->at(i).at(k).minerals.resize(state->max_inorganic);
}
}
for (uint8_t i = 1; i < 10; i++) tile.biome_index[i] = -1; for (uint8_t i = 1; i < 10; i++) tile.biome_index[i] = -1;
@ -2538,5 +2548,6 @@ void embark_assist::survey::survey_embark(embark_assist::defs::mid_level_tiles *
void embark_assist::survey::shutdown() { void embark_assist::survey::shutdown() {
delete state; delete state;
state = nullptr;
} }