Skip to content

Commit

Permalink
refactor: moved setBaseCommand procedure to Nim
Browse files Browse the repository at this point in the history
FossilOrigin-Name: 73c0c3cd7748067f617d87b3fe751eac715c05f4abea568b2661baecd485ba45
  • Loading branch information
thindil committed Sep 12, 2024
1 parent 95fcfef commit 413193e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions nim/src/ui/mainmenucommands.nim
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,24 @@ proc setCareerCommand(clientData: cint; interp: PInterp; argc: cint;
tclEval(script = infoText & " configure -state disabled")
return tclOk

proc setBaseCommand(clientData: cint; interp: PInterp; argc: cint;
argv: cstringArray): TclResults {.exportc.} =
let
comboBox = ".newgamemenu.canvas.player.base"
baseName = tclEval2(script = comboBox & " get")
infoText = ".newgamemenu.info.text"
tclEval(script = infoText & " configure -state normal")
tclEval(script = infoText & " delete 1.0 end")
tclEval(script = infoText & " insert end {Select your starting base type from a list. Your starting base is your home base, where you can gain faster experience. Home base can be changed later. Some types of bases are better starting points than others. More info about each base type can be found after selecting it.\n\n}")
for baseType in basesTypesList.values:
if baseType.name == baseName:
tclEval(script = infoText & " insert end {" & baseType.description & "}")
break
if baseName == "Any":
tclEval(script = infoText & " insert end {Start the game in randomly selected base type.}")
tclEval(script = infoText & " configure -state disabled")
return tclOk

proc addCommands*() =
discard
# addCommand("OpenLink", openLinkCommand)
Expand All @@ -296,3 +314,4 @@ proc addCommands*() =
# addCommand("DeleteGame", deleteGameCommand)
# addCommand("SetFaction", setFactionCommand)
# addCommand("SetCareer", setCareerCommand)
# addCommand("SetBase", setBaseCommand)

0 comments on commit 413193e

Please sign in to comment.