| 2158 | } |
| 2159 | |
| 2160 | bool CScriptLevelInterface::UndoCheckOutLevels() { |
| 2161 | CCheckListBox *list = (CCheckListBox *)GetDlgItem(IDC_LIST_CHECKEDOUT); |
| 2162 | int listbox_size = list->GetCount(); |
| 2163 | int list_size = 0; |
| 2164 | int i; |
| 2165 | for (i = 0; i < listbox_size; i++) { |
| 2166 | if (list->GetCheck(i)) { |
| 2167 | list_size++; |
| 2168 | } |
| 2169 | } |
| 2170 | |
| 2171 | if (list_size == 0) |
| 2172 | return false; |
| 2173 | int *index_map = (int *)mem_malloc(list_size * sizeof(int)); |
| 2174 | if (!index_map) |
| 2175 | return false; |
| 2176 | |
| 2177 | int index = 0; |
| 2178 | for (i = 0; i < listbox_size; i++) { |
| 2179 | if (list->GetCheck(i)) { |
| 2180 | index_map[index] = i; |
| 2181 | index++; |
| 2182 | } |
| 2183 | } |
| 2184 | |
| 2185 | if (!mng_MakeLocker()) { |
| 2186 | mem_free(index_map); |
| 2187 | return false; |
| 2188 | } |
| 2189 | |
| 2190 | int j; |
| 2191 | bool changed = false; |
| 2192 | char buffer[_MAX_PATH + 200]; |
| 2193 | char tempbuffer[_MAX_PATH]; |
| 2194 | char savename[_MAX_PATH]; |
| 2195 | |
| 2196 | for (i = 0; i < list_size; i++) { |
| 2197 | index = index_map[i]; |
| 2198 | |
| 2199 | list->GetText(index, tempbuffer); |
| 2200 | strcpy(savename, tempbuffer); |
| 2201 | strcat(tempbuffer, ".d3l"); |
| 2202 | |
| 2203 | char t[256]; |
| 2204 | sprintf(t, "UndoCheck Out: %s", tempbuffer); |
| 2205 | SetStatus(t); |
| 2206 | |
| 2207 | // go ahead and check in |
| 2208 | if (UndoCheckOutGamefile(tempbuffer)) |
| 2209 | changed = true; |
| 2210 | |
| 2211 | bool script_also; |
| 2212 | script_also = false; |
| 2213 | |
| 2214 | // ok the level has been checked in, see if there is a corresponding .cpp file |
| 2215 | strcpy(tempbuffer, savename); |
| 2216 | strcat(tempbuffer, ".cpp"); |
| 2217 | for (j = 0; j < MAX_TRACKLOCKS; j++) { |
nothing calls this directly
no test coverage detected