Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/frontend/StarMerchantInterface.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-03-28 04:46:07 +1100
committerKae <80987908+Novaenia@users.noreply.github.com>2024-03-28 04:46:07 +1100
commit0f9a200e6b64ad49a80c860eee5624b48acea6f1 (patch)
treec08998cb464ed9320c469034269b497686a300d3 /source/frontend/StarMerchantInterface.cpp
parentd76d217901d1afaa6a2b8703d7187d83ff41fe5f (diff)
fix: crafting interfaces not working with new middle-click opening
Diffstat (limited to 'source/frontend/StarMerchantInterface.cpp')
-rw-r--r--source/frontend/StarMerchantInterface.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/source/frontend/StarMerchantInterface.cpp b/source/frontend/StarMerchantInterface.cpp
index ec17391..51bccb6 100644
--- a/source/frontend/StarMerchantInterface.cpp
+++ b/source/frontend/StarMerchantInterface.cpp
@@ -118,7 +118,8 @@ void MerchantPane::dismissed() {
for (auto unsold : m_itemBag->takeAll())
m_player->giveItem(unsold);
- m_worldClient->sendEntityMessage(m_sourceEntityId, "onMerchantClosed");
+ if (m_sourceEntityId != NullEntityId)
+ m_worldClient->sendEntityMessage(m_sourceEntityId, "onMerchantClosed");
}
PanePtr MerchantPane::createTooltip(Vec2I const& screenPosition) {
@@ -141,7 +142,7 @@ PanePtr MerchantPane::createTooltip(Vec2I const& screenPosition) {
void MerchantPane::update(float dt) {
Pane::update(dt);
- if (!m_worldClient->playerCanReachEntity(m_sourceEntityId))
+ if (m_sourceEntityId != NullEntityId && !m_worldClient->playerCanReachEntity(m_sourceEntityId))
dismiss();
if (m_refreshTimer.wrapTick()) {
@@ -315,7 +316,8 @@ void MerchantPane::buy() {
auto reportItem = m_selectedItem->clone();
reportItem->setCount(reportItem->count() * m_buyCount, true);
auto buySummary = JsonObject{{"item", reportItem->descriptor().toJson()}, {"total", m_buyTotal}};
- m_worldClient->sendEntityMessage(m_sourceEntityId, "onBuy", {buySummary});
+ if (m_sourceEntityId != NullEntityId)
+ m_worldClient->sendEntityMessage(m_sourceEntityId, "onBuy", {buySummary});
auto& guiContext = GuiContext::singleton();
guiContext.playAudio(Root::singleton().assets()->json("/merchant.config:buySound").toString());