From 7f79b2e216617ff74ebd41ac02663b20ef3d0904 Mon Sep 17 00:00:00 2001 From: tom Date: Sat, 21 Nov 2015 12:30:13 -0600 Subject: began adding collision *added a location class for ease *much refractoring needed to fully implement it* --- inc/Character.hpp | 12 +++++++++++- inc/Frame.hpp | 4 ++-- inc/List.hpp | 7 ++++--- inc/Location.hpp | 11 +++++++++++ inc/main.hpp | 1 + 5 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 inc/Location.hpp (limited to 'inc') diff --git a/inc/Character.hpp b/inc/Character.hpp index f2753a9..1f948f2 100644 --- a/inc/Character.hpp +++ b/inc/Character.hpp @@ -2,18 +2,28 @@ #define character_h #include +#include +#include +#include +#include "Location.hpp" +using namespace std; class Character { public: Character(char nSymbol, int nColor,int nRow, int nCol); - void move(int nRow, int nCol); + void move(Location L); void draw(WINDOW * w); + bool action(vector occupied); + bool check(Location L, vector occupied); int getRow(); int getCol(); + Location getLocation(){return l;} char getSymbol(); private: + string order = "wander"; + Location l; char symbol; int row; int col; diff --git a/inc/Frame.hpp b/inc/Frame.hpp index 1cdf063..89242ff 100644 --- a/inc/Frame.hpp +++ b/inc/Frame.hpp @@ -26,8 +26,8 @@ class Frame void fillWindow(); void refresh(); void move(int nRow, int nCol); - void add(Character &c); - void add(Character &c, int nRow, int nCol); + //void add(Character &c); + //void add(Character &c, int nRow, int nCol); void erase(Character &c); void center(Character &ch); diff --git a/inc/List.hpp b/inc/List.hpp index e997391..931ff8a 100644 --- a/inc/List.hpp +++ b/inc/List.hpp @@ -6,7 +6,7 @@ #include #include #include - +#include "Location.hpp" using namespace std; class List @@ -14,9 +14,10 @@ class List public: List(); void draw(WINDOW * w); - void actions(); + void action(); private: - vector men; + vector men; + vector occupied; }; #endif diff --git a/inc/Location.hpp b/inc/Location.hpp new file mode 100644 index 0000000..458e77e --- /dev/null +++ b/inc/Location.hpp @@ -0,0 +1,11 @@ +#ifndef location_h +#define location_h + +class Location +{ + public: + int x; + int y; +}; + +#endif diff --git a/inc/main.hpp b/inc/main.hpp index 441e0d2..86d786d 100644 --- a/inc/main.hpp +++ b/inc/main.hpp @@ -5,5 +5,6 @@ #include "Character.hpp" #include "Frame.hpp" #include "List.hpp" +#include "Location.hpp" #endif -- cgit v1.2.3