diff options
author | tom <tom@ground-control> | 2015-11-21 12:30:13 -0600 |
---|---|---|
committer | tom <tom@ground-control> | 2015-11-21 12:30:13 -0600 |
commit | 7f79b2e216617ff74ebd41ac02663b20ef3d0904 (patch) | |
tree | e0eb8f820c61c45afcb1506f5b025eeb7e534691 /inc | |
parent | 032d4f98c809bde6231ff78ba50e8c244334739f (diff) |
began adding collision *added a location class for ease *much refractoring needed to fully implement it*
Diffstat (limited to 'inc')
-rw-r--r-- | inc/Character.hpp | 12 | ||||
-rw-r--r-- | inc/Frame.hpp | 4 | ||||
-rw-r--r-- | inc/List.hpp | 7 | ||||
-rw-r--r-- | inc/Location.hpp | 11 | ||||
-rw-r--r-- | inc/main.hpp | 1 |
5 files changed, 29 insertions, 6 deletions
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 <ncurses.h> +#include <cstdlib> +#include <vector> +#include <string> +#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 <Location> occupied); + bool check(Location L, vector <Location> 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 <ncurses.h> #include <ctime> #include <cstdlib> - +#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 <Character> men; + vector <Character> men; + vector <Location> 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 |