Merge remote-tracking branch 'origin/develop' into trophies
This commit is contained in:
commit
0671000366
|
@ -60,8 +60,6 @@ void initBattle(void)
|
|||
|
||||
initStars();
|
||||
|
||||
initBullets();
|
||||
|
||||
initBackground();
|
||||
|
||||
initEffects();
|
||||
|
|
|
@ -54,6 +54,7 @@ void loadItemDefs(void)
|
|||
SDL_QueryTexture(e->texture, NULL, NULL, &e->w, &e->h);
|
||||
|
||||
defTail->next = e;
|
||||
defTail = e;
|
||||
}
|
||||
|
||||
cJSON_Delete(root);
|
||||
|
|
|
@ -24,8 +24,6 @@ static Entity **candidates;
|
|||
static int cIndex;
|
||||
static int cCapacity;
|
||||
|
||||
static int memory;
|
||||
|
||||
static int getIndex(Quadtree *root, int x, int y, int w, int h);
|
||||
static void removeEntity(Entity *e, Quadtree *root);
|
||||
static int candidatesComparator(const void *a, const void *b);
|
||||
|
@ -48,11 +46,12 @@ void initQuadtree(Quadtree *root)
|
|||
root->ents = malloc(sizeof(Entity*) * root->capacity);
|
||||
memset(root->ents, 0, sizeof(Entity*) * root->capacity);
|
||||
|
||||
memory = 0;
|
||||
cIndex = 0;
|
||||
cCapacity = QT_INITIAL_CAPACITY;
|
||||
candidates = malloc(sizeof(Entity*) * cCapacity);
|
||||
memset(candidates, 0, sizeof(Entity*) * cCapacity);
|
||||
}
|
||||
|
||||
memory += sizeof(Quadtree);
|
||||
|
||||
w = root->w / 2;
|
||||
h = root->h / 2;
|
||||
|
||||
|
@ -101,11 +100,6 @@ void initQuadtree(Quadtree *root)
|
|||
initQuadtree(node);
|
||||
}
|
||||
}
|
||||
|
||||
cIndex = 0;
|
||||
cCapacity = QT_INITIAL_CAPACITY;
|
||||
candidates = malloc(sizeof(Entity*) * cCapacity);
|
||||
memset(candidates, 0, sizeof(Entity*) * cCapacity);
|
||||
}
|
||||
|
||||
void addToQuadtree(Entity *e, Quadtree *root)
|
||||
|
@ -277,23 +271,28 @@ void destroyQuadtree(void)
|
|||
{
|
||||
destroyQuadtreeNode(&battle.quadtree);
|
||||
|
||||
free(candidates);
|
||||
|
||||
candidates = NULL;
|
||||
if (candidates)
|
||||
{
|
||||
free(candidates);
|
||||
|
||||
candidates = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void destroyQuadtreeNode(Quadtree *root)
|
||||
{
|
||||
int i;
|
||||
|
||||
free(root->ents);
|
||||
|
||||
root->ents = NULL;
|
||||
|
||||
if (root->node[0])
|
||||
{
|
||||
for (i = 0 ; i < 4 ; i++)
|
||||
{
|
||||
destroyQuadtreeNode(root->node[i]);
|
||||
|
||||
free(root->node[i]->ents);
|
||||
|
||||
free(root->node[i]);
|
||||
|
||||
root->node[i] = NULL;
|
||||
|
|
|
@ -197,6 +197,8 @@ void loadMission(char *filename)
|
|||
battle.planetHeight *= planetScale;
|
||||
|
||||
srand(time(NULL));
|
||||
|
||||
cJSON_Delete(root);
|
||||
|
||||
free(text);
|
||||
|
||||
|
|
|
@ -131,9 +131,9 @@ void initGameSystem(void)
|
|||
initStarSystems,
|
||||
initChallenges,
|
||||
initStats,
|
||||
initBattle,
|
||||
initModalDialog,
|
||||
initBackground,
|
||||
initStars,
|
||||
initControls
|
||||
};
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ extern void createSaveFolder(void);
|
|||
extern void setLanguage(char *applicationName, char *languageCode);
|
||||
extern char *getLookupName(char *prefix, long num);
|
||||
extern long lookup(char *name);
|
||||
extern void initStars(void);
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
|
|
|
@ -98,7 +98,20 @@ char *getMusicFilename(int i)
|
|||
|
||||
void destroyResources(void)
|
||||
{
|
||||
free(backgrounds);
|
||||
free(planets);
|
||||
free(musicFiles);
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < numBackgrounds ; i++)
|
||||
{
|
||||
free(backgrounds[i]);
|
||||
}
|
||||
|
||||
for (i = 0 ; i < numPlanets ; i++)
|
||||
{
|
||||
free(planets[i]);
|
||||
}
|
||||
|
||||
for (i = 0 ; i < numMusicFiles ; i++)
|
||||
{
|
||||
free(musicFiles[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -507,6 +507,8 @@ void destroyWidgets(void)
|
|||
{
|
||||
free(w->options[i]);
|
||||
}
|
||||
|
||||
free(w->options);
|
||||
|
||||
next = w->next;
|
||||
free(w);
|
||||
|
|
Loading…
Reference in New Issue