Skip to content

Commit

Permalink
refactor: moved resignGameCommand to Nim
Browse files Browse the repository at this point in the history
FossilOrigin-Name: b3bd4ca5b2a3501c91b234a2256fa8bc21d36fa2e7bbc2adcfa60d63b56accdc
  • Loading branch information
thindil committed Jan 30, 2024
1 parent c41f2b5 commit 88ce83a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
6 changes: 6 additions & 0 deletions nim/src/ui/mapsuicommands.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -244,6 +249,7 @@ proc addCommands*() =
addCommand("MoveMap", moveMapCommand)
addCommand("MoveShip", moveShipCommand)
addCommand("QuitGame", quitGameCommand)
addCommand("ResignGame", resignGameCommand)

import std/tables
import ../config
Expand Down
36 changes: 18 additions & 18 deletions src/ui/maps-ui-commands.adb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 88ce83a

Please sign in to comment.