diff options
Diffstat (limited to 'level.cpp')
-rw-r--r-- | level.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -15,7 +15,10 @@ void setLevel(LEVEL *l) { void addRoom(LEVEL *lvl, const ROOM *room) { lvl->nRooms++; - lvl->rooms = (ROOM*)realloc(lvl->rooms, lvl->nRooms*sizeof(ROOM)); + if(lvl->nRooms > 1) + lvl->rooms = (ROOM*)realloc(lvl->rooms, lvl->nRooms*sizeof(ROOM)); + else + lvl->rooms = (ROOM*)calloc(1, sizeof(ROOM)); lvl->rooms[lvl->nRooms-1] = *room; } @@ -36,9 +39,6 @@ void freeLevel(LEVEL *lvl) { if(lvl) { if(lvl->rooms) { for(i = 0; i < lvl->nRooms; i++) { - if(lvl->rooms[i].polygon.vertices) - free(lvl->rooms[i].polygon.vertices); - if(lvl->rooms[i].name) free(lvl->rooms[i].name); } |