Merge pull request #2925 from robob27/confirm-perf

Fix confirm performance
develop
Myk 2023-02-17 16:25:27 -08:00 committed by GitHub
commit 8ea77d66cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 11 deletions

@ -43,6 +43,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
-@ `autochop`: generate default names for burrows with no assigned names
- ``Buildings::StockpileIterator``: check for stockpile items on block boundary.
- `tailor`: block making clothing sized for toads; make replacement clothing orders use the size of the wearer, not the size of the garment; add support for adamantine cloth (off by default); improve logging
-@ `confirm`: fix fps drop when enabled
## Misc Improvements
- DFHack tool windows that capture mouse clicks (and therefore prevent you from clicking on the "pause" button) now unconditionally pause the game when they open (but you can still unpause with the keyboard if you want to). Examples of this behavior: `gui/quickfort`, `gui/blueprint`, `gui/liquids`

@ -66,6 +66,7 @@ bool set_conf_paused (string name, bool pause);
class confirmation_base {
public:
bool dirty = false;
enum cstate { INACTIVE, ACTIVE, SELECTED };
virtual string get_id() = 0;
virtual string get_focus_string() = 0;
@ -281,6 +282,7 @@ public:
}
state = s;
dirty = true;
if (s == INACTIVE) {
active_id = "";
confirmation_base::active = nullptr;
@ -371,17 +373,18 @@ public:
return state == ACTIVE;
}
void render() {
static vector<string> lines;
static const std::string pause_message =
"Pause confirmations until you exit this screen";
Screen::Pen corner_ul = Screen::Pen((char)201, COLOR_GREY, COLOR_BLACK);
Screen::Pen corner_ur = Screen::Pen((char)187, COLOR_GREY, COLOR_BLACK);
Screen::Pen corner_dl = Screen::Pen((char)200, COLOR_GREY, COLOR_BLACK);
Screen::Pen corner_dr = Screen::Pen((char)188, COLOR_GREY, COLOR_BLACK);
Screen::Pen border_ud = Screen::Pen((char)205, COLOR_GREY, COLOR_BLACK);
Screen::Pen border_lr = Screen::Pen((char)186, COLOR_GREY, COLOR_BLACK);
if (state == ACTIVE)
{
static vector<string> lines;
static const std::string pause_message =
"Pause confirmations until you exit this screen";
Screen::Pen corner_ul = Screen::Pen((char)201, COLOR_GREY, COLOR_BLACK);
Screen::Pen corner_ur = Screen::Pen((char)187, COLOR_GREY, COLOR_BLACK);
Screen::Pen corner_dl = Screen::Pen((char)200, COLOR_GREY, COLOR_BLACK);
Screen::Pen corner_dr = Screen::Pen((char)188, COLOR_GREY, COLOR_BLACK);
Screen::Pen border_ud = Screen::Pen((char)205, COLOR_GREY, COLOR_BLACK);
Screen::Pen border_lr = Screen::Pen((char)186, COLOR_GREY, COLOR_BLACK);
split_string(&lines, get_message(), "\n");
size_t max_length = 40;
for (string line : lines)
@ -463,8 +466,10 @@ public:
}
set_state(INACTIVE);
}
// clean up any artifacts
df::global::gps->force_full_display_count = 1;
if(dirty) {
dirty = false;
df::global::gps->force_full_display_count = 1;
}
}
string get_id() override = 0;
string get_focus_string() override = 0;