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

Method CheckOutScripts

editor/ScriptLevelInterface.cpp:1793–1903  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1791}
1792
1793bool CScriptLevelInterface::CheckOutScripts() {
1794 CCheckListBox *list = (CCheckListBox *)GetDlgItem(IDC_LIST_AVAILABLE);
1795 int listbox_size = list->GetCount();
1796 int list_size = 0;
1797 int i;
1798 for (i = 0; i < listbox_size; i++) {
1799 if (list->GetCheck(i)) {
1800 list_size++;
1801 }
1802 }
1803
1804 if (list_size == 0)
1805 return false;
1806 int *index_map = (int *)mem_malloc(list_size * sizeof(int));
1807 if (!index_map)
1808 return false;
1809
1810 int index = 0;
1811 for (i = 0; i < listbox_size; i++) {
1812 if (list->GetCheck(i)) {
1813 index_map[index] = i;
1814 index++;
1815 }
1816 }
1817
1818 if (!mng_MakeLocker()) {
1819 mem_free(index_map);
1820 return false;
1821 }
1822
1823 int j;
1824 bool changed = false;
1825 char tempbuffer[_MAX_PATH];
1826 char savename[_MAX_PATH];
1827
1828 for (i = 0; i < list_size; i++) {
1829 index = index_map[i];
1830
1831 list->GetText(index, tempbuffer);
1832 strcpy(savename, tempbuffer);
1833 strcat(tempbuffer, ".cpp");
1834
1835 char t[256];
1836 sprintf(t, "Checking Out: %s", tempbuffer);
1837 SetStatus(t);
1838
1839 // this item is checked...we wish to checkin
1840 if (CheckOutGamefile(tempbuffer, false))
1841 changed = true;
1842
1843 // ok, now see if there was a DLL too
1844 strcpy(tempbuffer, savename);
1845 strcat(tempbuffer, ".dll");
1846 for (j = 0; j < MAX_GAMEFILES; j++) {
1847 if ((Gamefiles[j].used) && (!stricmp(Gamefiles[j].name, tempbuffer)) &&
1848 (mng_FindTrackLock(tempbuffer, PAGETYPE_GAMEFILE) == -1)) {
1849 // ok, we found a possibly matching script...ask if they want that
1850 // checked out also...

Callers

nothing calls this directly

Calls 5

mng_MakeLockerFunction · 0.85
CheckOutGamefileFunction · 0.85
mng_FindTrackLockFunction · 0.85
mng_EraseLockerFunction · 0.85
GetTextMethod · 0.45

Tested by

no test coverage detected