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

Method OnCheckinFile

editor/FilePageDialog.cpp:207–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207void CFilePageDialog::OnCheckinFile() {
208 int r, n;
209 mngs_Pagelock temp_pl;
210
211 if (Num_gamefiles < 1)
212 return;
213
214 int *listbox_map;
215 int listbox_count = CreateIndexMap(&listbox_map, IDC_CHECKEDOUT_LIST);
216 if (!listbox_count)
217 return;
218
219 if (!mng_MakeLocker()) {
220 mem_free(listbox_map);
221 return;
222 }
223
224 CCheckListBox *list = (CCheckListBox *)GetDlgItem(IDC_CHECKEDOUT_LIST);
225 char buffer[_MAX_PATH], ext[_MAX_EXT];
226
227 for (int i = 0; i < listbox_count; i++) {
228 list->GetText(listbox_map[i], buffer);
229 ddio_SplitPath(buffer, NULL, NULL, ext);
230 if ((!stricmp(ext, ".d3l")) || (!stricmp(ext, ".cpp"))) {
231 if (MessageBox("Tisk Tisk, Now there you go, ignoring Jeff when he told you not to check levels and scripts\nin "
232 "through this dialog. Are you sure you want to ignore Jeff?\n(He doesn't like to be ignored)",
233 buffer, MB_YESNO) != IDYES)
234 continue;
235 }
236
237 n = FindGameFile(buffer);
238 if (n == -1)
239 continue;
240
241 // Make sure we own this gamefile
242 strcpy(temp_pl.name, Gamefiles[n].name);
243 temp_pl.pagetype = PAGETYPE_GAMEFILE;
244
245 r = mng_CheckIfPageOwned(&temp_pl, TableUser);
246 if (r < 0)
247 OutrageMessageBox(ErrorString);
248 else if (r == 0)
249 OutrageMessageBox(InfoString);
250 else {
251 // Change the pagelock state to UNLOCKED
252 strcpy(temp_pl.holder, "UNLOCKED");
253 if (!mng_ReplacePagelock(temp_pl.name, &temp_pl)) {
254 MessageBox(ErrorString, "Error!");
255 continue;
256 } else {
257 // Now actually replace the copy on the net with our local one
258
259 if (!mng_ReplacePage(Gamefiles[n].name, Gamefiles[n].name, n, PAGETYPE_GAMEFILE, 0))
260 OutrageMessageBox(ErrorString);
261 else {
262 // Save this gamefile file to the network for all
263
264 char destname[100], srcname[100];

Callers

nothing calls this directly

Calls 14

mng_MakeLockerFunction · 0.85
FindGameFileFunction · 0.85
mng_CheckIfPageOwnedFunction · 0.85
OutrageMessageBoxFunction · 0.85
mng_ReplacePagelockFunction · 0.85
mng_ReplacePageFunction · 0.85
cf_CopyFileFunction · 0.85
mng_DeletePageFunction · 0.85
mng_FindTrackLockFunction · 0.85
mng_FreeTrackLockFunction · 0.85
mng_EraseLockerFunction · 0.85
ddio_SplitPathFunction · 0.50

Tested by

no test coverage detected