Skip to content

Commit

Permalink
refactor: continue work on move showShipyardCommand to Nim
Browse files Browse the repository at this point in the history
FossilOrigin-Name: 0455aafb4c83c03a8c7bc1546626e19ac65cbc6ea2152f8765a242a82c61c801
  • Loading branch information
thindil committed Jul 19, 2024
1 parent f1dfc7d commit db40546
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion nim/src/ui/basesshipyardui.nim
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# along with Steam Sky. If not, see <http://www.gnu.org/licenses/>.

import std/[os, strutils, tables]
import ../[config, crewinventory, game, maps, tk, types]
import ../[bases, config, crewinventory, game, maps, shipscrew, shipmodules, tk, types]
import coreui, mapsui, table

var
Expand Down Expand Up @@ -110,6 +110,28 @@ proc showShipyardCommand(clientData: cint; interp: PInterp; argc: cint;
addButton(table = installTable, text = modulesList[index].name,
tooltip = "Show the module's info", command = "ShowInstallInfo {" &
$index & "}", column = 1)
addButton(table = installTable, text = getModuleType(moduleIndex = index),
tooltip = "Show the module's info", command = "ShowInstallInfo {" &
$index & "}", column = 2)
addButton(table = installTable, text = $moduleSize,
tooltip = "Show the module's info", command = "ShowInstallInfo {" &
$index & "}", column = 3, newRow = false, color = (if modulesList[
index].mType == ModuleType.hull: (if moduleSize <
allSpace: "red" elif moduleSize >
allSpace: "green" else: "") else: (if moduleSize >
maxSize: "red" else: "")))
addButton(table = installTable, text = modulesList[index].repairMaterial,
tooltip = "Show the module's info", command = "ShowInstallInfo {" &
$index & "}", column = 4)
var cost = modulesList[index].price
countPrice(price = cost, traderIndex = findMember(order = talk))
addButton(table = installTable, text = $cost,
tooltip = "Show the module's info", command = "ShowInstallInfo {" &
$index & "}", column = 5, newRow = true, color = (if moneyIndex2 >
-1 and cost <= playerShip.cargo[
moneyIndex2].amount: "" else: "red"))
if installTable.row == gameSettings.listsLimit + 1:
break
return tclOk

proc addCommands*() {.sideEffect, raises: [], tags: [].} =
Expand Down

0 comments on commit db40546

Please sign in to comment.