From fe2c322f5be39c5a5b01f46481ff2921ca3e0f97 Mon Sep 17 00:00:00 2001 From: Baptiste Pouget Date: Mon, 2 Jan 2017 16:53:26 +0100 Subject: [PATCH] Fixed bug related to types, added a map --- maps/{ => blocksmeet}/blockemeet.txt | 0 maps/{ => blocksmeet}/tresdur.txt | 0 maps/clear/tstclr.txt | 9 +++++++++ maps/{ => playersmeet}/chelou.txt | 0 maps/{ => playersmeet}/foomap.txt | 0 maps/{ => playersmeet}/jeej.txt | 0 maps/{ => playersmeet}/lol.txt | 0 maps/{ => playersmeet}/map.txt | 0 src/.qmake.stash | 13 +++++++++++++ src/gameplay.cpp | 16 ++++++++-------- 10 files changed, 30 insertions(+), 8 deletions(-) rename maps/{ => blocksmeet}/blockemeet.txt (100%) rename maps/{ => blocksmeet}/tresdur.txt (100%) create mode 100644 maps/clear/tstclr.txt rename maps/{ => playersmeet}/chelou.txt (100%) rename maps/{ => playersmeet}/foomap.txt (100%) rename maps/{ => playersmeet}/jeej.txt (100%) rename maps/{ => playersmeet}/lol.txt (100%) rename maps/{ => playersmeet}/map.txt (100%) create mode 100644 src/.qmake.stash diff --git a/maps/blockemeet.txt b/maps/blocksmeet/blockemeet.txt similarity index 100% rename from maps/blockemeet.txt rename to maps/blocksmeet/blockemeet.txt diff --git a/maps/tresdur.txt b/maps/blocksmeet/tresdur.txt similarity index 100% rename from maps/tresdur.txt rename to maps/blocksmeet/tresdur.txt diff --git a/maps/clear/tstclr.txt b/maps/clear/tstclr.txt new file mode 100644 index 0000000..feca867 --- /dev/null +++ b/maps/clear/tstclr.txt @@ -0,0 +1,9 @@ +####### +## # +#1 Cb +##BA # +# ## # +# a# ## +# ## # +c 2# +######## diff --git a/maps/chelou.txt b/maps/playersmeet/chelou.txt similarity index 100% rename from maps/chelou.txt rename to maps/playersmeet/chelou.txt diff --git a/maps/foomap.txt b/maps/playersmeet/foomap.txt similarity index 100% rename from maps/foomap.txt rename to maps/playersmeet/foomap.txt diff --git a/maps/jeej.txt b/maps/playersmeet/jeej.txt similarity index 100% rename from maps/jeej.txt rename to maps/playersmeet/jeej.txt diff --git a/maps/lol.txt b/maps/playersmeet/lol.txt similarity index 100% rename from maps/lol.txt rename to maps/playersmeet/lol.txt diff --git a/maps/map.txt b/maps/playersmeet/map.txt similarity index 100% rename from maps/map.txt rename to maps/playersmeet/map.txt diff --git a/src/.qmake.stash b/src/.qmake.stash new file mode 100644 index 0000000..bcf17c4 --- /dev/null +++ b/src/.qmake.stash @@ -0,0 +1,13 @@ +QMAKE_DEFAULT_INCDIRS = \ + /usr/include/c++/6.2.1 \ + /usr/include/c++/6.2.1/x86_64-redhat-linux \ + /usr/include/c++/6.2.1/backward \ + /usr/lib/gcc/x86_64-redhat-linux/6.2.1/include \ + /usr/local/include \ + /usr/include +QMAKE_DEFAULT_LIBDIRS = \ + /usr/lib/gcc/x86_64-redhat-linux/6.2.1 \ + /usr/lib64 \ + /lib64 \ + /usr/lib \ + /lib diff --git a/src/gameplay.cpp b/src/gameplay.cpp index 97f807f..031c3e4 100644 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@ -5,8 +5,8 @@ using namespace std; bool Move (CMatrix & Mat, GameObjects & Objects, CPosition & Pos, const int & DistX, const int & DistY) { - if ( (-DistY > int (Pos.second)) - ||(-DistX > int (Pos.first)) + if ( (-DistY > (int) Pos.second) + ||(-DistX > (int) Pos.first) ||(DistY + Pos.second >= Mat.size()) ||(DistX + Pos.first >= Mat[Pos.second].size()) ||(Mat[Pos.second + DistY][Pos.first + DistX] == KTokenWall)) @@ -153,11 +153,11 @@ void WriteRules (const char & GameMode) bool AreInContact (const CPosition & Pos1, const CPosition & Pos2) { - return ((Pos1.second == Pos2.second) - && (Pos1.first >= Pos2.first - 1) - && (Pos1.first <= Pos2.first + 1)) - ||((Pos1.first == Pos2.first) - && (Pos1.second >= Pos2.second - 1) - && (Pos1.second <= Pos2.second + 1)); + return ((( (int) Pos1.second == (int) Pos2.second) + && ((int) Pos1.first >= (int) Pos2.first - 1) + && ((int) Pos1.first <= (int) Pos2.first + 1)) + ||(((int) Pos1.first == (int) Pos2.first) + && ((int) Pos1.second >= (int) Pos2.second - 1) + && ((int) Pos1.second <= (int) Pos2.second + 1))); } // AreInContact