From d2d8917c0382cab56a3ec28ca849e6507a45f3c1 Mon Sep 17 00:00:00 2001 From: thindil Date: Fri, 13 Sep 2024 03:46:09 +0000 Subject: [PATCH] refactor: continue work on move newGameCommand procedure to Nim FossilOrigin-Name: e0880d6ef6a4d436131ef62417623bfe12e87fe2aac9dafecb823a6492275bad --- nim/src/ui/mainmenucommands.nim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/nim/src/ui/mainmenucommands.nim b/nim/src/ui/mainmenucommands.nim index 0f7e241e3..a967ba90f 100644 --- a/nim/src/ui/mainmenucommands.nim +++ b/nim/src/ui/mainmenucommands.nim @@ -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*() =