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

Function AddNewGameFile

editor/ScriptLevelInterface.cpp:1064–1097  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1062}
1063
1064bool AddNewGameFile(char *fullpath, char *directory) {
1065 char cur_name[100];
1066 char pathname[100], name[100], extension[100];
1067 int gamefile_handle;
1068
1069 if (!Network_up) {
1070 return false;
1071 }
1072
1073 // Okay, we selected a file. Lets do what needs to be done here.
1074 ddio_SplitPath(fullpath, pathname, name, extension);
1075 sprintf(cur_name, "%s%s", name, extension);
1076
1077 if ((FindGamefileName(cur_name)) != -1) {
1078 OutrageMessageBox("There is already a file with that name. Rename the file and then try to add it.");
1079 return false;
1080 }
1081
1082 gamefile_handle = AllocGamefile();
1083
1084 strcpy(Gamefiles[gamefile_handle].name, cur_name);
1085 strcpy(Gamefiles[gamefile_handle].dir_name, directory);
1086
1087 // Finally, save a local copy of the model/anim and alloc a tracklock
1088 mprintf(0, "Making a copy of this file locally...\n");
1089
1090 char destname[100];
1091 ddio_MakePath(destname, LocalD3Dir, "data", directory, Gamefiles[gamefile_handle].name, NULL);
1092 if (stricmp(destname, fullpath)) // only copy if they are different
1093 cf_CopyFile(destname, fullpath);
1094
1095 mng_AllocTrackLock(cur_name, PAGETYPE_GAMEFILE);
1096 return true;
1097}
1098
1099bool CheckInGamefile(char *tempbuffer, bool show_ok_confirmation) {
1100 mngs_Pagelock temp_pl;

Callers 6

OnCompileMethod · 0.85
OnCreatescriptMethod · 0.85
AddNewLevelMethod · 0.85
AddNewScriptMethod · 0.85
Step4Method · 0.85
OnAddMethod · 0.85

Calls 7

FindGamefileNameFunction · 0.85
OutrageMessageBoxFunction · 0.85
AllocGamefileFunction · 0.85
cf_CopyFileFunction · 0.85
mng_AllocTrackLockFunction · 0.85
ddio_SplitPathFunction · 0.50
ddio_MakePathFunction · 0.50

Tested by

no test coverage detected