//Destroy all of the world's components and then the world itself void World_Destroy(World *w) { for (int i = 0; i < 3; i++) { debug_msg("Destroying enemy type %d\n", i); Destroy_CharacterType(w->EnemyTypes[i]); } for (int i = 0; i < w->ObjectTypeCount; i++) { Destroy_ObjectType(w->ObjectTypes[i]); } Destroy_ObjectType(w->goalpost); Destroy_Player(w->player); Destroy_Texture(w->background.still); free(w); }
void Destroy_Player(Player *p) { /* Destroy everything below player */ Destroy_CharacterType(p->ctype); free(p); p = NULL; }