Skip to content

Commit

Permalink
refactor: moved debugMoveShipCommand to Nim
Browse files Browse the repository at this point in the history
FossilOrigin-Name: 0e4eb6749f76df404c3872da9fc3e40429e8753f51222ca13728fe637d196b55
  • Loading branch information
thindil committed Sep 2, 2024
1 parent 6ef61a4 commit 9fa7e84
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion nim/src/ui/debugui.nim
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import std/[os, strutils, tables]
import ../[basestypes, game, gamesaveload, items, maps, tk]
import mapsui

proc refreshModuleCommand(clientData: cint; interp: PInterp; argc: cint;
argv: cstringArray): TclResults {.sideEffect, raises: [], tags: [], exportc.} =
Expand Down Expand Up @@ -318,7 +319,8 @@ proc refreshBaseCommand(clientData: cint; interp: PInterp; argc: cint;
return tclOk

proc debugSaveGameCommand(clientData: cint; interp: PInterp; argc: cint;
argv: cstringArray): TclResults {.sideEffect, raises: [], tags: [RootEffect], exportc.} =
argv: cstringArray): TclResults {.sideEffect, raises: [], tags: [
RootEffect], exportc.} =
## Save the game
##
## * clientData - the additional data for the Tcl command
Expand All @@ -336,6 +338,16 @@ proc debugSaveGameCommand(clientData: cint; interp: PInterp; argc: cint;
return showError(message = "Can't save the game.")
return tclOk

proc debugMoveShipCommand(clientData: cint; interp: PInterp; argc: cint;
argv: cstringArray): TclResults {.exportc.} =
let frameName = ".debugdialog.main.ship"
var spinBox = frameName & ".x"
playerShip.skyX = tclEval2(script = spinBox & " get").parseInt
spinBox = frameName & ".y"
playerShip.skyY = tclEval2(script = spinBox & " get").parseInt
showSkyMap(clear = true)
return tclOk

proc showDebugUi*() =
tclEvalFile(fileName = dataDirectory & DirSep & "debug.tcl")
# addCommand("Refresh", refreshCommand)
Expand All @@ -345,3 +357,4 @@ proc showDebugUi*() =
# addCommand("RefreshEvents", refreshEventsCommand)
# addCommand("RefreshBase", refreshBaseCommand)
# addCommand("DebugSaveGame", debugSaveGameCommand)
# addCommand("DebugMoveShip", debugMoveShipCommand)

0 comments on commit 9fa7e84

Please sign in to comment.