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

Method openMerchantWindow

source/frontend/StarMainInterface.cpp:233–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231}
232
233void MainInterface::openMerchantWindow(Json const& config, EntityId sourceEntityId) {
234 if (m_merchantWindow && m_paneManager.isDisplayed(m_merchantWindow)) {
235 m_paneManager.dismissPane(m_merchantWindow);
236 if (sourceEntityId != NullEntityId && m_merchantWindow->sourceEntityId() == sourceEntityId) {
237 m_merchantWindow.reset();
238 return;
239 }
240 }
241
242 bool openWithInventory = config.getBool("openWithInventory", true);
243 bool closeWithInventory = config.getBool("closeWithInventory", !m_paneManager.registeredPaneIsDisplayed(MainInterfacePanes::Inventory));
244 m_merchantWindow = make_shared<MerchantPane>(m_client->worldClient(), m_client->mainPlayer(), config, sourceEntityId);
245 m_paneManager.displayPane(PaneLayer::Window, m_merchantWindow, [this, closeWithInventory](PanePtr const&) {
246 if (closeWithInventory)
247 m_paneManager.dismissRegisteredPane(MainInterfacePanes::Inventory);
248 });
249 if (openWithInventory)
250 m_paneManager.displayRegisteredPane(MainInterfacePanes::Inventory);
251
252 m_paneManager.bringPaneAdjacent(m_paneManager.registeredPane(MainInterfacePanes::Inventory),
253 m_merchantWindow, Root::singleton().assets()->json("/interface.config:bringAdjacentWindowGap").toFloat());
254}
255
256void MainInterface::togglePlainCraftingWindow() {
257 m_paneManager.toggleRegisteredPane(MainInterfacePanes::CraftingPlain);

Callers

nothing calls this directly

Calls 15

singletonClass · 0.85
dismissPaneMethod · 0.80
getBoolMethod · 0.80
worldClientMethod · 0.80
mainPlayerMethod · 0.80
displayPaneMethod · 0.80
dismissRegisteredPaneMethod · 0.80
displayRegisteredPaneMethod · 0.80
bringPaneAdjacentMethod · 0.80
registeredPaneMethod · 0.80
toFloatMethod · 0.80

Tested by

no test coverage detected