From 8228cd7ef6156d87ccf33335466c86fa30dadd8b Mon Sep 17 00:00:00 2001 From: tom Date: Mon, 23 Nov 2015 14:09:41 -0600 Subject: removed unessasary pause code and improved list iteration --- src/Character.cpp | 2 +- src/List.cpp | 6 +++--- src/main.cpp | 15 ++------------- 3 files changed, 6 insertions(+), 17 deletions(-) (limited to 'src') 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 men) bool Character::check(Location L, vector 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) -- cgit v1.2.3