MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / clean

Method clean

Descent3/pilot_class.cpp:272–325  ·  view source on GitHub ↗

This function guts the data so it's virgin (fresh for reading) frees any memory that needs to be freed, etc.

Source from the content-addressed store, hash-verified

270// This function guts the data so it's virgin (fresh for reading)
271// frees any memory that needs to be freed, etc.
272void pilot::clean(bool reset) {
273 if (filename) {
274 mem_free(filename);
275 filename = NULL;
276 }
277
278 if (name) {
279 mem_free(name);
280 name = NULL;
281 }
282
283 if (ship_model) {
284 mem_free(ship_model);
285 ship_model = NULL;
286 }
287
288 if (ship_logo) {
289 mem_free(ship_logo);
290 ship_logo = NULL;
291 }
292
293 if (audio1_file) {
294 mem_free(audio1_file);
295 audio1_file = NULL;
296 }
297
298 if (audio2_file) {
299 mem_free(audio2_file);
300 audio2_file = NULL;
301 }
302
303 if (audio3_file) {
304 mem_free(audio3_file);
305 audio3_file = NULL;
306 }
307
308 if (audio4_file) {
309 mem_free(audio4_file);
310 audio4_file = NULL;
311 }
312
313 if (mission_data) {
314 mem_free(mission_data);
315 mission_data = NULL;
316 }
317
318 if (guidebot_name) {
319 mem_free(guidebot_name);
320 guidebot_name = NULL;
321 }
322
323 if (reset)
324 initialize();
325}
326
327// This function verifies all the pilot data, making sure nothing is out of whack
328// It will correct any messed data.

Callers 5

PilotShutdownFunction · 0.80
PilotInitDataFunction · 0.80
_ReadOldPilotFileFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected