Skip to content

Commit

Permalink
refactor: continue work on move newGameCommand procedure to Nim
Browse files Browse the repository at this point in the history
FossilOrigin-Name: e0880d6ef6a4d436131ef62417623bfe12e87fe2aac9dafecb823a6492275bad
  • Loading branch information
thindil committed Sep 13, 2024
1 parent a9279ff commit d2d8917
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 @@ -363,6 +363,26 @@ proc newGameCommand(clientData: cint; interp: PInterp; argc: cint;
currentGoal = goalsList[getRandom(min = 1, max = goalsList.len)]
var textEntry = playerFrameName & ".playername"
newGameSettings.playerName = tclEval2(script = textEntry & " get")
textEntry = playerFrameName & ".shipname"
newGameSettings.shipName = tclEval2(script = textEntry & " get")
var comboBox = playerFrameName & ".faction"
if tclEval2(script = comboBox & " get") == "Random":
newGameSettings.playerFaction = "random"
else:
block setFaction:
for index, faction in factionsList:
if faction.name == tclEval2(script = comboBox & " get"):
newGameSettings.playerFaction = index
comboBox = playerFrameName & ".career"
for key, career in faction.careers:
if career.name == tclEval2(script = comboBox & " get"):
newGameSettings.playerCareer = key
break setFaction
comboBox = playerFrameName & ".career"
if tclEval2(script = comboBox & " get") == "Random":
newGameSettings.playerCareer = "random"
comboBox = playerFrameName & ".base"
newGameSettings.startingBase = "Any"
return tclOk

proc addCommands*() =
Expand Down

0 comments on commit d2d8917

Please sign in to comment.