aboutsummaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2015-09-16 11:33:02 -0400
committerClyne Sullivan <tullivan99@gmail.com>2015-09-16 11:33:02 -0400
commitd7efa99f03f9d0eb5d84ed42249f227f13471079 (patch)
tree1385c96106d7fbb64a6081529255bcc1d2d48664 /src/World.cpp
parentba4b5bd76ae9b1fa3e3c862d8672e35b02e1664c (diff)
shitty bug fixes
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp8
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;
}