Skip to content

Commit

Permalink
refactor: started work on move setFactionCommand procedure to Nim
Browse files Browse the repository at this point in the history
FossilOrigin-Name: f433da0ceb3f23cd46669394c2875a584392a87838193d9a32c472727ba337cf
  • Loading branch information
thindil committed Sep 11, 2024
1 parent 74a8a38 commit 791724b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions nim/src/ui/mainmenucommands.nim
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,30 @@ proc deleteGameCommand(clientData: cint; interp: PInterp; argc: cint;
res = "deletesave", inGame = false)
return tclOk

proc setFactionCommand(clientData: cint; interp: PInterp; argc: cint;
argv: cstringArray): TclResults {.exportc.} =
let frameName = ".newgamemenu.canvas.player"
var comboBox = frameName & ".faction"
let factionName = tclEval2(script = comboBox & " get")
var label = ""
if factionName == "Random":
label = frameName & ".labelcareer"
tclEval(script = "grid remove " & label)
comboBox = frameName & ".career"
tclEval(script = comboBox & " set Random")
tclEval(script = "grid remove " & comboBox)
label = frameName & ".labelbase"
tclEval(script = "grid remove " & label)
comboBox = frameName & ".base"
tclEval(script = comboBox & " set Any")
tclEval(script = "grid remove " & comboBox)
return tclOk

proc addCommands*() =
discard
# addCommand("OpenLink", openLinkCommand)
# addCommand("ShowFile", showFileCommand)
# addCommand("ShowNews", showNewsCommand)
# addCommand("ShowHallOfFame", showHallOfFameCommand)
# addCommand("DeleteGame", deleteGameCommand)
# addCommand("SetFaction", setFactionCommand)

0 comments on commit 791724b

Please sign in to comment.