Пример #1
0
void StaticTrace_destroy(StaticTrace* self, bool deleteTiles)
{
	uint32_t i, j;
	for(i=0; i < self->nbCasesX; i++)
	{
		if(deleteTiles)
		{
			for(j=0; j < self->nbCasesY; j++)
			{
				Drawable* tile = (Drawable*)(self->tiles[i][j]);
				Drawable* object = (Drawable*)(self->objects[i][j]);
				if(tile != NULL)
					tile->destroy(tile);
				if(object != NULL)
					object->destroy(object);
			}
		}
		free(self->tiles[i]);
		free(self->objects[i]);
	}
	free(self->tiles);
	free(self->objects);
	free(self);
}
Пример #2
0
void Object_destroy(Drawable* drawable)
{
	Object* self = (Object*)drawable;
	uint32_t i, j;
	for(i=0; i < self->nbCasesX; i++)
	{
		for(j=0; j < self->nbCasesY; j++)
		{
			Drawable* tile = (Drawable*)(self->tiles[i][j]);
			if(tile != NULL)
				tile->destroy(tile);
		}
		free(self->tiles[i]);
	}
	free(self->tiles);
	free(self);
}
Пример #3
0
void DynamicTrace_destroy(DynamicTrace* self)
{
	uint32_t i, j, k;
	for(i=0; i < self->nbCasesX; i++)
	{
		for(j=0; j < self->nbCasesY; j++)
		{
			for(k=0; k < List_getLen(self->tiles[i][j]); k++)
			{
				Drawable* tile = List_getData(self->tiles[i][j], k);
				if(tile)
					tile->destroy(tile);
			}
			List_destroy(self->tiles[i][j]);
		}
		free(self->tiles[i]);
	}
	free(self->tiles);
	free(self);
}