| 205 | } |
| 206 | |
| 207 | void 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]; |
nothing calls this directly
no test coverage detected