diff options
author | tom <tombarrett@siu.edu> | 2017-01-14 12:10:28 -0600 |
---|---|---|
committer | tom <tombarrett@siu.edu> | 2017-01-14 12:10:28 -0600 |
commit | 92977a889bb045827ae51dc088fa3da501bd29e3 (patch) | |
tree | 84c7981a5169db4758c1caad9f6d449f8da77464 /src | |
parent | f2f0867edd0d9624a77e4e5db39825b8ea1a55d0 (diff) |
made it so resources spawn during simulation
Diffstat (limited to 'src')
-rw-r--r-- | src/list.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/list.cpp b/src/list.cpp index b8d2888..3127d76 100644 --- a/src/list.cpp +++ b/src/list.cpp @@ -2,23 +2,21 @@ List::List(Window m) { - int i; + main = m; + int i; SDL_Rect Rect = {0,0,CREATURE_SIZE,CREATURE_SIZE}; - for(i=0;i<CREATURES;i++){ - Creature X(m,Rect); + Creature X(main,Rect); C.push_back(X); } Rect = {0,0,RESOURCE_SIZE,RESOURCE_SIZE}; - for(i=0;i<RESOURCES;i++){ - Resource Y(m,Rect); + Resource Y(main,Rect); R.push_back(Y); } - main = m; } void List::Place() @@ -50,6 +48,12 @@ void List::Behavior() C.erase(it--); } } + + SDL_Rect Rect = {0,0,RESOURCE_SIZE,RESOURCE_SIZE}; + while(R.size() < MINIMUM_RESOURCES){ + Resource Y(main,Rect); + R.push_back(Y); + } } list<Entity*> List::getNear(Creature nC) |