Chessbot: Print out more errors in bad state

This commit is contained in:
Wuzzy 2024-09-19 14:17:26 +02:00
parent 2d5e149ba9
commit 06e42034f3

View File

@ -80,7 +80,9 @@ function chessbot.choose_move(board_t, meta_t)
end end
return choice_from, choice_to return choice_from, choice_to
else
minetest.log("error", "[xdecor] Chess: chessbot.choose_move was apparently called in an invalid game state!")
return
end end
end end
@ -122,6 +124,7 @@ chessbot.perform_move = function(choice_from, choice_to, meta)
end end
local botColor = meta:get_string("botColor") local botColor = meta:get_string("botColor")
if botColor == "" then if botColor == "" then
minetest.log("error", "[xdecor] Chess: chessbot.perform_move: botColor in meta string was empty!")
return return
end end
local lastMove = meta:get_string("lastMove") local lastMove = meta:get_string("lastMove")
@ -144,6 +147,8 @@ chessbot.perform_move = function(choice_from, choice_to, meta)
if not moveOK then if not moveOK then
realchess.resign(meta, currentBotColor) realchess.resign(meta, currentBotColor)
end end
else
minetest.log("error", "[xdecor] Chess: chessbot.perform_move: No last move!")
end end
end end