summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortom <tom@ground-control>2015-11-22 15:21:30 -0600
committertom <tom@ground-control>2015-11-22 15:21:30 -0600
commit9f0de11816fdbd0981aeaa3a840e3942fd249eb4 (patch)
tree2a0a8f5ac36b249e09f13848b33ab40d4c42b943 /src
parent86bf68cc1f2cc81589acc2c35c4875a1230b0267 (diff)
cleaned up a little and added pausing, the location vector in list.*pp is overkill, should probably just be using the men vector for everything
Diffstat (limited to 'src')
-rw-r--r--src/Character.cpp9
-rw-r--r--src/Frame.cpp59
-rw-r--r--src/Screen.cpp10
-rw-r--r--src/main.cpp21
4 files changed, 20 insertions, 79 deletions
diff --git a/src/Character.cpp b/src/Character.cpp
index 423a342..8b4a4b5 100644
--- a/src/Character.cpp
+++ b/src/Character.cpp
@@ -64,8 +64,6 @@ Location Character::action(vector <Location> occupied)
Lo = l;
}
- //move(Lo);
-
if(check(Lo,occupied))
{
move(Lo);
@@ -78,12 +76,9 @@ Location Character::action(vector <Location> occupied)
bool Character::check(Location L, vector <Location> occupied)
{
- for(int i = 0; i < 10; i++)
- {
+ for(int i = 0; i < 10; i++)
if(L.x == occupied[i].x && L.y == occupied[i].y)
- {
return false;
- }
- }
+
return true;
}
diff --git a/src/Frame.cpp b/src/Frame.cpp
index a8403b7..c63aeb4 100644
--- a/src/Frame.cpp
+++ b/src/Frame.cpp
@@ -44,27 +44,7 @@ Frame::~Frame()
{
delwin(w);
}
-/*
-void Frame::add(Character &c)
-{
- mvwaddch(w,c.getRow(),c.getCol(),c.getSymbol());
-}
-
-void Frame::erase(Character &c)
-{
- mvwaddch(w,c.getRow(),c.getCol(),' ');
-}
-void Frame::add(Character &c, int nRow, int nCol)
-{
- if((nRow >= 0 && nRow < height) && (nCol >= 0 && nCol < width))
- {
- erase(c);
- mvwaddch(w,nRow,nCol,c.getSymbol());
- c.move(nRow,nCol);
- }
-}
-*/
void Frame::center(Character &ch)
{
if(hasSuper)
@@ -148,42 +128,3 @@ void Frame::fillWindow()
}
wattroff(w,COLOR_PAIR(3));
}
-
-WINDOW * Frame::getWin()
-{
- return w;
-}
-
-WINDOW * Frame::getSuper()
-{
- return super;
-}
-
-bool Frame::getHasSuper()
-{
- return hasSuper;
-}
-
-int Frame::getHeight()
-{
- return height;
-}
-
-int Frame::getWidth()
-{
- return width;
-}
-
-int Frame::getRow()
-{
- return row;
-}
-
-int Frame::getCol()
-{
- return col;
-}
-
-
-
-
diff --git a/src/Screen.cpp b/src/Screen.cpp
index 9d0a72c..2cc5079 100644
--- a/src/Screen.cpp
+++ b/src/Screen.cpp
@@ -28,13 +28,3 @@ void Screen::ping(string msg)
const char * cmsg = msg.c_str();
printw(cmsg);
}
-
-int Screen::getHeight()
-{
- return height;
-}
-
-int Screen::getWidth()
-{
- return width;
-}
diff --git a/src/main.cpp b/src/main.cpp
index df5a563..022a2aa 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -16,7 +16,8 @@ int main()
map.fillWindow();
L.draw(map.getWin());
cursor.draw(map.getWin());
-
+
+ bool paused = false;
while(true)
{
char c = getch();
@@ -31,9 +32,23 @@ int main()
l.x = l.x-1;
else if (c == 'q')
break;
-
+ else if (c == 'p')
+ {
+ if (paused)
+ {
+ timeout(100);
+ paused = false;
+ }
+ else
+ {
+ timeout(-1);
+ paused = true;
+ }
+ }
+
cursor.move(l);
- L.action();
+ if (!paused)
+ L.action();
map.fillWindow();
L.draw(map.getWin());
cursor.draw(map.getWin());