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

Function PltDelete

Descent3/pilot.cpp:1719–1746  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////// Pilot file functions /////////////////////////////////////////////////////////////////// //////////////////////////////////////// deletes a pilot

Source from the content-addressed store, hash-verified

1717/////////////////////////////////////////////
1718// deletes a pilot
1719bool PltDelete(pilot *Pilot) {
1720 char filename[_MAX_PATH];
1721 char pfilename[_MAX_FNAME];
1722 char pname[PILOT_STRING_SIZE];
1723
1724 Pilot->get_filename(pfilename);
1725
1726 if (pfilename[0] != 0) {
1727 ddio_MakePath(filename, Base_directory, pfilename, NULL);
1728 return (ddio_DeleteFile(pfilename) == 1);
1729 } else {
1730 Int3(); // this is odd
1731
1732 // it shouldn't get to here, but if for some reason filename didn't exist
1733 // then create the filename from the player name and delete the file
1734 Pilot->get_name(pname);
1735
1736 if (pname[0] == 0)
1737 return false;
1738
1739 PltMakeFNValid(pname);
1740
1741 strcpy(pfilename, pname);
1742 strcat(pfilename, PLTEXTENSION);
1743 ddio_MakePath(filename, Base_directory, pfilename, NULL);
1744 return (ddio_DeleteFile(filename) == 1);
1745 }
1746}
1747
1748void PltCreateDedicatedServerPilot(pilot *Pilot) {
1749 Pilot->clean(true);

Callers 1

PilotSelectFunction · 0.85

Calls 5

PltMakeFNValidFunction · 0.85
get_filenameMethod · 0.80
ddio_MakePathFunction · 0.50
ddio_DeleteFileFunction · 0.50
get_nameMethod · 0.45

Tested by

no test coverage detected