Skip to content

Commit

Permalink
Fix equipment market widget not updating stock properly
Browse files Browse the repository at this point in the history
1. The third argument to bought/sold wasn't passed correctly, instead the nil
valued member variable was used

2. When selling/buying from ship equipment market, it defaulted to -1 units,
should be 1.

Closes #5071
  • Loading branch information
impaktor authored and Web-eWorks committed Dec 12, 2020
1 parent 013721f commit f371fca
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions data/pigui/libs/equipment-market.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,8 @@ local defaultFuncs = {
end,

-- do something when we buy this commodity
bought = function (self, e)
local count = -1
if self.tradeAmount ~= nil then
count = self.tradeAmount
end
bought = function (self, e, tradeamount)
local count = tradeamount or 1 -- default to 1 for e.g. equipment market
Game.player:GetDockedWith():AddEquipmentStock(e, -count)
end,

Expand Down Expand Up @@ -139,11 +136,8 @@ local defaultFuncs = {
end,

-- do something when we sell this items
sold = function (self, e)
local count = -1
if self.tradeAmount ~= nil then
count = self.tradeAmount
end
sold = function (self, e, tradeamount)
local count = tradeamount or 1 -- default to 1 for e.g. equipment market
Game.player:GetDockedWith():AddEquipmentStock(e, count)
end,

Expand Down

0 comments on commit f371fca

Please sign in to comment.