Moved all externally visible operation implementations out of name spaces to satisfy both Travis and Visual Studio.

develop
PatrikLundell 2017-09-01 17:00:14 +02:00
parent 84eaf04148
commit 596296358f
5 changed files with 922 additions and 918 deletions

@ -1112,32 +1112,34 @@ namespace embark_assist {
ViewscreenFindUi::ViewscreenFindUi() {
}
}
}
//===============================================================================
//===============================================================================
// Exported operations
//===============================================================================
void init(DFHack::Plugin *plugin_self, embark_assist::defs::find_callbacks find_callback, uint16_t max_inorganic) {
if (!state) { // First call. Have to do the setup
ui_setup(find_callback, max_inorganic);
void embark_assist::finder_ui::init(DFHack::Plugin *plugin_self, embark_assist::defs::find_callbacks find_callback, uint16_t max_inorganic) {
if (!embark_assist::finder_ui::state) { // First call. Have to do the setup
embark_assist::finder_ui::ui_setup(find_callback, max_inorganic);
}
Screen::show(new ViewscreenFindUi(), plugin_self);
}
}
//===============================================================================
//===============================================================================
void activate() {
}
void embark_assist::finder_ui::activate() {
}
//===============================================================================
//===============================================================================
void shutdown() {
void embark_assist::finder_ui::shutdown() {
if (embark_assist::finder_ui::state) {
for (uint16_t i = 0; i < state->ui.size(); i++) {
delete state->ui[i];
for (uint16_t i = 0; i < embark_assist::finder_ui::state->ui.size(); i++) {
delete embark_assist::finder_ui::state->ui[i];
}
delete state;
state = nullptr;
}
}
delete embark_assist::finder_ui::state;
embark_assist::finder_ui::state = nullptr;
}
}

@ -302,13 +302,13 @@ namespace embark_assist{
ViewscreenHelpUi::ViewscreenHelpUi() {
}
}
}
//===============================================================================
// Exported operations
//===============================================================================
//===============================================================================
// Exported operations
//===============================================================================
void init(DFHack::Plugin *plugin_self) {
Screen::show(new ViewscreenHelpUi(), plugin_self);
}
}
void embark_assist::help_ui::init(DFHack::Plugin *plugin_self) {
Screen::show(new embark_assist::help_ui::ViewscreenHelpUi(), plugin_self);
}

@ -1149,13 +1149,15 @@ namespace embark_assist {
finder,
match_results);
}
}
}
//=======================================================================================
// Visible operations
//=======================================================================================
//=======================================================================================
// Visible operations
//=======================================================================================
void move_cursor(uint16_t x, uint16_t y) {
// color_ostream_proxy out(Core::getInstance().getConsole());
void embark_assist::matcher::move_cursor(uint16_t x, uint16_t y) {
// color_ostream_proxy out(Core::getInstance().getConsole());
auto screen = Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0);
uint16_t original_x = screen->location.region_pos.x;
uint16_t original_y = screen->location.region_pos.y;
@ -1238,11 +1240,11 @@ namespace embark_assist {
small_y--;
}
}
}
}
//=======================================================================================
//=======================================================================================
uint16_t find(embark_assist::defs::match_iterators *iterator,
uint16_t embark_assist::matcher::find(embark_assist::defs::match_iterators *iterator,
embark_assist::defs::geo_data *geo_summary,
embark_assist::defs::world_tile_data *survey_results,
embark_assist::defs::match_results *match_results) {
@ -1435,11 +1437,9 @@ namespace embark_assist {
iterator->active = !(iterator->i > world->worldgen.worldgen_parms.dim_y / 16);
if (!iterator->active) {
move_cursor(iterator->x, iterator->y);
embark_assist::matcher::move_cursor(iterator->x, iterator->y);
}
}
return iterator->count;
}
}
}

@ -2,7 +2,10 @@
namespace embark_assist {
namespace screen {
bool paintString(const DFHack::Screen::Pen &pen, int x, int y, const std::string &text, bool map) {
}
}
bool embark_assist::screen::paintString(const DFHack::Screen::Pen &pen, int x, int y, const std::string &text, bool map) {
auto screen_size = DFHack::Screen::getWindowSize();
if (y < 1 || y + 1 >= screen_size.y || x < 1)
@ -21,6 +24,4 @@ namespace embark_assist {
}
return true;
}
}
}

@ -332,25 +332,27 @@ namespace embark_assist {
}
}
}
}
}
//=================================================================================
// Exported operations
//=================================================================================
//=================================================================================
// Exported operations
//=================================================================================
void setup(uint16_t max_inorganic) {
state = new(states);
state->max_inorganic = max_inorganic;
}
void embark_assist::survey::setup(uint16_t max_inorganic) {
embark_assist::survey::state = new(embark_assist::survey::states);
embark_assist::survey::state->max_inorganic = max_inorganic;
}
//=================================================================================
//=================================================================================
df::coord2d get_last_pos() {
return{state->x, state->y};
}
df::coord2d embark_assist::survey::get_last_pos() {
return{ embark_assist::survey::state->x, embark_assist::survey::state->y };
}
//=================================================================================
//=================================================================================
void initiate(embark_assist::defs::mid_level_tiles *mlt) {
void embark_assist::survey::initiate(embark_assist::defs::mid_level_tiles *mlt) {
for (uint8_t i = 0; i < 16; i++) {
for (uint8_t k = 0; k < 16; k++) {
mlt->at(i).at(k).metals.resize(state->max_inorganic);
@ -358,11 +360,11 @@ namespace embark_assist {
mlt->at(i).at(k).minerals.resize(state->max_inorganic);
}
}
}
}
//=================================================================================
//=================================================================================
void clear_results(embark_assist::defs::match_results *match_results) {
void embark_assist::survey::clear_results(embark_assist::defs::match_results *match_results) {
for (uint16_t i = 0; i < world->worldgen.worldgen_parms.dim_x; i++) {
for (uint16_t k = 0; k < world->worldgen.worldgen_parms.dim_y; k++) {
match_results->at(i).at(k).preliminary_match = false;
@ -375,15 +377,15 @@ namespace embark_assist {
}
}
}
}
}
//=================================================================================
//=================================================================================
void high_level_world_survey(embark_assist::defs::geo_data *geo_summary,
void embark_assist::survey::high_level_world_survey(embark_assist::defs::geo_data *geo_summary,
embark_assist::defs::world_tile_data *survey_results) {
// color_ostream_proxy out(Core::getInstance().getConsole());
// color_ostream_proxy out(Core::getInstance().getConsole());
geo_survey(geo_summary);
embark_assist::survey::geo_survey(geo_summary);
for (uint16_t i = 0; i < world->worldgen.worldgen_parms.dim_x; i++) {
for (uint16_t k = 0; k < world->worldgen.worldgen_parms.dim_y; k++) {
df::coord2d adjusted;
@ -467,16 +469,16 @@ namespace embark_assist {
}
}
survey_rivers(survey_results);
survey_evil_weather(survey_results);
}
embark_assist::survey::survey_rivers(survey_results);
embark_assist::survey::survey_evil_weather(survey_results);
}
//=================================================================================
//=================================================================================
void 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::mid_level_tiles *mlt) {
// color_ostream_proxy out(Core::getInstance().getConsole());
// color_ostream_proxy out(Core::getInstance().getConsole());
auto screen = Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0);
int16_t x = screen->location.region_pos.x;
int16_t y = screen->location.region_pos.y;
@ -819,10 +821,10 @@ namespace embark_assist {
tile->biome_count = count;
tile->surveyed = true;
}
//=================================================================================
}
//=================================================================================
df::coord2d apply_offset(uint16_t x, uint16_t y, int8_t offset) {
df::coord2d embark_assist::survey::apply_offset(uint16_t x, uint16_t y, int8_t offset) {
df::coord2d result;
result.x = x;
result.y = y;
@ -887,12 +889,12 @@ namespace embark_assist {
}
return result;
}
}
//=================================================================================
//=================================================================================
void embark_assist::survey::survey_region_sites(embark_assist::defs::site_lists *site_list) {
// color_ostream_proxy out(Core::getInstance().getConsole());
void embark_assist::survey::survey_region_sites(embark_assist::defs::site_lists *site_list) {
// color_ostream_proxy out(Core::getInstance().getConsole());
auto screen = Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0);
df::world_data *world_data = world->world_data;
int8_t index = 0;
@ -921,7 +923,7 @@ namespace embark_assist {
site->subtype_info->is_monument == 0) { // Not Tomb, which is visible already
}
else if (site->subtype_info->lair_type == -1) {
site_list->push_back( { (uint8_t)site->rgn_min_x , (uint8_t)site->rgn_min_y, 'V' }); // Vault
site_list->push_back({ (uint8_t)site->rgn_min_x , (uint8_t)site->rgn_min_y, 'V' }); // Vault
}
else {
site_list->push_back({ (uint8_t)site->rgn_min_x , (uint8_t)site->rgn_min_y, 'M' }); // Any other Monument type. Pyramid?
@ -958,15 +960,15 @@ namespace embark_assist {
break;
}
}
}
}
//=================================================================================
//=================================================================================
void embark_assist::survey::survey_embark(embark_assist::defs::mid_level_tiles *mlt,
void embark_assist::survey::survey_embark(embark_assist::defs::mid_level_tiles *mlt,
embark_assist::defs::site_infos *site_info,
bool use_cache) {
// color_ostream_proxy out(Core::getInstance().getConsole());
// color_ostream_proxy out(Core::getInstance().getConsole());
auto screen = Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0);
int16_t elevation;
uint16_t x = screen->location.region_pos.x;
@ -1050,7 +1052,7 @@ namespace embark_assist {
}
for (uint16_t l = 0; l < state->max_inorganic; l++) {
metals[l] = metals [l] || mlt->at(i).at(k).metals[l];
metals[l] = metals[l] || mlt->at(i).at(k).metals[l];
economics[l] = economics[l] || mlt->at(i).at(k).economics[l];
minerals[l] = minerals[l] || mlt->at(i).at(k).minerals[l];
}
@ -1069,12 +1071,11 @@ namespace embark_assist {
site_info->minerals.push_back(l);
}
}
}
}
//=================================================================================
//=================================================================================
void embark_assist::survey::shutdown() {
void embark_assist::survey::shutdown() {
delete state;
}
}
}