| 2047 | } |
| 2048 | |
| 2049 | bool CScriptLevelInterface::UndoCheckOutScripts() { |
| 2050 | CCheckListBox *list = (CCheckListBox *)GetDlgItem(IDC_LIST_CHECKEDOUT); |
| 2051 | int listbox_size = list->GetCount(); |
| 2052 | int list_size = 0; |
| 2053 | int i; |
| 2054 | for (i = 0; i < listbox_size; i++) { |
| 2055 | if (list->GetCheck(i)) { |
| 2056 | list_size++; |
| 2057 | } |
| 2058 | } |
| 2059 | |
| 2060 | if (list_size == 0) |
| 2061 | return false; |
| 2062 | int *index_map = (int *)mem_malloc(list_size * sizeof(int)); |
| 2063 | if (!index_map) |
| 2064 | return false; |
| 2065 | |
| 2066 | int index = 0; |
| 2067 | for (i = 0; i < listbox_size; i++) { |
| 2068 | if (list->GetCheck(i)) { |
| 2069 | index_map[index] = i; |
| 2070 | index++; |
| 2071 | } |
| 2072 | } |
| 2073 | |
| 2074 | if (!mng_MakeLocker()) { |
| 2075 | mem_free(index_map); |
| 2076 | return false; |
| 2077 | } |
| 2078 | |
| 2079 | int j; |
| 2080 | bool changed = false; |
| 2081 | char tempbuffer[_MAX_PATH]; |
| 2082 | char savename[_MAX_PATH]; |
| 2083 | |
| 2084 | for (i = 0; i < list_size; i++) { |
| 2085 | index = index_map[i]; |
| 2086 | |
| 2087 | list->GetText(index, tempbuffer); |
| 2088 | strcpy(savename, tempbuffer); |
| 2089 | strcat(tempbuffer, ".cpp"); |
| 2090 | |
| 2091 | char t[256]; |
| 2092 | sprintf(t, "UndoCheck Out: %s", tempbuffer); |
| 2093 | SetStatus(t); |
| 2094 | |
| 2095 | // this item is checked...we wish to checkin |
| 2096 | if (UndoCheckOutGamefile(tempbuffer)) |
| 2097 | changed = true; |
| 2098 | |
| 2099 | // ok, now see if there was a DLL too |
| 2100 | strcpy(tempbuffer, savename); |
| 2101 | strcat(tempbuffer, ".dll"); |
| 2102 | for (j = 0; j < MAX_TRACKLOCKS; j++) { |
| 2103 | if ((GlobalTrackLocks[j].used) && (GlobalTrackLocks[j].pagetype == PAGETYPE_GAMEFILE) && |
| 2104 | (!stricmp(GlobalTrackLocks[j].name, tempbuffer))) { |
| 2105 | // ok, we found a possibly matching script...ask if they want that |
| 2106 | // undone also... |
nothing calls this directly
no test coverage detected