aboutsummaryrefslogtreecommitdiff
path: root/src/fen.cpp
diff options
context:
space:
mode:
authorAdam <adammegarules1@gmail.com>2026-07-27 09:45:58 +0200
committerAdam <adammegarules1@gmail.com>2026-07-27 09:45:58 +0200
commit9b1665430fd0379db92000740c7a70045baa1746 (patch)
tree728993a22f9610a1299c0ef1dd27a63a292b3fc3 /src/fen.cpp
parent94cc9240eabf78cbbc9006cb70ca74b6bc3f54e6 (diff)
lot of changes
Diffstat (limited to 'src/fen.cpp')
-rw-r--r--src/fen.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/fen.cpp b/src/fen.cpp
index 9ddc795..2808a4c 100644
--- a/src/fen.cpp
+++ b/src/fen.cpp
@@ -2,6 +2,7 @@
#include "board.hpp"
#include <cctype>
#include <cstdio>
+#include <cstdlib>
#include <print>
#include <string>
@@ -81,8 +82,9 @@ void setBoardFen(std::string fen, Board *b) {
if (isdigit(fen[i])) {
int move = fen[i] - '0';
file += move;
- if (file > 8) {
+ if (file >= 8) {
std::println("Fatal: file was to big");
+ exit(1);
return; // malformed rank
}
continue;
@@ -90,8 +92,9 @@ void setBoardFen(std::string fen, Board *b) {
if (fen[i] == '/') {
file = 0;
rank++;
- if (rank > 8) {
+ if (rank >= 8) {
std::println("Fatal: rank was to big");
+ exit(1);
return; // malformed rank
}
continue;