From 88ce83a9f8d1a26f9515152f5026dde64a4a75a1 Mon Sep 17 00:00:00 2001 From: thindil Date: Tue, 30 Jan 2024 04:16:39 +0000 Subject: [PATCH] refactor: moved resignGameCommand to Nim FossilOrigin-Name: b3bd4ca5b2a3501c91b234a2256fa8bc21d36fa2e7bbc2adcfa60d63b56accdc --- nim/src/ui/mapsuicommands.nim | 6 ++++++ src/ui/maps-ui-commands.adb | 36 +++++++++++++++++------------------ 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/nim/src/ui/mapsuicommands.nim b/nim/src/ui/mapsuicommands.nim index 2ac33f711..e30dea944 100644 --- a/nim/src/ui/mapsuicommands.nim +++ b/nim/src/ui/mapsuicommands.nim @@ -231,6 +231,11 @@ proc quitGameCommand(clientData: cint; interp: PInterp; argc: cint; showQuestion(question = "Are you sure want to quit?", res = "quit") return tclOk +proc resignGameCommand(clientData: cint; interp: PInterp; argc: cint; + argv: openArray[cstring]): TclResults = + showQuestion(question = "Are you sure want to resign from game?", res = "resign") + return tclOk + proc addCommands*() = addCommand("HideMapButtons", hideMapButtonsCommand) addCommand("ShowMapButtons", showMapButtonsCommand) @@ -244,6 +249,7 @@ proc addCommands*() = addCommand("MoveMap", moveMapCommand) addCommand("MoveShip", moveShipCommand) addCommand("QuitGame", quitGameCommand) + addCommand("ResignGame", resignGameCommand) import std/tables import ../config diff --git a/src/ui/maps-ui-commands.adb b/src/ui/maps-ui-commands.adb index 2094af386..8642b0ee7 100644 --- a/src/ui/maps-ui-commands.adb +++ b/src/ui/maps-ui-commands.adb @@ -54,22 +54,22 @@ package body Maps.UI.Commands is -- COMMANDS -- ResignGame -- SOURCE - function Resign_Game_Command - (Client_Data: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; - Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with - Convention => C; - -- **** - - function Resign_Game_Command - (Client_Data: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; - Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is - pragma Unreferenced(Client_Data, Interp, Argc, Argv); - begin - Show_Question - (Question => "Are you sure want to resign from game?", - Result => "resign"); - return TCL_OK; - end Resign_Game_Command; +-- function Resign_Game_Command +-- (Client_Data: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; +-- Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with +-- Convention => C; +-- -- **** +-- +-- function Resign_Game_Command +-- (Client_Data: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; +-- Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is +-- pragma Unreferenced(Client_Data, Interp, Argc, Argv); +-- begin +-- Show_Question +-- (Question => "Are you sure want to resign from game?", +-- Result => "resign"); +-- return TCL_OK; +-- end Resign_Game_Command; -- ****o* MapCommands/MapCommands.Show_Stats_Command -- FUNCTION @@ -613,8 +613,8 @@ package body Maps.UI.Commands is External_Name => "addAdaMapsCommands"; begin Add_Ada_Commands; - Add_Command - (Name => "ResignGame", Ada_Command => Resign_Game_Command'Access); +-- Add_Command +-- (Name => "ResignGame", Ada_Command => Resign_Game_Command'Access); Add_Command (Name => "ShowStats", Ada_Command => Show_Stats_Command'Access); Add_Command