|
|
|
@ -18,31 +18,35 @@
|
|
|
|
|
#include "modules/Translation.h"
|
|
|
|
|
#include "modules/World.h"
|
|
|
|
|
#include "modules/Maps.h"
|
|
|
|
|
#include "df/activity_event.h"
|
|
|
|
|
|
|
|
|
|
#include "df/activity_entry.h"
|
|
|
|
|
#include "df/unit_preference.h"
|
|
|
|
|
#include "df/unit_soul.h"
|
|
|
|
|
#include "df/activity_event.h"
|
|
|
|
|
#include "df/creature_raw.h"
|
|
|
|
|
#include "df/dance_form.h"
|
|
|
|
|
#include "df/descriptor_color.h"
|
|
|
|
|
#include "df/descriptor_shape.h"
|
|
|
|
|
#include "df/item_type.h"
|
|
|
|
|
|
|
|
|
|
#include "df/itemdef_weaponst.h"
|
|
|
|
|
#include "df/itemdef_trapcompst.h"
|
|
|
|
|
#include "df/itemdef_toyst.h"
|
|
|
|
|
#include "df/itemdef_toolst.h"
|
|
|
|
|
#include "df/itemdef_instrumentst.h"
|
|
|
|
|
#include "df/itemdef_armorst.h"
|
|
|
|
|
#include "df/itemdef_ammost.h"
|
|
|
|
|
#include "df/itemdef_siegeammost.h"
|
|
|
|
|
#include "df/itemdef_armorst.h"
|
|
|
|
|
#include "df/itemdef_foodst.h"
|
|
|
|
|
#include "df/itemdef_glovesst.h"
|
|
|
|
|
#include "df/itemdef_shoesst.h"
|
|
|
|
|
#include "df/itemdef_shieldst.h"
|
|
|
|
|
#include "df/itemdef_helmst.h"
|
|
|
|
|
#include "df/itemdef_instrumentst.h"
|
|
|
|
|
#include "df/itemdef_pantsst.h"
|
|
|
|
|
#include "df/itemdef_foodst.h"
|
|
|
|
|
#include "df/itemdef_shieldst.h"
|
|
|
|
|
#include "df/itemdef_shoesst.h"
|
|
|
|
|
#include "df/itemdef_siegeammost.h"
|
|
|
|
|
#include "df/itemdef_toolst.h"
|
|
|
|
|
#include "df/itemdef_toyst.h"
|
|
|
|
|
#include "df/itemdef_trapcompst.h"
|
|
|
|
|
#include "df/itemdef_weaponst.h"
|
|
|
|
|
#include "df/musical_form.h"
|
|
|
|
|
#include "df/poetic_form.h"
|
|
|
|
|
#include "df/trapcomp_flags.h"
|
|
|
|
|
#include "df/creature_raw.h"
|
|
|
|
|
#include "df/unit_preference.h"
|
|
|
|
|
#include "df/unit_soul.h"
|
|
|
|
|
#include "df/viewscreen_unitst.h"
|
|
|
|
|
#include "df/world_raws.h"
|
|
|
|
|
#include "df/descriptor_shape.h"
|
|
|
|
|
#include "df/descriptor_color.h"
|
|
|
|
|
|
|
|
|
|
using std::deque;
|
|
|
|
|
|
|
|
|
@ -137,6 +141,14 @@ static string getUnitName(df::unit * unit)
|
|
|
|
|
return label;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
|
static string getFormName(int32_t id, const string &default_ = "?") {
|
|
|
|
|
T *form = T::find(id);
|
|
|
|
|
if (form)
|
|
|
|
|
return Translation::TranslateName(&form->name);
|
|
|
|
|
return default_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void send_key(const df::interface_key &key)
|
|
|
|
|
{
|
|
|
|
|
set< df::interface_key > keys;
|
|
|
|
@ -480,6 +492,8 @@ public:
|
|
|
|
|
|
|
|
|
|
void render()
|
|
|
|
|
{
|
|
|
|
|
using namespace df::enums::interface_key;
|
|
|
|
|
|
|
|
|
|
if (Screen::isDismissed(this))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
@ -493,18 +507,18 @@ public:
|
|
|
|
|
|
|
|
|
|
int32_t y = gps->dimy - 4;
|
|
|
|
|
int32_t x = 2;
|
|
|
|
|
OutputHotkeyString(x, y, "Leave", "Esc");
|
|
|
|
|
OutputHotkeyString(x, y, "Leave", LEAVESCREEN);
|
|
|
|
|
|
|
|
|
|
x += 13;
|
|
|
|
|
string window_label = "Window Months: " + int_to_string(window_days / min_window);
|
|
|
|
|
OutputHotkeyString(x, y, window_label.c_str(), "*");
|
|
|
|
|
OutputHotkeyString(x, y, window_label.c_str(), SECONDSCROLL_PAGEDOWN);
|
|
|
|
|
|
|
|
|
|
++y;
|
|
|
|
|
x = 2;
|
|
|
|
|
OutputHotkeyString(x, y, "Fort Stats", "Shift-D");
|
|
|
|
|
OutputHotkeyString(x, y, "Fort Stats", CUSTOM_SHIFT_D);
|
|
|
|
|
|
|
|
|
|
x += 3;
|
|
|
|
|
OutputHotkeyString(x, y, "Zoom Unit", "Shift-Z");
|
|
|
|
|
OutputHotkeyString(x, y, "Zoom Unit", CUSTOM_SHIFT_Z);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string getFocusString() { return "dwarfmonitor_dwarfstats"; }
|
|
|
|
@ -1088,6 +1102,8 @@ public:
|
|
|
|
|
|
|
|
|
|
void render()
|
|
|
|
|
{
|
|
|
|
|
using namespace df::enums::interface_key;
|
|
|
|
|
|
|
|
|
|
if (Screen::isDismissed(this))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
@ -1102,18 +1118,18 @@ public:
|
|
|
|
|
|
|
|
|
|
int32_t y = gps->dimy - 4;
|
|
|
|
|
int32_t x = 2;
|
|
|
|
|
OutputHotkeyString(x, y, "Leave", "Esc");
|
|
|
|
|
OutputHotkeyString(x, y, "Leave", LEAVESCREEN);
|
|
|
|
|
|
|
|
|
|
x += 13;
|
|
|
|
|
string window_label = "Window Months: " + int_to_string(window_days / min_window);
|
|
|
|
|
OutputHotkeyString(x, y, window_label.c_str(), "*");
|
|
|
|
|
OutputHotkeyString(x, y, window_label.c_str(), SECONDSCROLL_PAGEDOWN);
|
|
|
|
|
|
|
|
|
|
++y;
|
|
|
|
|
x = 2;
|
|
|
|
|
OutputHotkeyString(x, y, "Dwarf Stats", "Shift-D");
|
|
|
|
|
OutputHotkeyString(x, y, "Dwarf Stats", CUSTOM_SHIFT_D);
|
|
|
|
|
|
|
|
|
|
x += 3;
|
|
|
|
|
OutputHotkeyString(x, y, "Zoom Unit", "Shift-Z");
|
|
|
|
|
OutputHotkeyString(x, y, "Zoom Unit", CUSTOM_SHIFT_Z);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string getFocusString() { return "dwarfmonitor_fortstats"; }
|
|
|
|
@ -1201,6 +1217,18 @@ struct preference_map
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
label = ENUM_ATTR_STR(item_type, caption, pref.item_type);
|
|
|
|
|
if (label.size())
|
|
|
|
|
{
|
|
|
|
|
if (label[label.size() - 1] == 's')
|
|
|
|
|
label += "es";
|
|
|
|
|
else
|
|
|
|
|
label += "s";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
label = "UNKNOWN";
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1217,15 +1245,13 @@ struct preference_map
|
|
|
|
|
{
|
|
|
|
|
case (T_type::LikeCreature):
|
|
|
|
|
{
|
|
|
|
|
label = "Creature :";
|
|
|
|
|
Units::getRaceNamePluralById(pref.creature_id);
|
|
|
|
|
label = "Creature :" + Units::getRaceNamePluralById(pref.creature_id);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case (T_type::HateCreature):
|
|
|
|
|
{
|
|
|
|
|
label = "Hates :";
|
|
|
|
|
Units::getRaceNamePluralById(pref.creature_id);
|
|
|
|
|
label = "Hates :" + Units::getRaceNamePluralById(pref.creature_id);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1290,6 +1316,22 @@ struct preference_map
|
|
|
|
|
case (T_type::LikeColor):
|
|
|
|
|
label += "Color :" + raws.language.colors[pref.color_id]->name;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case (T_type::LikePoeticForm):
|
|
|
|
|
label += "Poetry :" + getFormName<df::poetic_form>(pref.poetic_form_id);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case (T_type::LikeMusicalForm):
|
|
|
|
|
label += "Music :" + getFormName<df::musical_form>(pref.musical_form_id);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case (T_type::LikeDanceForm):
|
|
|
|
|
label += "Dance :" + getFormName<df::dance_form>(pref.dance_form_id);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
label += string("UNKNOWN ") + ENUM_KEY_STR(unit_preference::T_type, pref.type);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -1304,14 +1346,14 @@ public:
|
|
|
|
|
preferences_column.auto_select = true;
|
|
|
|
|
preferences_column.setTitle("Preference");
|
|
|
|
|
preferences_column.bottom_margin = 3;
|
|
|
|
|
preferences_column.search_margin = 35;
|
|
|
|
|
preferences_column.search_margin = 50;
|
|
|
|
|
|
|
|
|
|
dwarf_column.multiselect = false;
|
|
|
|
|
dwarf_column.auto_select = true;
|
|
|
|
|
dwarf_column.allow_null = true;
|
|
|
|
|
dwarf_column.setTitle("Units with Preference");
|
|
|
|
|
dwarf_column.bottom_margin = 3;
|
|
|
|
|
dwarf_column.search_margin = 35;
|
|
|
|
|
dwarf_column.search_margin = 50;
|
|
|
|
|
|
|
|
|
|
populatePreferencesColumn();
|
|
|
|
|
}
|
|
|
|
@ -1444,6 +1486,18 @@ public:
|
|
|
|
|
return false;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case (T_type::LikePoeticForm):
|
|
|
|
|
return lhs.poetic_form_id == rhs.poetic_form_id;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case (T_type::LikeMusicalForm):
|
|
|
|
|
return lhs.musical_form_id == rhs.musical_form_id;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case (T_type::LikeDanceForm):
|
|
|
|
|
return lhs.dance_form_id == rhs.dance_form_id;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -1483,8 +1537,13 @@ public:
|
|
|
|
|
case (T_type::LikeColor):
|
|
|
|
|
return COLOR_BLUE;
|
|
|
|
|
|
|
|
|
|
case (T_type::LikePoeticForm):
|
|
|
|
|
case (T_type::LikeMusicalForm):
|
|
|
|
|
case (T_type::LikeDanceForm):
|
|
|
|
|
return COLOR_LIGHTCYAN;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
return COLOR_LIGHTMAGENTA;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
@ -1543,6 +1602,11 @@ public:
|
|
|
|
|
dwarf_column.setHighlight(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
df::unit *getSelectedUnit() override
|
|
|
|
|
{
|
|
|
|
|
return (selected_column == 1) ? dwarf_column.getFirstSelectedElem() : nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void feed(set<df::interface_key> *input)
|
|
|
|
|
{
|
|
|
|
|
bool key_processed = false;
|
|
|
|
@ -1572,9 +1636,19 @@ public:
|
|
|
|
|
Screen::dismiss(this);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (input->count(interface_key::CUSTOM_SHIFT_V))
|
|
|
|
|
{
|
|
|
|
|
df::unit *unit = getSelectedUnit();
|
|
|
|
|
if (unit)
|
|
|
|
|
{
|
|
|
|
|
auto unitscr = df::allocate<df::viewscreen_unitst>();
|
|
|
|
|
unitscr->unit = unit;
|
|
|
|
|
Screen::show(unitscr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (input->count(interface_key::CUSTOM_SHIFT_Z))
|
|
|
|
|
{
|
|
|
|
|
df::unit *selected_unit = (selected_column == 1) ? dwarf_column.getFirstSelectedElem() : nullptr;
|
|
|
|
|
df::unit *selected_unit = getSelectedUnit();
|
|
|
|
|
if (selected_unit)
|
|
|
|
|
{
|
|
|
|
|
input->clear();
|
|
|
|
@ -1610,6 +1684,8 @@ public:
|
|
|
|
|
|
|
|
|
|
void render()
|
|
|
|
|
{
|
|
|
|
|
using namespace df::enums::interface_key;
|
|
|
|
|
|
|
|
|
|
if (Screen::isDismissed(this))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
@ -1623,10 +1699,15 @@ public:
|
|
|
|
|
|
|
|
|
|
int32_t y = gps->dimy - 3;
|
|
|
|
|
int32_t x = 2;
|
|
|
|
|
OutputHotkeyString(x, y, "Leave", "Esc");
|
|
|
|
|
OutputHotkeyString(x, y, "Leave", LEAVESCREEN);
|
|
|
|
|
|
|
|
|
|
x += 2;
|
|
|
|
|
OutputHotkeyString(x, y, "View Unit", CUSTOM_SHIFT_V, false, 0,
|
|
|
|
|
getSelectedUnit() ? COLOR_WHITE : COLOR_DARKGREY);
|
|
|
|
|
|
|
|
|
|
x += 2;
|
|
|
|
|
OutputHotkeyString(x, y, "Zoom Unit", "Shift-Z");
|
|
|
|
|
OutputHotkeyString(x, y, "Zoom Unit", CUSTOM_SHIFT_Z, false, 0,
|
|
|
|
|
getSelectedUnit() ? COLOR_WHITE : COLOR_DARKGREY);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string getFocusString() { return "dwarfmonitor_preferences"; }
|
|
|
|
|