diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2015-09-16 11:33:02 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2015-09-16 11:33:02 -0400 |
commit | d7efa99f03f9d0eb5d84ed42249f227f13471079 (patch) | |
tree | 1385c96106d7fbb64a6081529255bcc1d2d48664 /src/World.cpp | |
parent | ba4b5bd76ae9b1fa3e3c862d8672e35b02e1664c (diff) |
shitty bug fixes
Diffstat (limited to 'src/World.cpp')
-rw-r--r-- | src/World.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/World.cpp b/src/World.cpp index bde35de..49bdf0d 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -24,6 +24,7 @@ World::World(const float width,World *l,World *r){ toRight=r;
behind=infront=NULL;
entCount=0;
+ entity=(void **)calloc(MAX_ENTITIES,sizeof(void *));
if(toLeft){ // Make sure linked worlds link back
if(toLeft->toRight){
std::cout<<"There's already a world to the left!"<<std::endl;
@@ -100,7 +101,8 @@ LOOP2: // Should be in furthest back layer once this is first rea }else{
drawOffsetX=drawOffsetY=0; // Reset for next draw() call
for(i=0;i<entCount;i++){ // Draw any bound entities
- ((Entity **)entity)[i]->draw();
+ if(entity[i])
+ ((Entity **)entity)[i]->draw();
}
}
}
@@ -134,6 +136,6 @@ void World::addLayer(const float width){ behind->infront=this;
}
}
-void World::addEntity(void *e){
- entity[entCount++]=e; // duh
+void World::addEntity(void *addr){
+ entity[entCount++]=addr;
}
|