diff options
-rwxr-xr-x | exec | bin | 307904 -> 0 bytes | |||
-rw-r--r-- | inc/constants.hpp | 1 | ||||
-rw-r--r-- | src/list.cpp | 16 |
3 files changed, 11 insertions, 6 deletions
Binary files differ diff --git a/inc/constants.hpp b/inc/constants.hpp index 2a5b8fb..08f548e 100644 --- a/inc/constants.hpp +++ b/inc/constants.hpp @@ -3,6 +3,7 @@ const int CREATURES = 10; const int RESOURCES = 100; +const int MINIMUM_RESOURCES = 90; const int WINDOW_X = 1080; const int WINDOW_Y = 640; 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) |