Skip to content

Commit

Permalink
Fix unused/free cabins shown in station footer being wrong
Browse files Browse the repository at this point in the history
closes #4806
  • Loading branch information
impaktor committed Feb 23, 2020
1 parent 4d6218b commit 1a29683
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions data/pigui/views/station-view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ if not stationView then
ui.nextColumn()
ui.text(l.CABINS .. ': ')
ui.sameLine()
local cabins_total = Game.player:GetEquipCountOccupied("cabin")
local cabins_free = player.cabin_cap or 0
local cabins = player:GetEquipCountOccupied("cabin")
local cabins_used = cabins_total - cabins_free
gaugePos = ui.getWindowPos() + ui.getCursorPos() + self.style.inventoryPadding
gaugeWidth = ui.getContentRegion().x - self.style.inventoryPadding.x - self.style.itemSpacing.x
ui.gauge(gaugePos, cabins - cabins_free, '', string.format('%%it %s / %it %s', l.USED, cabins, l.FREE), 0, cabins, icons.personal, colors.gaugeEquipmentMarket, '', gaugeWidth, ui.getTextLineHeight())
ui.gauge(gaugePos, cabins_used, '', string.format('%%it %s / %it %s', l.USED, cabins_free, l.FREE), 0, cabins_free, icons.personal, colors.gaugeEquipmentMarket, '', gaugeWidth, ui.getTextLineHeight())
ui.nextColumn()
ui.text(legalText)
ui.columns(1, '', false)
Expand All @@ -64,4 +65,4 @@ if not stationView then
ui.registerModule("game", function() stationView:renderTabView() end)
end

return stationView
return stationView

0 comments on commit 1a29683

Please sign in to comment.