2018-02-26 10:31:33 -07:00
|
|
|
#include <stdio.h>
|
2017-09-01 06:13:34 -06:00
|
|
|
#include "Core.h"
|
|
|
|
#include <Console.h>
|
|
|
|
|
|
|
|
#include <modules/Gui.h>
|
|
|
|
|
|
|
|
#include "Types.h"
|
|
|
|
|
2018-02-26 10:31:33 -07:00
|
|
|
#include "MemAccess.h"
|
2017-09-01 06:13:34 -06:00
|
|
|
#include "df/biome_type.h"
|
2020-03-03 13:45:20 -07:00
|
|
|
#include "df/entity_raw.h"
|
|
|
|
#include "df/entity_raw_flags.h"
|
2017-09-01 06:13:34 -06:00
|
|
|
#include "df/inorganic_raw.h"
|
|
|
|
#include "df/material_flags.h"
|
|
|
|
#include "df/viewscreen_choose_start_sitest.h"
|
|
|
|
#include "df/world.h"
|
2018-07-13 09:22:26 -06:00
|
|
|
#include "df/world_data.h"
|
2020-03-03 13:45:20 -07:00
|
|
|
#include "df/world_raws.h"
|
2017-09-01 06:13:34 -06:00
|
|
|
#include "df/world_region_type.h"
|
|
|
|
#include "df/world_raws.h"
|
|
|
|
|
|
|
|
#include "embark-assistant.h"
|
|
|
|
#include "finder_ui.h"
|
|
|
|
#include "screen.h"
|
|
|
|
|
|
|
|
using df::global::world;
|
|
|
|
|
2018-02-27 02:46:06 -07:00
|
|
|
#define profile_file_name "./data/init/embark_assistant_profile.txt"
|
2018-02-26 10:31:33 -07:00
|
|
|
|
2017-09-01 06:13:34 -06:00
|
|
|
namespace embark_assist {
|
|
|
|
namespace finder_ui {
|
|
|
|
|
|
|
|
enum class fields : int8_t {
|
|
|
|
x_dim,
|
|
|
|
y_dim,
|
|
|
|
savagery_calm,
|
|
|
|
savagery_medium,
|
|
|
|
savagery_savage,
|
|
|
|
good,
|
|
|
|
neutral,
|
|
|
|
evil,
|
|
|
|
aquifer,
|
|
|
|
min_river,
|
|
|
|
max_river,
|
2019-07-01 05:29:07 -06:00
|
|
|
min_waterfall,
|
2019-07-12 14:09:03 -06:00
|
|
|
flat,
|
2017-09-01 06:13:34 -06:00
|
|
|
clay,
|
|
|
|
sand,
|
|
|
|
flux,
|
2018-12-04 06:55:59 -07:00
|
|
|
coal,
|
2017-09-01 06:13:34 -06:00
|
|
|
soil_min,
|
|
|
|
soil_min_everywhere,
|
|
|
|
soil_max,
|
2018-07-13 09:22:26 -06:00
|
|
|
freezing,
|
2018-06-21 12:49:49 -06:00
|
|
|
blood_rain,
|
|
|
|
syndrome_rain,
|
2017-09-01 06:13:34 -06:00
|
|
|
reanimation,
|
2018-02-26 10:31:33 -07:00
|
|
|
spire_count_min,
|
|
|
|
spire_count_max,
|
|
|
|
magma_min,
|
|
|
|
magma_max,
|
2017-09-01 06:13:34 -06:00
|
|
|
biome_count_min,
|
|
|
|
biome_count_max,
|
|
|
|
region_type_1,
|
|
|
|
region_type_2,
|
|
|
|
region_type_3,
|
|
|
|
biome_1,
|
|
|
|
biome_2,
|
|
|
|
biome_3,
|
2020-03-03 13:45:20 -07:00
|
|
|
min_trees,
|
|
|
|
max_trees,
|
2017-09-01 06:13:34 -06:00
|
|
|
metal_1,
|
|
|
|
metal_2,
|
|
|
|
metal_3,
|
|
|
|
economic_1,
|
|
|
|
economic_2,
|
|
|
|
economic_3,
|
|
|
|
mineral_1,
|
|
|
|
mineral_2,
|
2020-03-03 13:45:20 -07:00
|
|
|
mineral_3,
|
|
|
|
min_necro_neighbors,
|
|
|
|
max_necro_neighbors,
|
|
|
|
min_civ_neighbors,
|
|
|
|
max_civ_neighbors,
|
|
|
|
neighbors
|
2017-09-01 06:13:34 -06:00
|
|
|
};
|
|
|
|
fields first_fields = fields::x_dim;
|
2020-03-03 13:45:20 -07:00
|
|
|
fields last_fields = fields::neighbors;
|
2017-09-01 06:13:34 -06:00
|
|
|
|
|
|
|
struct display_map_elements {
|
|
|
|
std::string text;
|
|
|
|
int16_t key;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector <display_map_elements> display_maps;
|
|
|
|
typedef std::vector <display_map_elements> name_lists;
|
|
|
|
typedef std::list< display_map_elements> sort_lists;
|
|
|
|
|
|
|
|
struct ui_lists {
|
|
|
|
uint16_t current_display_value; // Not the value itself, but a reference to its index.
|
|
|
|
int16_t current_value; // The integer representation of the value (if an enum).
|
|
|
|
uint16_t current_index; // What's selected
|
|
|
|
uint16_t focus; // The value under the (possibly inactive) cursor
|
|
|
|
display_maps list; // The strings to be displayed together with keys
|
|
|
|
// to allow location of the actual elements (e.g. a raws.inorganics mat_index
|
|
|
|
// or underlying enum value).
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector <ui_lists*> uis;
|
|
|
|
|
|
|
|
const DFHack::Screen::Pen active_pen(' ', COLOR_YELLOW);
|
|
|
|
const DFHack::Screen::Pen passive_pen(' ', COLOR_DARKGREY);
|
|
|
|
const DFHack::Screen::Pen normal_pen(' ', COLOR_GREY);
|
|
|
|
const DFHack::Screen::Pen white_pen(' ', COLOR_WHITE);
|
|
|
|
const DFHack::Screen::Pen lr_pen(' ', COLOR_LIGHTRED);
|
|
|
|
|
2020-03-03 13:45:20 -07:00
|
|
|
struct civ_entities {
|
|
|
|
int16_t id;
|
|
|
|
std::string description;
|
|
|
|
};
|
|
|
|
|
2017-09-01 06:13:34 -06:00
|
|
|
//==========================================================================================================
|
|
|
|
|
|
|
|
struct states {
|
|
|
|
embark_assist::defs::find_callbacks find_callback;
|
2023-01-05 18:11:01 -07:00
|
|
|
uis plotinfo;
|
2017-09-01 06:13:34 -06:00
|
|
|
display_maps finder_list; // Don't need the element key, but it's easier to use the same type.
|
|
|
|
uint16_t finder_list_focus;
|
|
|
|
bool finder_list_active;
|
|
|
|
uint16_t max_inorganic;
|
2020-03-03 13:45:20 -07:00
|
|
|
std::vector<civ_entities> civs;
|
2017-09-01 06:13:34 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
static states *state = 0;
|
|
|
|
|
|
|
|
//==========================================================================================================
|
|
|
|
|
|
|
|
bool compare(const display_map_elements& first, const display_map_elements& second) {
|
|
|
|
uint16_t i = 0;
|
|
|
|
while (i < first.text.length() && i < second.text.length()) {
|
|
|
|
if (first.text[i] < second.text[i]) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (first.text[i] > second.text[i]) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
return first.text.length() < second.text.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================================================
|
|
|
|
|
|
|
|
void append(sort_lists *sort_list, display_map_elements element) {
|
|
|
|
sort_lists::iterator iterator;
|
|
|
|
for (iterator = sort_list->begin(); iterator != sort_list->end(); ++iterator) {
|
|
|
|
if (iterator->key == element.key) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sort_list->push_back(element);
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================================================
|
|
|
|
|
2018-02-26 10:31:33 -07:00
|
|
|
void save_profile() {
|
|
|
|
color_ostream_proxy out(Core::getInstance().getConsole());
|
2018-03-14 07:28:24 -06:00
|
|
|
|
2018-02-26 10:31:33 -07:00
|
|
|
FILE* outfile = fopen(profile_file_name, "w");
|
|
|
|
fields i = first_fields;
|
2020-03-15 10:56:13 -06:00
|
|
|
size_t civ = 0;
|
2018-02-26 10:31:33 -07:00
|
|
|
|
|
|
|
while (true) {
|
2023-01-05 18:11:01 -07:00
|
|
|
for (size_t k = 0; k < state->plotinfo[static_cast<int8_t>(i)]->list.size(); k++) {
|
|
|
|
if (state->plotinfo[static_cast<int8_t>(i) + civ]->current_value == state->plotinfo[static_cast<int8_t>(i) + civ]->list[k].key) {
|
|
|
|
fprintf(outfile, "[%s:%s]\n", state->finder_list[static_cast<int8_t>(i) + civ].text.c_str(), state->plotinfo[static_cast<int8_t>(i) + civ]->list[k].text.c_str());
|
2018-02-27 02:46:06 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2023-01-05 18:11:01 -07:00
|
|
|
// fprintf(outfile, "[%s:%i]\n", state->finder_list[static_cast<int8_t>(i)].text.c_str(), state->plotinfo[static_cast<int8_t>(i)]->current_value);
|
2018-02-26 10:31:33 -07:00
|
|
|
if (i == last_fields) {
|
2020-03-15 10:56:13 -06:00
|
|
|
civ++;
|
2018-02-26 10:31:33 -07:00
|
|
|
|
2020-03-15 10:56:13 -06:00
|
|
|
if (civ == state->civs.size()) {
|
|
|
|
break; // done
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
i = static_cast <fields>(static_cast<int8_t>(i) + 1);
|
|
|
|
}
|
2018-02-26 10:31:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fclose(outfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================================================
|
|
|
|
|
|
|
|
void load_profile() {
|
|
|
|
color_ostream_proxy out(Core::getInstance().getConsole());
|
|
|
|
FILE* infile = fopen(profile_file_name, "r");
|
2020-03-15 10:56:13 -06:00
|
|
|
size_t civ = 0;
|
2018-02-26 10:31:33 -07:00
|
|
|
|
|
|
|
if (!infile) {
|
|
|
|
out.printerr("No profile file found at %s\n", profile_file_name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
fields i = first_fields;
|
|
|
|
char line[80];
|
|
|
|
int count = 80;
|
|
|
|
bool found;
|
|
|
|
|
|
|
|
while (true) {
|
2018-04-06 00:18:15 -06:00
|
|
|
if (!fgets(line, count, infile) || line[0] != '[') {
|
2018-02-26 10:31:33 -07:00
|
|
|
out.printerr("Failed to find token start '[' at line %i\n", static_cast<int8_t>(i));
|
2018-02-27 02:46:06 -07:00
|
|
|
fclose(infile);
|
2018-02-26 10:31:33 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int k = 1; k < count; k++) {
|
|
|
|
if (line[k] == ':') {
|
|
|
|
for (int l = 1; l < k; l++) {
|
2020-03-15 10:56:13 -06:00
|
|
|
if (state->finder_list[static_cast<int8_t>(i) + civ].text.c_str()[l - 1] != line[l]) {
|
|
|
|
out.printerr("Token mismatch of %s vs %s\n", line, state->finder_list[static_cast<int8_t>(i) + civ].text.c_str());
|
2018-02-27 02:46:06 -07:00
|
|
|
fclose(infile);
|
2018-02-26 10:31:33 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2018-02-27 02:46:06 -07:00
|
|
|
|
|
|
|
found = false;
|
2018-02-26 10:31:33 -07:00
|
|
|
|
2023-01-05 18:11:01 -07:00
|
|
|
for (size_t l = 0; l < state->plotinfo[static_cast<int8_t>(i) + civ]->list.size(); l++) {
|
2018-02-27 02:46:06 -07:00
|
|
|
for (int m = k + 1; m < count; m++) {
|
2023-01-05 18:11:01 -07:00
|
|
|
if (state->plotinfo[static_cast<int8_t>(i) + civ]->list[l].text.c_str()[m - (k + 1)] != line[m]) {
|
|
|
|
if (state->plotinfo[static_cast<int8_t>(i) + civ]->list[l].text.c_str()[m - (k + 1)] == '\0' &&
|
2018-02-27 02:46:06 -07:00
|
|
|
line[m] == ']') {
|
|
|
|
found = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (found) {
|
2018-02-26 10:31:33 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!found) {
|
2018-02-27 02:46:06 -07:00
|
|
|
out.printerr("Value extraction failure from %s\n", line);
|
|
|
|
fclose(infile);
|
2018-02-26 10:31:33 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!found) {
|
|
|
|
out.printerr("Value delimiter not found in %s\n", line);
|
2018-02-27 02:46:06 -07:00
|
|
|
fclose(infile);
|
2018-02-26 10:31:33 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == last_fields) {
|
2020-03-15 10:56:13 -06:00
|
|
|
civ++;
|
2018-02-26 10:31:33 -07:00
|
|
|
|
2020-03-15 10:56:13 -06:00
|
|
|
if (civ == state->civs.size()) {
|
|
|
|
break; // done
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
i = static_cast <fields>(static_cast<int8_t>(i) + 1);
|
|
|
|
}
|
2018-02-26 10:31:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fclose(infile);
|
|
|
|
|
2019-06-23 10:35:28 -06:00
|
|
|
// Checking done. Now do the work.
|
2018-02-26 10:31:33 -07:00
|
|
|
|
|
|
|
infile = fopen(profile_file_name, "r");
|
|
|
|
i = first_fields;
|
2020-03-15 10:56:13 -06:00
|
|
|
civ = 0;
|
2018-02-26 10:31:33 -07:00
|
|
|
|
|
|
|
while (true) {
|
2018-04-06 00:18:15 -06:00
|
|
|
if (!fgets(line, count, infile))
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2018-02-26 10:31:33 -07:00
|
|
|
|
|
|
|
for (int k = 1; k < count; k++) {
|
|
|
|
if (line[k] == ':') {
|
|
|
|
|
2018-02-27 02:46:06 -07:00
|
|
|
found = false;
|
|
|
|
|
2023-01-05 18:11:01 -07:00
|
|
|
for (size_t l = 0; l < state->plotinfo[static_cast<int8_t>(i) + civ]->list.size(); l++) {
|
2018-02-27 02:46:06 -07:00
|
|
|
for (int m = k + 1; m < count; m++) {
|
2023-01-05 18:11:01 -07:00
|
|
|
if (state->plotinfo[static_cast<int8_t>(i) + civ]->list[l].text.c_str()[m - (k + 1)] != line[m]) {
|
|
|
|
if (state->plotinfo[static_cast<int8_t>(i) + civ]->list[l].text.c_str()[m - (k + 1)] == '\0' &&
|
2018-02-27 02:46:06 -07:00
|
|
|
line[m] == ']') {
|
2023-01-05 18:11:01 -07:00
|
|
|
state->plotinfo[static_cast<int8_t>(i) + civ]->current_value = state->plotinfo[static_cast<int8_t>(i) + civ]->list[l].key;
|
|
|
|
state->plotinfo[static_cast<int8_t>(i) + civ]->current_display_value = l;
|
2018-02-27 02:46:06 -07:00
|
|
|
found = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (found) {
|
2018-02-26 10:31:33 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == last_fields) {
|
2020-03-15 10:56:13 -06:00
|
|
|
civ++;
|
2018-02-26 10:31:33 -07:00
|
|
|
|
2020-03-15 10:56:13 -06:00
|
|
|
if (civ == state->civs.size()) {
|
|
|
|
break; // done
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
i = static_cast <fields>(static_cast<int8_t>(i) + 1);
|
|
|
|
}
|
2018-02-26 10:31:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fclose(infile);
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================================================
|
|
|
|
|
2017-09-01 06:13:34 -06:00
|
|
|
void ui_setup(embark_assist::defs::find_callbacks find_callback, uint16_t max_inorganic) {
|
|
|
|
// color_ostream_proxy out(Core::getInstance().getConsole());
|
|
|
|
if (!embark_assist::finder_ui::state) {
|
|
|
|
state = new(states);
|
|
|
|
state->finder_list_focus = 0;
|
|
|
|
state->finder_list_active = true;
|
|
|
|
state->find_callback = find_callback;
|
|
|
|
state->max_inorganic = max_inorganic;
|
|
|
|
}
|
|
|
|
|
|
|
|
fields i = first_fields;
|
|
|
|
ui_lists *element;
|
2020-03-03 13:45:20 -07:00
|
|
|
int16_t controllable_civs = 0;
|
|
|
|
int16_t max_civs;
|
|
|
|
|
2020-03-04 02:09:51 -07:00
|
|
|
for (int16_t i = 0; i < (int16_t)world->raws.entities.size(); i++) {
|
2020-03-03 13:45:20 -07:00
|
|
|
if (world->raws.entities[i]->flags.is_set(df::entity_raw_flags::CIV_CONTROLLABLE)) controllable_civs++;
|
|
|
|
}
|
|
|
|
|
2020-03-04 02:09:51 -07:00
|
|
|
for (int16_t i = 0; i < (int16_t)world->raws.entities.size(); i++) {
|
2020-03-03 13:45:20 -07:00
|
|
|
if (!world->raws.entities[i]->flags.is_set(df::entity_raw_flags::LAYER_LINKED) && // Animal people
|
|
|
|
!world->raws.entities[i]->flags.is_set(df::entity_raw_flags::GENERATED) && // Vault guardians
|
|
|
|
(controllable_civs > 1 || // Suppress the playable civ when only 1
|
|
|
|
!world->raws.entities[i]->flags.is_set(df::entity_raw_flags::CIV_CONTROLLABLE))) { // Too much work to change dynamically for modded worlds.
|
|
|
|
if (world->raws.entities[i]->translation == "") {
|
|
|
|
state->civs.push_back({ i, world->raws.entities[i]->code }); // Kobolds don't have a translation...
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
state->civs.push_back({ i, world->raws.entities[i]->translation });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
max_civs = state->civs.size();
|
|
|
|
|
|
|
|
if (controllable_civs > 1) max_civs = max_civs - 1;
|
2017-09-01 06:13:34 -06:00
|
|
|
|
|
|
|
while (true) {
|
|
|
|
element = new ui_lists;
|
|
|
|
element->current_display_value = 0;
|
|
|
|
element->current_index = 0;
|
|
|
|
element->focus = 0;
|
|
|
|
|
|
|
|
switch (i) {
|
|
|
|
case fields::x_dim:
|
2018-07-19 12:48:28 -06:00
|
|
|
for (int16_t k = 1; k <= 16; k++) {
|
2017-09-01 06:13:34 -06:00
|
|
|
element->list.push_back({ std::to_string(k), k });
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::y_dim:
|
2018-07-19 12:48:28 -06:00
|
|
|
for (int16_t k = 1; k <= 16; k++) {
|
2017-09-01 06:13:34 -06:00
|
|
|
element->list.push_back({ std::to_string(k), k });
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::savagery_calm:
|
|
|
|
case fields::savagery_medium:
|
|
|
|
case fields::savagery_savage:
|
|
|
|
case fields::good:
|
|
|
|
case fields::neutral:
|
|
|
|
case fields::evil:
|
|
|
|
{
|
|
|
|
embark_assist::defs::evil_savagery_values k = embark_assist::defs::evil_savagery_values::NA;
|
|
|
|
while (true) {
|
|
|
|
switch (k) {
|
|
|
|
case embark_assist::defs::evil_savagery_values::NA:
|
|
|
|
element->list.push_back({ "N/A", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::evil_savagery_values::All:
|
|
|
|
element->list.push_back({ "All", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::evil_savagery_values::Present:
|
|
|
|
element->list.push_back({ "Present", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::evil_savagery_values::Absent:
|
|
|
|
element->list.push_back({ "Absent", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (k == embark_assist::defs::evil_savagery_values::Absent) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
k = static_cast <embark_assist::defs::evil_savagery_values>(static_cast<int8_t>(k) + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::aquifer:
|
|
|
|
{
|
|
|
|
embark_assist::defs::aquifer_ranges k = embark_assist::defs::aquifer_ranges::NA;
|
|
|
|
while (true) {
|
|
|
|
switch (k) {
|
|
|
|
case embark_assist::defs::aquifer_ranges::NA:
|
|
|
|
element->list.push_back({ "N/A", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
2020-03-03 13:45:20 -07:00
|
|
|
case embark_assist::defs::aquifer_ranges::None:
|
|
|
|
element->list.push_back({ "None", static_cast<int8_t>(k) });
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
2020-03-03 13:45:20 -07:00
|
|
|
case embark_assist::defs::aquifer_ranges::At_Most_Light:
|
|
|
|
element->list.push_back({ "<= Light", static_cast<int8_t>(k) });
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
2020-03-03 13:45:20 -07:00
|
|
|
case embark_assist::defs::aquifer_ranges::None_Plus_Light:
|
|
|
|
element->list.push_back({ "None + Light", static_cast<int8_t>(k) });
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
2020-03-04 02:09:51 -07:00
|
|
|
case embark_assist::defs::aquifer_ranges::None_Plus_At_Least_Light:
|
|
|
|
element->list.push_back({ "None + >= Light", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
2020-03-03 13:45:20 -07:00
|
|
|
case embark_assist::defs::aquifer_ranges::Light:
|
|
|
|
element->list.push_back({ "Light", static_cast<int8_t>(k) });
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
2020-03-03 13:45:20 -07:00
|
|
|
case embark_assist::defs::aquifer_ranges::At_Least_Light:
|
|
|
|
element->list.push_back({ ">= Light", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::aquifer_ranges::None_Plus_Heavy:
|
|
|
|
element->list.push_back({ "None + Heavy", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::aquifer_ranges::At_Most_Light_Plus_Heavy:
|
|
|
|
element->list.push_back({ "<= Light + Heavy", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::aquifer_ranges::Light_Plus_Heavy:
|
|
|
|
element->list.push_back({ "Light + Heavy", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::aquifer_ranges::None_Light_Heavy:
|
|
|
|
element->list.push_back({ "None + Light + Heavy", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::aquifer_ranges::Heavy:
|
|
|
|
element->list.push_back({ "Heavy", static_cast<int8_t>(k) });
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-03-03 13:45:20 -07:00
|
|
|
if (k == embark_assist::defs::aquifer_ranges::Heavy) {
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
k = static_cast <embark_assist::defs::aquifer_ranges>(static_cast<int8_t>(k) + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::min_river:
|
|
|
|
case fields::max_river:
|
|
|
|
{
|
|
|
|
embark_assist::defs::river_ranges k = embark_assist::defs::river_ranges::NA;
|
|
|
|
while (true) {
|
|
|
|
switch (k) {
|
|
|
|
case embark_assist::defs::river_ranges::NA:
|
|
|
|
element->list.push_back({ "N/A", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::river_ranges::None:
|
|
|
|
element->list.push_back({ "None", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::river_ranges::Brook:
|
|
|
|
element->list.push_back({ "Brook", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::river_ranges::Stream:
|
|
|
|
element->list.push_back({ "Stream", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::river_ranges::Minor:
|
|
|
|
element->list.push_back({ "Minor", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::river_ranges::Medium:
|
|
|
|
element->list.push_back({ "Medium", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::river_ranges::Major:
|
|
|
|
element->list.push_back({ "Major", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (k == embark_assist::defs::river_ranges::Major) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
k = static_cast <embark_assist::defs::river_ranges>(static_cast<int8_t>(k) + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2019-07-01 05:29:07 -06:00
|
|
|
case fields::min_waterfall:
|
2020-08-23 11:35:45 -06:00
|
|
|
|
|
|
|
element->list.push_back({ "N/A", -1 });
|
|
|
|
element->list.push_back({ "Absent", 0 });
|
|
|
|
|
|
|
|
for (int16_t k = 1; k <= 9; k++) {
|
|
|
|
element->list.push_back({ std::to_string(k), k });
|
2019-07-01 05:29:07 -06:00
|
|
|
}
|
2020-08-23 11:35:45 -06:00
|
|
|
|
2020-08-23 07:20:45 -06:00
|
|
|
for (int16_t k = 10; k <= 50; k+=5) {
|
2020-08-23 11:35:45 -06:00
|
|
|
element->list.push_back({ std::to_string(k), k });
|
2020-08-23 07:20:45 -06:00
|
|
|
}
|
2019-07-01 05:29:07 -06:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
2018-06-21 12:49:49 -06:00
|
|
|
case fields::blood_rain:
|
2019-07-12 14:09:03 -06:00
|
|
|
case fields::flat:
|
2017-09-01 06:13:34 -06:00
|
|
|
{
|
|
|
|
embark_assist::defs::yes_no_ranges k = embark_assist::defs::yes_no_ranges::NA;
|
|
|
|
while (true) {
|
|
|
|
switch (k) {
|
|
|
|
case embark_assist::defs::yes_no_ranges::NA:
|
|
|
|
element->list.push_back({ "N/A", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::yes_no_ranges::Yes:
|
|
|
|
element->list.push_back({ "Yes", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::yes_no_ranges::No:
|
|
|
|
element->list.push_back({ "No", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (k == embark_assist::defs::yes_no_ranges::No) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
k = static_cast <embark_assist::defs::yes_no_ranges>(static_cast<int8_t>(k) + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::soil_min_everywhere:
|
|
|
|
{
|
|
|
|
embark_assist::defs::all_present_ranges k = embark_assist::defs::all_present_ranges::All;
|
|
|
|
while (true) {
|
|
|
|
switch (k) {
|
|
|
|
case embark_assist::defs::all_present_ranges::All:
|
|
|
|
element->list.push_back({ "All", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::all_present_ranges::Present:
|
|
|
|
element->list.push_back({ "Present", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (k == embark_assist::defs::all_present_ranges::Present) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
k = static_cast <embark_assist::defs::all_present_ranges>(static_cast<int8_t>(k) + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::clay:
|
|
|
|
case fields::sand:
|
|
|
|
case fields::flux:
|
2018-12-04 06:55:59 -07:00
|
|
|
case fields::coal:
|
2017-09-01 06:13:34 -06:00
|
|
|
{
|
|
|
|
embark_assist::defs::present_absent_ranges k = embark_assist::defs::present_absent_ranges::NA;
|
|
|
|
while (true) {
|
|
|
|
switch (k) {
|
|
|
|
case embark_assist::defs::present_absent_ranges::NA:
|
|
|
|
element->list.push_back({ "N/A", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::present_absent_ranges::Present:
|
|
|
|
element->list.push_back({ "Present", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::present_absent_ranges::Absent:
|
|
|
|
element->list.push_back({ "Absent", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (k == embark_assist::defs::present_absent_ranges::Absent) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
k = static_cast <embark_assist::defs::present_absent_ranges>(static_cast<int8_t>(k) + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::soil_min:
|
|
|
|
case fields::soil_max:
|
|
|
|
{
|
|
|
|
embark_assist::defs::soil_ranges k = embark_assist::defs::soil_ranges::NA;
|
|
|
|
while (true) {
|
|
|
|
switch (k) {
|
|
|
|
case embark_assist::defs::soil_ranges::NA:
|
|
|
|
element->list.push_back({ "N/A", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::soil_ranges::None:
|
|
|
|
element->list.push_back({ "None", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::soil_ranges::Very_Shallow:
|
|
|
|
element->list.push_back({ "Very Shallow", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::soil_ranges::Shallow:
|
|
|
|
element->list.push_back({ "Shallow", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::soil_ranges::Deep:
|
|
|
|
element->list.push_back({ "Deep", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::soil_ranges::Very_Deep:
|
|
|
|
element->list.push_back({ "Very Deep", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (k == embark_assist::defs::soil_ranges::Very_Deep) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
k = static_cast <embark_assist::defs::soil_ranges>(static_cast<int8_t>(k) + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2018-07-13 09:22:26 -06:00
|
|
|
case fields::freezing:
|
|
|
|
{
|
|
|
|
embark_assist::defs::freezing_ranges k = embark_assist::defs::freezing_ranges::NA;
|
|
|
|
while (true) {
|
|
|
|
switch (k) {
|
|
|
|
case embark_assist::defs::freezing_ranges::NA:
|
|
|
|
element->list.push_back({ "N/A", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::freezing_ranges::Permanent:
|
|
|
|
element->list.push_back({ "Permanent", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::freezing_ranges::At_Least_Partial:
|
|
|
|
element->list.push_back({ "At Least Partially Frozen", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::freezing_ranges::Partial:
|
|
|
|
element->list.push_back({ "Partially Frozen", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::freezing_ranges::At_Most_Partial:
|
|
|
|
element->list.push_back({ "At Most Partially Frozen", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::freezing_ranges::Never:
|
|
|
|
element->list.push_back({ "Never Frozen", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (k == embark_assist::defs::freezing_ranges::Never ||
|
|
|
|
(world->world_data->world_height != 17 && // Can't handle temperature in non standard height worlds.
|
|
|
|
world->world_data->world_height != 33 &&
|
|
|
|
world->world_data->world_height != 65 &&
|
|
|
|
world->world_data->world_height != 129 &&
|
|
|
|
world->world_data->world_height != 257)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
k = static_cast <embark_assist::defs::freezing_ranges>(static_cast<int8_t>(k) + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2018-06-21 12:49:49 -06:00
|
|
|
case fields::syndrome_rain:
|
|
|
|
{
|
|
|
|
embark_assist::defs::syndrome_rain_ranges k = embark_assist::defs::syndrome_rain_ranges::NA;
|
|
|
|
while (true) {
|
|
|
|
switch (k) {
|
|
|
|
case embark_assist::defs::syndrome_rain_ranges::NA:
|
|
|
|
element->list.push_back({ "N/A", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::syndrome_rain_ranges::Any:
|
|
|
|
element->list.push_back({ "Any Syndrome", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::syndrome_rain_ranges::Permanent:
|
|
|
|
element->list.push_back({ "Permanent Syndrome", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::syndrome_rain_ranges::Temporary:
|
|
|
|
element->list.push_back({ "Temporary Syndrome", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::syndrome_rain_ranges::Not_Permanent:
|
|
|
|
element->list.push_back({ "Not Permanent Syndrome", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::syndrome_rain_ranges::None:
|
|
|
|
element->list.push_back({ "No Syndrome", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (k == embark_assist::defs::syndrome_rain_ranges::None) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
k = static_cast <embark_assist::defs::syndrome_rain_ranges>(static_cast<int8_t>(k) + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::reanimation:
|
|
|
|
{
|
|
|
|
embark_assist::defs::reanimation_ranges k = embark_assist::defs::reanimation_ranges::NA;
|
|
|
|
while (true) {
|
|
|
|
switch (k) {
|
|
|
|
case embark_assist::defs::reanimation_ranges::NA:
|
|
|
|
element->list.push_back({ "N/A", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::reanimation_ranges::Both:
|
|
|
|
element->list.push_back({ "Reanimation & Thralling", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::reanimation_ranges::Any:
|
|
|
|
element->list.push_back({ "Reanimation or Thralling", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::reanimation_ranges::Thralling:
|
|
|
|
element->list.push_back({ "Thralling", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::reanimation_ranges::Reanimation:
|
|
|
|
element->list.push_back({ "Reanimation", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::reanimation_ranges::Not_Thralling:
|
|
|
|
element->list.push_back({ "Not Thralling", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::reanimation_ranges::None:
|
|
|
|
element->list.push_back({ "None", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (k == embark_assist::defs::reanimation_ranges::None) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
k = static_cast <embark_assist::defs::reanimation_ranges>(static_cast<int8_t>(k) + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2018-02-26 10:31:33 -07:00
|
|
|
case fields::spire_count_min:
|
|
|
|
case fields::spire_count_max:
|
|
|
|
for (int16_t k = -1; k <= 9; k++) {
|
|
|
|
if (k == -1) {
|
|
|
|
element->list.push_back({ "N/A", k });
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
element->list.push_back({ std::to_string(k), k });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::magma_min:
|
|
|
|
case fields::magma_max:
|
|
|
|
{
|
|
|
|
embark_assist::defs::magma_ranges k = embark_assist::defs::magma_ranges::NA;
|
|
|
|
while (true) {
|
|
|
|
switch (k) {
|
|
|
|
case embark_assist::defs::magma_ranges::NA:
|
|
|
|
element->list.push_back({ "N/A", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::magma_ranges::Cavern_3:
|
2018-02-27 02:46:06 -07:00
|
|
|
element->list.push_back({ "Third Cavern", static_cast<int8_t>(k) });
|
2018-02-26 10:31:33 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::magma_ranges::Cavern_2:
|
2018-02-27 02:46:06 -07:00
|
|
|
element->list.push_back({ "Second Cavern", static_cast<int8_t>(k) });
|
2018-02-26 10:31:33 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::magma_ranges::Cavern_1:
|
2018-03-14 07:28:24 -06:00
|
|
|
element->list.push_back({ "First Cavern", static_cast<int8_t>(k) });
|
2018-02-26 10:31:33 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::magma_ranges::Volcano:
|
|
|
|
element->list.push_back({ "Volcano", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (k == embark_assist::defs::magma_ranges::Volcano) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
k = static_cast <embark_assist::defs::magma_ranges>(static_cast<int8_t>(k) + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2017-09-01 06:13:34 -06:00
|
|
|
case fields::biome_count_min:
|
|
|
|
case fields::biome_count_max:
|
|
|
|
for (int16_t k = 0; k < 10; k++) {
|
|
|
|
if (k == 0) {
|
|
|
|
element->list.push_back({ "N/A", -1 });
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
element->list.push_back({ std::to_string(k), k });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::region_type_1:
|
|
|
|
case fields::region_type_2:
|
|
|
|
case fields::region_type_3:
|
|
|
|
{
|
|
|
|
std::list<display_map_elements> name;
|
|
|
|
std::list<display_map_elements>::iterator iterator;
|
|
|
|
|
|
|
|
FOR_ENUM_ITEMS(world_region_type, iter) {
|
|
|
|
name.push_back({ ENUM_KEY_STR(world_region_type, iter), static_cast<int16_t>(iter) });
|
|
|
|
}
|
|
|
|
name.sort(compare);
|
|
|
|
|
|
|
|
element->list.push_back({ "N/A", -1 });
|
|
|
|
|
|
|
|
for (iterator = name.begin(); iterator != name.end(); ++iterator) {
|
|
|
|
element->list.push_back({ iterator->text, iterator->key });
|
|
|
|
}
|
|
|
|
|
|
|
|
name.clear();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::biome_1:
|
|
|
|
case fields::biome_2:
|
|
|
|
case fields::biome_3:
|
|
|
|
{
|
|
|
|
sort_lists name;
|
|
|
|
sort_lists::iterator iterator;
|
|
|
|
|
|
|
|
FOR_ENUM_ITEMS(biome_type, iter) {
|
|
|
|
std::string s = ENUM_KEY_STR(biome_type, iter);
|
|
|
|
|
|
|
|
if (s.substr(0, 4) != "POOL" &&
|
|
|
|
s.substr(0, 5) != "RIVER" &&
|
|
|
|
s.substr(0, 3) != "SUB") {
|
|
|
|
name.push_back({ s, static_cast<int16_t>(iter) });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
name.sort(compare);
|
|
|
|
|
|
|
|
element->list.push_back({ "N/A", -1 });
|
|
|
|
|
|
|
|
for (iterator = name.begin(); iterator != name.end(); ++iterator) {
|
|
|
|
element->list.push_back({ iterator->text, iterator->key });
|
|
|
|
}
|
|
|
|
|
|
|
|
name.clear();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2020-03-03 13:45:20 -07:00
|
|
|
case fields::min_trees:
|
|
|
|
case fields::max_trees:
|
|
|
|
{
|
|
|
|
embark_assist::defs::tree_ranges k = embark_assist::defs::tree_ranges::NA;
|
|
|
|
while (true) {
|
|
|
|
switch (k) {
|
|
|
|
case embark_assist::defs::tree_ranges::NA:
|
|
|
|
element->list.push_back({ "N/A", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::tree_ranges::None:
|
|
|
|
element->list.push_back({ "None", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::tree_ranges::Very_Scarce:
|
|
|
|
element->list.push_back({ "Very Scarce", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::tree_ranges::Scarce:
|
|
|
|
element->list.push_back({ "Scarce", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::tree_ranges::Woodland:
|
|
|
|
element->list.push_back({ "Woodland", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::tree_ranges::Heavily_Forested:
|
|
|
|
element->list.push_back({ "Heavily Forested", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (k == embark_assist::defs::tree_ranges::Heavily_Forested) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
k = static_cast <embark_assist::defs::tree_ranges>(static_cast<int8_t>(k) + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2017-09-01 06:13:34 -06:00
|
|
|
case fields::metal_1:
|
|
|
|
case fields::metal_2:
|
|
|
|
case fields::metal_3:
|
|
|
|
{
|
|
|
|
sort_lists name;
|
|
|
|
sort_lists::iterator iterator;
|
|
|
|
|
|
|
|
for (uint16_t k = 0; k < embark_assist::finder_ui::state->max_inorganic; k++) {
|
|
|
|
for (uint16_t l = 0; l < world->raws.inorganics[k]->metal_ore.mat_index.size(); l++) {
|
|
|
|
append(&name, { world->raws.inorganics[world->raws.inorganics[k]->metal_ore.mat_index[l]]->id,
|
|
|
|
world->raws.inorganics[k]->metal_ore.mat_index[l] });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
name.sort(compare);
|
|
|
|
|
|
|
|
element->list.push_back({ "N/A", -1 });
|
|
|
|
|
|
|
|
for (iterator = name.begin(); iterator != name.end(); ++iterator) {
|
|
|
|
element->list.push_back({ iterator->text, iterator->key });
|
|
|
|
}
|
|
|
|
|
|
|
|
name.clear();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::economic_1:
|
|
|
|
case fields::economic_2:
|
|
|
|
case fields::economic_3:
|
|
|
|
{
|
|
|
|
sort_lists name;
|
|
|
|
sort_lists::iterator iterator;
|
|
|
|
|
|
|
|
for (int16_t k = 0; k < embark_assist::finder_ui::state->max_inorganic; k++) {
|
|
|
|
if (world->raws.inorganics[k]->economic_uses.size() != 0 &&
|
|
|
|
!world->raws.inorganics[k]->material.flags.is_set(df::material_flags::IS_METAL)) {
|
|
|
|
append(&name, { world->raws.inorganics[k]->id, k });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
name.sort(compare);
|
|
|
|
|
|
|
|
element->list.push_back({ "N/A", -1 });
|
|
|
|
|
|
|
|
for (iterator = name.begin(); iterator != name.end(); ++iterator) {
|
|
|
|
element->list.push_back({ iterator->text, iterator->key });
|
|
|
|
}
|
|
|
|
|
|
|
|
name.clear();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::mineral_1:
|
|
|
|
case fields::mineral_2:
|
|
|
|
case fields::mineral_3:
|
|
|
|
{
|
|
|
|
sort_lists name;
|
|
|
|
sort_lists::iterator iterator;
|
|
|
|
|
|
|
|
for (int16_t k = 0; k < embark_assist::finder_ui::state->max_inorganic; k++) {
|
|
|
|
if (world->raws.inorganics[k]->environment.location.size() != 0 ||
|
|
|
|
world->raws.inorganics[k]->environment_spec.mat_index.size() != 0 ||
|
|
|
|
world->raws.inorganics[k]->flags.is_set(df::inorganic_flags::SEDIMENTARY) ||
|
|
|
|
world->raws.inorganics[k]->flags.is_set(df::inorganic_flags::IGNEOUS_EXTRUSIVE) ||
|
|
|
|
world->raws.inorganics[k]->flags.is_set(df::inorganic_flags::IGNEOUS_INTRUSIVE) ||
|
|
|
|
world->raws.inorganics[k]->flags.is_set(df::inorganic_flags::METAMORPHIC) ||
|
|
|
|
world->raws.inorganics[k]->flags.is_set(df::inorganic_flags::SOIL)) {
|
|
|
|
append(&name, { world->raws.inorganics[k]->id, k });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
name.sort(compare);
|
|
|
|
|
|
|
|
element->list.push_back({ "N/A", -1 });
|
|
|
|
|
|
|
|
for (iterator = name.begin(); iterator != name.end(); ++iterator) {
|
|
|
|
element->list.push_back({ iterator->text, iterator->key });
|
|
|
|
}
|
|
|
|
|
|
|
|
name.clear();
|
|
|
|
}
|
|
|
|
break;
|
2020-03-03 13:45:20 -07:00
|
|
|
|
|
|
|
case fields::min_necro_neighbors:
|
|
|
|
case fields::max_necro_neighbors:
|
|
|
|
for (int16_t k = -1; k <= 16; k++) {
|
|
|
|
if (k == -1) {
|
|
|
|
element->list.push_back({ "N/A", k });
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
element->list.push_back({ std::to_string(k), k });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::min_civ_neighbors:
|
|
|
|
case fields::max_civ_neighbors:
|
|
|
|
for (int16_t k = -1; k <= max_civs; k++) {
|
|
|
|
if (k == -1) {
|
|
|
|
element->list.push_back({ "N/A", k });
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
element->list.push_back({ std::to_string(k), k });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::neighbors:
|
|
|
|
for (size_t l = 0; l < state->civs.size(); l++) {
|
|
|
|
embark_assist::defs::present_absent_ranges k = embark_assist::defs::present_absent_ranges::NA;
|
|
|
|
while (true) {
|
|
|
|
switch (k) {
|
|
|
|
case embark_assist::defs::present_absent_ranges::NA:
|
|
|
|
element->list.push_back({ "N/A", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::present_absent_ranges::Present:
|
|
|
|
element->list.push_back({ "Present", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case embark_assist::defs::present_absent_ranges::Absent:
|
|
|
|
element->list.push_back({ "Absent", static_cast<int8_t>(k) });
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (k == embark_assist::defs::present_absent_ranges::Absent) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
k = static_cast <embark_assist::defs::present_absent_ranges>(static_cast<int8_t>(k) + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (l < state->civs.size() - 1) {
|
|
|
|
element->current_value = element->list[0].key;
|
2023-01-05 18:11:01 -07:00
|
|
|
state->plotinfo.push_back(element);
|
2020-03-03 13:45:20 -07:00
|
|
|
element = new ui_lists;
|
|
|
|
element->current_display_value = 0;
|
|
|
|
element->current_index = 0;
|
|
|
|
element->focus = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
element->current_value = element->list[0].key;
|
2023-01-05 18:11:01 -07:00
|
|
|
state->plotinfo.push_back(element);
|
2017-09-01 06:13:34 -06:00
|
|
|
|
|
|
|
switch (i) {
|
|
|
|
case fields::x_dim:
|
|
|
|
state->finder_list.push_back({ "X Dimension", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::y_dim:
|
|
|
|
state->finder_list.push_back({ "Y Dimension", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::savagery_calm:
|
|
|
|
state->finder_list.push_back({ "Low Savagery", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::savagery_medium:
|
|
|
|
state->finder_list.push_back({ "Medium Savagery", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::savagery_savage:
|
|
|
|
state->finder_list.push_back({ "High Savagery", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::good:
|
|
|
|
state->finder_list.push_back({ "Good", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::neutral:
|
|
|
|
state->finder_list.push_back({ "Neutral", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::evil:
|
|
|
|
state->finder_list.push_back({ "Evil", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::aquifer:
|
|
|
|
state->finder_list.push_back({ "Aquifer", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::min_river:
|
|
|
|
state->finder_list.push_back({ "Min River", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::max_river:
|
|
|
|
state->finder_list.push_back({ "Max River", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
2019-07-01 05:29:07 -06:00
|
|
|
case fields::min_waterfall:
|
|
|
|
state->finder_list.push_back({ "Min Waterfall Drop", static_cast<int8_t>(i) });
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
2019-07-12 14:09:03 -06:00
|
|
|
case fields::flat:
|
|
|
|
state->finder_list.push_back({ "Flat", static_cast<int8_t>(i) });
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::soil_min_everywhere:
|
|
|
|
state->finder_list.push_back({ "Min Soil Everywhere", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
2018-07-13 09:22:26 -06:00
|
|
|
case fields::freezing:
|
|
|
|
state->finder_list.push_back({ "Freezing", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
2018-06-21 12:49:49 -06:00
|
|
|
case fields::blood_rain:
|
|
|
|
state->finder_list.push_back({ "Blood Rain", static_cast<int8_t>(i) });
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
2018-06-21 12:49:49 -06:00
|
|
|
case fields::syndrome_rain:
|
|
|
|
state->finder_list.push_back({ "Syndrome Rain", static_cast<int8_t>(i) });
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
2018-06-21 12:49:49 -06:00
|
|
|
case fields::reanimation:
|
|
|
|
state->finder_list.push_back({ "Reanimation", static_cast<int8_t>(i) });
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::clay:
|
|
|
|
state->finder_list.push_back({ "Clay", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::sand:
|
|
|
|
state->finder_list.push_back({ "Sand", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::flux:
|
|
|
|
state->finder_list.push_back({ "Flux", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
2018-12-04 06:55:59 -07:00
|
|
|
case fields::coal:
|
|
|
|
state->finder_list.push_back({ "Coal", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
2017-09-01 06:13:34 -06:00
|
|
|
case fields::soil_min:
|
|
|
|
state->finder_list.push_back({ "Min Soil", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::soil_max:
|
|
|
|
state->finder_list.push_back({ "Max Soil", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
2018-02-26 10:31:33 -07:00
|
|
|
case fields::spire_count_min:
|
|
|
|
state->finder_list.push_back({ "Min Adamantine", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::spire_count_max:
|
|
|
|
state->finder_list.push_back({ "Max Adamantine", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::magma_min:
|
|
|
|
state->finder_list.push_back({ "Min Magma", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::magma_max:
|
|
|
|
state->finder_list.push_back({ "Max Magma", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
2017-09-01 06:13:34 -06:00
|
|
|
case fields::biome_count_min:
|
|
|
|
state->finder_list.push_back({ "Min Biome Count", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::biome_count_max:
|
|
|
|
state->finder_list.push_back({ "Max Biome Count", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::region_type_1:
|
|
|
|
state->finder_list.push_back({ "Region Type 1", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::region_type_2:
|
|
|
|
state->finder_list.push_back({ "Region Type 2", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::region_type_3:
|
|
|
|
state->finder_list.push_back({ "Region Type 3", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::biome_1:
|
|
|
|
state->finder_list.push_back({ "Biome 1", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::biome_2:
|
|
|
|
state->finder_list.push_back({ "Biome 2", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::biome_3:
|
|
|
|
state->finder_list.push_back({ "Biome 3", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
2020-03-03 13:45:20 -07:00
|
|
|
case fields::min_trees:
|
|
|
|
state->finder_list.push_back({ "Min Trees", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::max_trees:
|
|
|
|
state->finder_list.push_back({ "Max Trees", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
2017-09-01 06:13:34 -06:00
|
|
|
case fields::metal_1:
|
|
|
|
state->finder_list.push_back({ "Metal 1", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::metal_2:
|
|
|
|
state->finder_list.push_back({ "Metal 2", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::metal_3:
|
|
|
|
state->finder_list.push_back({ "Metal 3", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::economic_1:
|
|
|
|
state->finder_list.push_back({ "Economic 1", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::economic_2:
|
|
|
|
state->finder_list.push_back({ "Economic 2", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::economic_3:
|
|
|
|
state->finder_list.push_back({ "Economic 3", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::mineral_1:
|
|
|
|
state->finder_list.push_back({ "Mineral 1", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::mineral_2:
|
|
|
|
state->finder_list.push_back({ "Mineral 2", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::mineral_3:
|
|
|
|
state->finder_list.push_back({ "Mineral 3", static_cast<int8_t>(i) });
|
|
|
|
break;
|
2020-03-03 13:45:20 -07:00
|
|
|
|
|
|
|
case fields::min_necro_neighbors:
|
|
|
|
state->finder_list.push_back({ "Min Necro Tower", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::max_necro_neighbors:
|
|
|
|
state->finder_list.push_back({ "Max Necro Tower", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::min_civ_neighbors:
|
|
|
|
state->finder_list.push_back({ "Min Near Civs", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::max_civ_neighbors:
|
|
|
|
state->finder_list.push_back({ "Max Near Civs", static_cast<int8_t>(i) });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::neighbors:
|
2020-03-04 02:09:51 -07:00
|
|
|
for (uint8_t k = 0; k < state->civs.size(); k++) {
|
2020-03-04 08:54:00 -07:00
|
|
|
state->finder_list.push_back({ state->civs[k].description, (int16_t)(static_cast<int8_t>(i) + k) });
|
2020-03-03 13:45:20 -07:00
|
|
|
}
|
|
|
|
break;
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
if (i == last_fields) {
|
|
|
|
break; // done
|
|
|
|
}
|
|
|
|
|
|
|
|
i = static_cast <fields>(static_cast<int8_t>(i) + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Default embark area size to that of the current selection. The "size" calculation is actually one
|
|
|
|
// off to compensate for the list starting with 1 at index 0.
|
|
|
|
//
|
|
|
|
auto screen = Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0);
|
2023-01-05 18:11:01 -07:00
|
|
|
state->plotinfo[static_cast<int8_t>(fields::x_dim)]->current_display_value =
|
2021-09-06 23:16:21 -06:00
|
|
|
screen->location.embark_pos_max.x -
|
|
|
|
screen->location.embark_pos_min.x;
|
2023-01-05 18:11:01 -07:00
|
|
|
state->plotinfo[static_cast<int8_t>(fields::x_dim)]->current_index =
|
|
|
|
state->plotinfo[static_cast<int8_t>(fields::x_dim)]->current_display_value;
|
|
|
|
state->plotinfo[static_cast<int8_t>(fields::x_dim)]->current_value =
|
|
|
|
state->plotinfo[static_cast<int8_t>(fields::x_dim)]->current_display_value + 1;
|
2017-09-01 06:13:34 -06:00
|
|
|
|
2023-01-05 18:11:01 -07:00
|
|
|
state->plotinfo[static_cast<int8_t>(fields::y_dim)]->current_display_value =
|
2021-09-06 23:16:21 -06:00
|
|
|
screen->location.embark_pos_max.y -
|
|
|
|
screen->location.embark_pos_min.y;
|
2023-01-05 18:11:01 -07:00
|
|
|
state->plotinfo[static_cast<int8_t>(fields::y_dim)]->current_index =
|
|
|
|
state->plotinfo[static_cast<int8_t>(fields::y_dim)]->current_display_value;
|
|
|
|
state->plotinfo[static_cast<int8_t>(fields::y_dim)]->current_value =
|
|
|
|
state->plotinfo[static_cast<int8_t>(fields::y_dim)]->current_display_value + 1;
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================================================
|
|
|
|
|
|
|
|
void find() {
|
|
|
|
// color_ostream_proxy out(Core::getInstance().getConsole());
|
2018-05-12 20:10:07 -06:00
|
|
|
embark_assist::defs::finders finder = {};
|
2017-09-01 06:13:34 -06:00
|
|
|
fields i = first_fields;
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
switch (i) {
|
|
|
|
case fields::x_dim:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.x_dim = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::y_dim:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.y_dim = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::savagery_calm:
|
|
|
|
finder.savagery[0] =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::evil_savagery_values>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::savagery_medium:
|
|
|
|
finder.savagery[1] =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::evil_savagery_values>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
case fields::savagery_savage:
|
|
|
|
finder.savagery[2] =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::evil_savagery_values>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::good:
|
|
|
|
finder.evilness[0] =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::evil_savagery_values>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::neutral:
|
|
|
|
finder.evilness[1] =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::evil_savagery_values>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::evil:
|
|
|
|
finder.evilness[2] =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::evil_savagery_values>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::aquifer:
|
|
|
|
finder.aquifer =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::aquifer_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::min_river:
|
|
|
|
finder.min_river =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::river_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::max_river:
|
|
|
|
finder.max_river =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::river_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
2019-07-01 05:29:07 -06:00
|
|
|
case fields::min_waterfall:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.min_waterfall = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
2019-07-12 14:09:03 -06:00
|
|
|
case fields::flat:
|
|
|
|
finder.flat =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::yes_no_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::soil_min_everywhere:
|
|
|
|
finder.soil_min_everywhere =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::all_present_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
2018-07-13 09:22:26 -06:00
|
|
|
case fields::freezing:
|
|
|
|
finder.freezing =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::freezing_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2018-07-13 09:22:26 -06:00
|
|
|
break;
|
|
|
|
|
2018-06-21 12:49:49 -06:00
|
|
|
case fields::blood_rain:
|
|
|
|
finder.blood_rain =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::yes_no_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
2018-06-21 12:49:49 -06:00
|
|
|
case fields::syndrome_rain:
|
|
|
|
finder.syndrome_rain =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::syndrome_rain_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
2018-06-21 12:49:49 -06:00
|
|
|
case fields::reanimation:
|
|
|
|
finder.reanimation =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::reanimation_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::clay:
|
|
|
|
finder.clay =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::present_absent_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::sand:
|
|
|
|
finder.sand =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::present_absent_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::flux:
|
|
|
|
finder.flux =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::present_absent_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
2018-12-04 06:55:59 -07:00
|
|
|
case fields::coal:
|
|
|
|
finder.coal =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::present_absent_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2018-12-04 06:55:59 -07:00
|
|
|
break;
|
|
|
|
|
2017-09-01 06:13:34 -06:00
|
|
|
case fields::soil_min:
|
|
|
|
finder.soil_min =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::soil_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::soil_max:
|
|
|
|
finder.soil_max =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::soil_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
2018-02-26 10:31:33 -07:00
|
|
|
case fields::spire_count_min:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.spire_count_min = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2018-02-26 10:31:33 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::spire_count_max:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.spire_count_max = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2018-02-26 10:31:33 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::magma_min:
|
|
|
|
finder.magma_min =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::magma_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2018-02-26 10:31:33 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::magma_max:
|
|
|
|
finder.magma_max =
|
2023-01-05 18:11:01 -07:00
|
|
|
static_cast<embark_assist::defs::magma_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2018-02-26 10:31:33 -07:00
|
|
|
break;
|
|
|
|
|
2017-09-01 06:13:34 -06:00
|
|
|
case fields::biome_count_min:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.biome_count_min = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::biome_count_max:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.biome_count_max = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::region_type_1:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.region_type_1 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::region_type_2:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.region_type_2 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::region_type_3:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.region_type_3 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::biome_1:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.biome_1 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::biome_2:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.biome_2 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::biome_3:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.biome_3 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
2020-03-03 13:45:20 -07:00
|
|
|
case fields::min_trees:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.min_trees = static_cast<embark_assist::defs::tree_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2020-03-03 13:45:20 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::max_trees:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.max_trees = static_cast<embark_assist::defs::tree_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
|
2020-03-03 13:45:20 -07:00
|
|
|
break;
|
|
|
|
|
2017-09-01 06:13:34 -06:00
|
|
|
case fields::metal_1:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.metal_1 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::metal_2:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.metal_2 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::metal_3:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.metal_3 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::economic_1:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.economic_1 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::economic_2:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.economic_2 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::economic_3:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.economic_3 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::mineral_1:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.mineral_1 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::mineral_2:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.mineral_2 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::mineral_3:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.mineral_3 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2017-09-01 06:13:34 -06:00
|
|
|
break;
|
2020-03-03 13:45:20 -07:00
|
|
|
|
|
|
|
case fields::min_necro_neighbors:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.min_necro_neighbors = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2020-03-03 13:45:20 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::max_necro_neighbors:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.max_necro_neighbors = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2020-03-03 13:45:20 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::min_civ_neighbors:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.min_civ_neighbors = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2020-03-03 13:45:20 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::max_civ_neighbors:
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.max_civ_neighbors = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
|
2020-03-03 13:45:20 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case fields::neighbors:
|
|
|
|
for (size_t k = 0; k < state->civs.size(); k++) {
|
2023-01-05 18:11:01 -07:00
|
|
|
finder.neighbors.push_back({ state->civs[k].id, static_cast<embark_assist::defs::present_absent_ranges>(state->plotinfo[static_cast<uint8_t>(i) + k]->current_value) });
|
2020-03-03 13:45:20 -07:00
|
|
|
}
|
|
|
|
break;
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
if (i == last_fields) {
|
|
|
|
break; // done
|
|
|
|
}
|
|
|
|
|
|
|
|
i = static_cast <fields>(static_cast<int8_t>(i) + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
state->find_callback(finder);
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================================================
|
|
|
|
|
|
|
|
class ViewscreenFindUi : public dfhack_viewscreen
|
|
|
|
{
|
|
|
|
public:
|
2017-09-01 08:22:10 -06:00
|
|
|
ViewscreenFindUi();
|
2017-09-01 06:13:34 -06:00
|
|
|
|
|
|
|
void feed(std::set<df::interface_key> *input);
|
|
|
|
|
|
|
|
void render();
|
|
|
|
|
|
|
|
std::string getFocusString() { return "Finder UI"; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
};
|
|
|
|
|
|
|
|
//===============================================================================
|
|
|
|
|
|
|
|
void ViewscreenFindUi::feed(std::set<df::interface_key> *input) {
|
|
|
|
if (input->count(df::interface_key::LEAVESCREEN))
|
|
|
|
{
|
|
|
|
input->clear();
|
|
|
|
Screen::dismiss(this);
|
|
|
|
return;
|
|
|
|
|
2018-07-10 08:59:52 -06:00
|
|
|
} else if (input->count(df::interface_key::STANDARDSCROLL_LEFT) ||
|
|
|
|
input->count(df::interface_key::STANDARDSCROLL_RIGHT)) {
|
2017-09-01 06:13:34 -06:00
|
|
|
state->finder_list_active = !state->finder_list_active;
|
|
|
|
|
2018-07-10 08:59:52 -06:00
|
|
|
} else if (input->count(df::interface_key::STANDARDSCROLL_UP)) {
|
2017-09-01 06:13:34 -06:00
|
|
|
if (state->finder_list_active) {
|
|
|
|
if (state->finder_list_focus > 0) {
|
|
|
|
state->finder_list_focus--;
|
|
|
|
}
|
|
|
|
else {
|
2020-03-03 13:45:20 -07:00
|
|
|
state->finder_list_focus = static_cast<uint16_t>(last_fields) + state->civs.size() - 1;
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2023-01-05 18:11:01 -07:00
|
|
|
if (state->plotinfo[state->finder_list_focus]->current_index > 0) {
|
|
|
|
state->plotinfo[state->finder_list_focus]->current_index--;
|
2017-09-01 06:13:34 -06:00
|
|
|
} else {
|
2023-01-05 18:11:01 -07:00
|
|
|
state->plotinfo[state->finder_list_focus]->current_index = static_cast<uint16_t>(state->plotinfo[state->finder_list_focus]->list.size()) - 1;
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-10 08:59:52 -06:00
|
|
|
} else if (input->count(df::interface_key::STANDARDSCROLL_DOWN)) {
|
2017-09-01 06:13:34 -06:00
|
|
|
if (state->finder_list_active) {
|
2020-03-03 13:45:20 -07:00
|
|
|
if (state->finder_list_focus < static_cast<uint16_t>(last_fields) + state->civs.size() - 1) {
|
2017-09-01 06:13:34 -06:00
|
|
|
state->finder_list_focus++;
|
|
|
|
} else {
|
|
|
|
state->finder_list_focus = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2023-01-05 18:11:01 -07:00
|
|
|
if (state->plotinfo[state->finder_list_focus]->current_index < state->plotinfo[state->finder_list_focus]->list.size() - 1) {
|
|
|
|
state->plotinfo[state->finder_list_focus]->current_index++;
|
2017-09-01 06:13:34 -06:00
|
|
|
} else {
|
2023-01-05 18:11:01 -07:00
|
|
|
state->plotinfo[state->finder_list_focus]->current_index = 0;
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
|
|
|
}
|
2018-02-26 10:31:33 -07:00
|
|
|
|
2017-09-01 06:13:34 -06:00
|
|
|
} else if (input->count(df::interface_key::SELECT)) {
|
|
|
|
if (!state->finder_list_active) {
|
2023-01-05 18:11:01 -07:00
|
|
|
state->plotinfo[state->finder_list_focus]->current_display_value = state->plotinfo[state->finder_list_focus]->current_index;
|
|
|
|
state->plotinfo[state->finder_list_focus]->current_value = state->plotinfo[state->finder_list_focus]->list[state->plotinfo[state->finder_list_focus]->current_index].key;
|
2017-09-01 06:13:34 -06:00
|
|
|
state->finder_list_active = true;
|
|
|
|
}
|
2018-02-26 10:31:33 -07:00
|
|
|
|
2017-09-01 06:13:34 -06:00
|
|
|
} else if (input->count(df::interface_key::CUSTOM_F)) {
|
|
|
|
input->clear();
|
|
|
|
Screen::dismiss(this);
|
|
|
|
find();
|
|
|
|
return;
|
2018-02-26 10:31:33 -07:00
|
|
|
|
|
|
|
} else if (input->count(df::interface_key::CUSTOM_S)) { // Save
|
|
|
|
save_profile();
|
|
|
|
|
|
|
|
} else if (input->count(df::interface_key::CUSTOM_L)) { // Load
|
|
|
|
load_profile();
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//===============================================================================
|
|
|
|
|
|
|
|
void ViewscreenFindUi::render() {
|
|
|
|
// color_ostream_proxy out(Core::getInstance().getConsole());
|
|
|
|
auto screen_size = DFHack::Screen::getWindowSize();
|
2018-07-13 09:43:22 -06:00
|
|
|
uint16_t top_row = 2;
|
|
|
|
uint16_t list_column = 53;
|
2017-09-01 06:13:34 -06:00
|
|
|
uint16_t offset = 0;
|
|
|
|
|
|
|
|
Screen::clear();
|
2018-07-10 09:01:22 -06:00
|
|
|
Screen::drawBorder(" Embark Assistant Site Finder ");
|
2018-03-14 07:28:24 -06:00
|
|
|
|
2018-07-10 08:59:52 -06:00
|
|
|
embark_assist::screen::paintString(lr_pen, 1, 1, DFHack::Screen::getKeyDisplay(df::interface_key::STANDARDSCROLL_LEFT).c_str());
|
2018-02-27 02:46:06 -07:00
|
|
|
embark_assist::screen::paintString(white_pen, 2, 1, "/");
|
2018-07-10 08:59:52 -06:00
|
|
|
embark_assist::screen::paintString(lr_pen, 3, 1, DFHack::Screen::getKeyDisplay(df::interface_key::STANDARDSCROLL_RIGHT).c_str());
|
2018-07-10 09:22:12 -06:00
|
|
|
embark_assist::screen::paintString(white_pen, 4, 1, ": \x1b/\x1a");
|
|
|
|
embark_assist::screen::paintString(lr_pen, 10, 1, DFHack::Screen::getKeyDisplay(df::interface_key::STANDARDSCROLL_UP).c_str());
|
|
|
|
embark_assist::screen::paintString(white_pen, 11, 1, "/");
|
|
|
|
embark_assist::screen::paintString(lr_pen, 12, 1, DFHack::Screen::getKeyDisplay(df::interface_key::STANDARDSCROLL_DOWN).c_str());
|
|
|
|
embark_assist::screen::paintString(white_pen, 13, 1, ": \x18/\x19");
|
|
|
|
embark_assist::screen::paintString(lr_pen, 19, 1, DFHack::Screen::getKeyDisplay(df::interface_key::SELECT).c_str());
|
|
|
|
embark_assist::screen::paintString(white_pen, 24, 1, ": Select");
|
|
|
|
embark_assist::screen::paintString(lr_pen, 33, 1, DFHack::Screen::getKeyDisplay(df::interface_key::CUSTOM_F).c_str());
|
|
|
|
embark_assist::screen::paintString(white_pen, 34, 1, ": Find");
|
2018-02-27 02:46:06 -07:00
|
|
|
embark_assist::screen::paintString(lr_pen, 41, 1, DFHack::Screen::getKeyDisplay(df::interface_key::LEAVESCREEN).c_str());
|
2018-07-10 09:22:12 -06:00
|
|
|
embark_assist::screen::paintString(white_pen, 44, 1, ": Abort");
|
|
|
|
embark_assist::screen::paintString(lr_pen, 52, 1, DFHack::Screen::getKeyDisplay(df::interface_key::CUSTOM_S).c_str());
|
|
|
|
embark_assist::screen::paintString(white_pen, 53, 1, ": Save");
|
|
|
|
embark_assist::screen::paintString(lr_pen, 60, 1, DFHack::Screen::getKeyDisplay(df::interface_key::CUSTOM_L).c_str());
|
|
|
|
embark_assist::screen::paintString(white_pen, 61, 1, ": Load");
|
2017-09-01 06:13:34 -06:00
|
|
|
|
2018-07-13 09:22:26 -06:00
|
|
|
// Implement scrolling lists if they don't fit on the screen.
|
|
|
|
if (int32_t(state->finder_list.size()) > screen_size.y - top_row - 1) {
|
|
|
|
offset = (screen_size.y - top_row - 1) / 2;
|
|
|
|
if (state->finder_list_focus < offset) {
|
|
|
|
offset = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
offset = state->finder_list_focus - offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (int32_t(state->finder_list.size() - offset) < screen_size.y - top_row - 1) {
|
|
|
|
offset = static_cast<uint16_t>(state->finder_list.size()) - (screen_size.y - top_row - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (uint16_t i = offset; i < state->finder_list.size(); i++) {
|
2017-09-01 06:13:34 -06:00
|
|
|
if (i == state->finder_list_focus) {
|
|
|
|
if (state->finder_list_active) {
|
2018-07-13 09:22:26 -06:00
|
|
|
embark_assist::screen::paintString(active_pen, 1, top_row + i - offset, state->finder_list[i].text);
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
|
|
|
else {
|
2018-07-13 09:22:26 -06:00
|
|
|
embark_assist::screen::paintString(passive_pen, 1, top_row + i - offset, state->finder_list[i].text);
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
embark_assist::screen::paintString(active_pen,
|
|
|
|
21,
|
2018-07-13 09:22:26 -06:00
|
|
|
top_row + i - offset,
|
2023-01-05 18:11:01 -07:00
|
|
|
state->plotinfo[i]->list[state->plotinfo[i]->current_display_value].text);
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
|
|
|
else {
|
2018-07-13 09:22:26 -06:00
|
|
|
embark_assist::screen::paintString(normal_pen, 1, top_row + i - offset, state->finder_list[i].text);
|
2017-09-01 06:13:34 -06:00
|
|
|
|
|
|
|
embark_assist::screen::paintString(white_pen,
|
|
|
|
21,
|
2018-07-13 09:22:26 -06:00
|
|
|
top_row + i - offset,
|
2023-01-05 18:11:01 -07:00
|
|
|
state->plotinfo[i]->list[state->plotinfo[i]->current_display_value].text);
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Implement scrolling lists if they don't fit on the screen.
|
2018-07-13 09:22:26 -06:00
|
|
|
offset = 0;
|
|
|
|
|
2023-01-05 18:11:01 -07:00
|
|
|
if (int32_t(state->plotinfo[state->finder_list_focus]->list.size()) > screen_size.y - top_row - 1) {
|
2018-07-13 09:22:26 -06:00
|
|
|
offset = (screen_size.y - top_row - 1) / 2;
|
2023-01-05 18:11:01 -07:00
|
|
|
if (state->plotinfo[state->finder_list_focus]->current_index < offset) {
|
2017-09-01 06:13:34 -06:00
|
|
|
offset = 0;
|
|
|
|
}
|
|
|
|
else {
|
2023-01-05 18:11:01 -07:00
|
|
|
offset = state->plotinfo[state->finder_list_focus]->current_index - offset;
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
|
|
|
|
2023-01-05 18:11:01 -07:00
|
|
|
if (int32_t(state->plotinfo[state->finder_list_focus]->list.size() - offset) < screen_size.y - top_row - 1) {
|
|
|
|
offset = static_cast<uint16_t>(state->plotinfo[state->finder_list_focus]->list.size()) - (screen_size.y - top_row - 1);
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-05 18:11:01 -07:00
|
|
|
for (uint16_t i = offset; i < state->plotinfo[state->finder_list_focus]->list.size(); i++) {
|
|
|
|
if (i == state->plotinfo[state->finder_list_focus]->current_index) {
|
2017-09-01 06:13:34 -06:00
|
|
|
if (!state->finder_list_active) { // Negated expression to get the display lines in the same order as above.
|
2023-01-05 18:11:01 -07:00
|
|
|
embark_assist::screen::paintString(active_pen, list_column, top_row + i - offset, state->plotinfo[state->finder_list_focus]->list[i].text);
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
|
|
|
else {
|
2023-01-05 18:11:01 -07:00
|
|
|
embark_assist::screen::paintString(passive_pen, list_column, top_row + i - offset, state->plotinfo[state->finder_list_focus]->list[i].text);
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2023-01-05 18:11:01 -07:00
|
|
|
embark_assist::screen::paintString(normal_pen, list_column, top_row + i - offset, state->plotinfo[state->finder_list_focus]->list[i].text);
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dfhack_viewscreen::render();
|
|
|
|
}
|
|
|
|
|
|
|
|
//===============================================================================
|
|
|
|
|
|
|
|
ViewscreenFindUi::ViewscreenFindUi() {
|
|
|
|
}
|
2017-09-01 09:00:14 -06:00
|
|
|
}
|
|
|
|
}
|
2017-09-01 06:13:34 -06:00
|
|
|
|
2017-09-01 09:00:14 -06:00
|
|
|
//===============================================================================
|
|
|
|
// Exported operations
|
|
|
|
//===============================================================================
|
2017-09-01 06:13:34 -06:00
|
|
|
|
2019-09-23 05:13:04 -06:00
|
|
|
void embark_assist::finder_ui::init(DFHack::Plugin *plugin_self, embark_assist::defs::find_callbacks find_callback, uint16_t max_inorganic, bool fileresult) {
|
2017-09-01 09:00:14 -06:00
|
|
|
if (!embark_assist::finder_ui::state) { // First call. Have to do the setup
|
|
|
|
embark_assist::finder_ui::ui_setup(find_callback, max_inorganic);
|
|
|
|
}
|
2019-09-23 05:13:04 -06:00
|
|
|
if (!fileresult) {
|
|
|
|
Screen::show(dts::make_unique<ViewscreenFindUi>(), plugin_self);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
load_profile();
|
|
|
|
find();
|
|
|
|
}
|
2017-09-01 09:00:14 -06:00
|
|
|
}
|
2017-09-01 06:13:34 -06:00
|
|
|
|
2017-09-01 09:00:14 -06:00
|
|
|
//===============================================================================
|
2017-09-01 06:13:34 -06:00
|
|
|
|
2017-09-01 09:00:14 -06:00
|
|
|
void embark_assist::finder_ui::activate() {
|
|
|
|
}
|
2017-09-01 06:13:34 -06:00
|
|
|
|
2017-09-01 09:00:14 -06:00
|
|
|
//===============================================================================
|
2017-09-01 06:13:34 -06:00
|
|
|
|
2017-09-01 09:00:14 -06:00
|
|
|
void embark_assist::finder_ui::shutdown() {
|
|
|
|
if (embark_assist::finder_ui::state) {
|
2023-01-05 18:11:01 -07:00
|
|
|
for (uint16_t i = 0; i < embark_assist::finder_ui::state->plotinfo.size(); i++) {
|
|
|
|
delete embark_assist::finder_ui::state->plotinfo[i];
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
2017-09-01 09:00:14 -06:00
|
|
|
|
|
|
|
delete embark_assist::finder_ui::state;
|
|
|
|
embark_assist::finder_ui::state = nullptr;
|
2017-09-01 06:13:34 -06:00
|
|
|
}
|
2017-09-01 09:00:14 -06:00
|
|
|
}
|