| 488 | static std::map<df::viewscreen*, Plugin*> plugin_screens; |
| 489 | |
| 490 | bool Screen::show(std::unique_ptr<df::viewscreen> screen, df::viewscreen *before, Plugin *plugin) |
| 491 | { |
| 492 | CHECK_NULL_POINTER(screen); |
| 493 | CHECK_INVALID_ARGUMENT(!screen->parent && !screen->child); |
| 494 | |
| 495 | if (!gps || !gview) return false; |
| 496 | |
| 497 | df::viewscreen *parent = &gview->view; |
| 498 | while (parent && parent->child != before) |
| 499 | parent = parent->child; |
| 500 | |
| 501 | if (!parent) return false; |
| 502 | |
| 503 | gps->force_full_display_count += 2; |
| 504 | |
| 505 | screen->child = parent->child; |
| 506 | screen->parent = parent; |
| 507 | df::viewscreen* s = screen.release(); |
| 508 | parent->child = s; |
| 509 | if (s->child) |
| 510 | s->child->parent = s; |
| 511 | |
| 512 | if (dfhack_viewscreen::is_instance(s)) |
| 513 | static_cast<dfhack_viewscreen*>(s)->onShow(); |
| 514 | |
| 515 | if (plugin) |
| 516 | plugin_screens[s] = plugin; |
| 517 | |
| 518 | return true; |
| 519 | } |
| 520 | |
| 521 | void Screen::dismiss(df::viewscreen *screen, bool to_first) |
| 522 | { |
nothing calls this directly
no test coverage detected