diff options
author | tom <tom@ground-control> | 2015-11-23 14:09:41 -0600 |
---|---|---|
committer | tom <tom@ground-control> | 2015-11-23 14:09:41 -0600 |
commit | 8228cd7ef6156d87ccf33335466c86fa30dadd8b (patch) | |
tree | d3f4beb89343bae9fc9cdf5504c77c6d5acadaad | |
parent | 4c50cb6b322368a89feef13efa091c765c966e5b (diff) |
removed unessasary pause code and improved list iteration
-rw-r--r-- | src/Character.cpp | 2 | ||||
-rw-r--r-- | src/List.cpp | 6 | ||||
-rw-r--r-- | src/main.cpp | 15 |
3 files changed, 6 insertions, 17 deletions
diff --git a/src/Character.cpp b/src/Character.cpp index 5ebc39e..d5f8bc0 100644 --- a/src/Character.cpp +++ b/src/Character.cpp @@ -69,7 +69,7 @@ void Character::action(vector <Character> men) bool Character::check(Location L, vector <Character> men) { - for(int i = 0; i < 10; i++) + for(int i = 0; i < men.size(); i++) if(L.x == men[i].getLocation().x && L.y == men[i].getLocation().y) return false; diff --git a/src/List.cpp b/src/List.cpp index 05a6f66..d4bc796 100644 --- a/src/List.cpp +++ b/src/List.cpp @@ -2,7 +2,7 @@ List::List() { - for(int i = 0; i < 10; i++) + for(int i = 0; i < 50; i++) { Location L; L.x = 150; @@ -14,12 +14,12 @@ List::List() void List::draw(WINDOW * w) { - for(int i = 0; i < 10; i++) + for(int i = 0; i < men.size(); i++) men[i].draw(w); } void List::action() { - for(int i = 0; i < 10; i++) + for(int i = 0; i < men.size(); i++) men[i].action(men); } diff --git a/src/main.cpp b/src/main.cpp index 022a2aa..c0d59af 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,20 +31,9 @@ int main() else if (c == 'j') l.x = l.x-1; else if (c == 'q') - break; + break; else if (c == 'p') - { - if (paused) - { - timeout(100); - paused = false; - } - else - { - timeout(-1); - paused = true; - } - } + paused = !paused; cursor.move(l); if (!paused) |