MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / takeScriptPanes

Method takeScriptPanes

source/frontend/StarMainInterface.cpp:990–1008  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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.
990void 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
1010void MainInterface::reviveScriptPanes(List<ScriptPaneInfo>& panes) {
1011 for (auto& info : panes) { // this is evil and stupid

Callers 1

changeStateMethod · 0.80

Calls 7

dismissWhereMethod · 0.80
isDismissedMethod · 0.80
emplaceAppendMethod · 0.80
visibilityMethod · 0.80
relativePositionMethod · 0.80
sourceEntityIdMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected