Merge remote-tracking branch 'falconne/plugin_dwarfmonitor' into update-falconne-plugins

develop
lethosor 2014-11-15 16:36:35 -05:00
commit 9b0d0eba45
1 changed files with 46 additions and 16 deletions

@ -48,7 +48,7 @@ using df::global::ui;
typedef int16_t activity_type; typedef int16_t activity_type;
#define PLUGIN_VERSION 0.8 #define PLUGIN_VERSION 0.9
#define DAY_TICKS 1200 #define DAY_TICKS 1200
#define DELTA_TICKS 100 #define DELTA_TICKS 100
@ -66,6 +66,7 @@ struct less_second {
static bool monitor_jobs = false; static bool monitor_jobs = false;
static bool monitor_misery = true; static bool monitor_misery = true;
static bool monitor_date = true;
static map<df::unit *, deque<activity_type>> work_history; static map<df::unit *, deque<activity_type>> work_history;
static int misery[] = { 0, 0, 0, 0, 0, 0, 0 }; static int misery[] = { 0, 0, 0, 0, 0, 0, 0 };
@ -1689,7 +1690,9 @@ struct dwarf_monitor_hook : public df::viewscreen_dwarfmodest
{ {
INTERPOSE_NEXT(render)(); INTERPOSE_NEXT(render)();
if (monitor_misery && Maps::IsValid()) if (Maps::IsValid())
{
if (monitor_misery)
{ {
string entries[7]; string entries[7];
size_t length = 9; size_t length = 9;
@ -1709,6 +1712,29 @@ struct dwarf_monitor_hook : public df::viewscreen_dwarfmodest
OutputString(COLOR_WHITE, x, y, "/"); OutputString(COLOR_WHITE, x, y, "/");
} }
} }
if (monitor_date)
{
int x = gps->dimx - 30;
int y = 0;
ostringstream date_str;
auto month = World::ReadCurrentMonth();
auto day = World::ReadCurrentDay();
date_str << "Date:" << World::ReadCurrentYear() << "/" <<
((month < 10) ? "0" : "") << month << "/" <<
((day < 10) ? "0" : "") << day;
OutputString(COLOR_GREY, x, y, date_str.str());
x = 1;
y = gps->dimy - 1;
if (World::ReadCurrentWeather() == weather_type::Rain)
OutputString(COLOR_BLUE, x, y, "Rain");
else if (World::ReadCurrentWeather() == weather_type::Snow)
OutputString(COLOR_WHITE, x, y, "Snow");
}
}
} }
}; };
@ -1732,12 +1758,16 @@ static bool set_monitoring_mode(const string &mode, const bool &state)
if (!monitor_jobs) if (!monitor_jobs)
reset(); reset();
} }
else if (mode == "misery" || mode == "all")
if (mode == "misery" || mode == "all")
{ {
mode_recognized = true; mode_recognized = true;
monitor_misery = state; monitor_misery = state;
} }
else if (mode == "date" || mode == "all")
{
mode_recognized = true;
monitor_date = state;
}
return mode_recognized; return mode_recognized;
} }