|
|
@ -157,13 +157,6 @@ static inline void OutputToggleString(int &x, int &y, const char *text, df::inte
|
|
|
|
OutputToggleString(x, y, text, DFHack::Screen::getKeyDisplay(hotkey).c_str(), state, newline, left_margin, color, hotkey_color, map);
|
|
|
|
OutputToggleString(x, y, text, DFHack::Screen::getKeyDisplay(hotkey).c_str(), state, newline, left_margin, color, hotkey_color, map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline string int_to_string(const int n)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::ostringstream ss;
|
|
|
|
|
|
|
|
ss << n;
|
|
|
|
|
|
|
|
return ss.str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static inline void set_to_limit(int &value, const int maximum, const int min = 0)
|
|
|
|
static inline void set_to_limit(int &value, const int maximum, const int min = 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (value < min)
|
|
|
|
if (value < min)
|
|
|
@ -172,23 +165,6 @@ static inline void set_to_limit(int &value, const int maximum, const int min = 0
|
|
|
|
value = maximum;
|
|
|
|
value = maximum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// trim from start
|
|
|
|
|
|
|
|
static inline std::string <rim(std::string &s) {
|
|
|
|
|
|
|
|
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](char x){ return !std::isspace(x); }));
|
|
|
|
|
|
|
|
return s;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// trim from end
|
|
|
|
|
|
|
|
static inline std::string &rtrim(std::string &s) {
|
|
|
|
|
|
|
|
s.erase(std::find_if(s.rbegin(), s.rend(), [](char x){ return !std::isspace(x); }).base(), s.end());
|
|
|
|
|
|
|
|
return s;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// trim from both ends
|
|
|
|
|
|
|
|
static inline std::string &trim(std::string &s) {
|
|
|
|
|
|
|
|
return ltrim(rtrim(s));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline void paint_text(const UIColor color, const int &x, const int &y, const std::string &text, const UIColor background = 0)
|
|
|
|
inline void paint_text(const UIColor color, const int &x, const int &y, const std::string &text, const UIColor background = 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Screen::paintString(Screen::Pen(' ', color, background), x, y, text);
|
|
|
|
Screen::paintString(Screen::Pen(' ', color, background), x, y, text);
|
|
|
|