void Client::CleanUp() { delete pScene; pScene = NULL; #ifdef _WIN32 DestroyIcon (icon); icon = NULL; #endif SDL_GL_DeleteContext (mainGLContext); SDL_DestroyWindow (mainWindow); SDL_Quit (); mainGLContext = NULL; mainWindow = NULL; if (udpPackets) { SDLNet_FreePacketV(udpPackets); udpPackets = NULL; fromServer = toServer = NULL; } if (udp_socket) { SDLNet_UDP_Close(udp_socket); udp_socket = NULL; } SDLNet_Quit(); Mix_CloseAudio(); }
int network_packet_freev(UDPpacket** packets) { SDLNet_FreePacketV(packets); packets = NULL; return 0; }
/* * network_packet_free_vector() - Free the packet array data * @packets: the packet array to free */ int network_packet_free_vector(UDPpacket** packets) { SDLNet_FreePacketV(packets); // Free the packets packets = nullptr; // Clear the pointer return 0; // Return 0 on success }