For when the player swaps characters. We need to completely reload ScriptPanes, because a lot of ScriptPanes do not expect the character to suddenly change and may break or spill data over.
| 988 | // For when the player swaps characters. We need to completely reload ScriptPanes, |
| 989 | // because a lot of ScriptPanes do not expect the character to suddenly change and may break or spill data over. |
| 990 | void MainInterface::takeScriptPanes(List<ScriptPaneInfo>& out) { |
| 991 | m_paneManager.dismissWhere([&](PanePtr const& pane) { |
| 992 | if (auto scriptPane = as<ScriptPane>(pane)) { |
| 993 | if (scriptPane->isDismissed()) |
| 994 | return false; |
| 995 | auto sourceEntityId = scriptPane->sourceEntityId(); |
| 996 | m_interactionScriptPanes.remove(sourceEntityId); |
| 997 | auto& info = out.emplaceAppend(); |
| 998 | info.scriptPane = scriptPane; |
| 999 | info.config = scriptPane->rawConfig(); |
| 1000 | info.sourceEntityId = sourceEntityId; |
| 1001 | info.visible = scriptPane->visibility(); |
| 1002 | info.position = scriptPane->relativePosition(); |
| 1003 | |
| 1004 | return true; |
| 1005 | } |
| 1006 | return false; |
| 1007 | }); |
| 1008 | } |
| 1009 | |
| 1010 | void MainInterface::reviveScriptPanes(List<ScriptPaneInfo>& panes) { |
| 1011 | for (auto& info : panes) { // this is evil and stupid |
no test coverage detected