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
//===============================================================================
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,12 +1149,14 @@ namespace embark_assist {
finder,
match_results);
}
}
}
//=======================================================================================
// Visible operations
//=======================================================================================
void 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());
auto screen = Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0);
uint16_t original_x = screen->location.region_pos.x;
@ -1242,7 +1244,7 @@ namespace embark_assist {
//=======================================================================================
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)
@ -22,5 +25,3 @@ namespace embark_assist {
return true;
}
}
}

@ -332,25 +332,27 @@ namespace embark_assist {
}
}
}
}
}
//=================================================================================
// 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);
@ -362,7 +364,7 @@ namespace embark_assist {
//=================================================================================
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;
@ -379,11 +381,11 @@ 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());
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,13 +469,13 @@ 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());
@ -822,7 +824,7 @@ namespace embark_assist {
}
//=================================================================================
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;
@ -1076,5 +1078,4 @@ namespace embark_assist {
void embark_assist::survey::shutdown() {
delete state;
}
}
}