| 843 | } |
| 844 | |
| 845 | void CScriptLevelInterface::OnCreatescript() { |
| 846 | CCreateNewScriptDlg dlg; |
| 847 | |
| 848 | if (dlg.DoModal()) { |
| 849 | int i; |
| 850 | char filename[_MAX_PATH]; |
| 851 | strcpy(filename, dlg.m_Filename.GetBuffer(0)); |
| 852 | |
| 853 | // see if we should add this to the manage system |
| 854 | for (i = 0; i < MAX_GAMEFILES; i++) { |
| 855 | if (Gamefiles[i].used && (!stricmp(Gamefiles[i].name, filename))) { |
| 856 | // ok we found the file...no need to add it |
| 857 | break; |
| 858 | } |
| 859 | } |
| 860 | |
| 861 | bool on_network = false; |
| 862 | |
| 863 | if (i < MAX_GAMEFILES || (mng_FindTrackLock(filename, PAGETYPE_GAMEFILE) != -1)) { |
| 864 | char buffer[_MAX_PATH]; |
| 865 | sprintf(buffer, |
| 866 | "Just so you know, %s\nalready exists in the manage system, do you still want\nto create a new file of " |
| 867 | "the same name?", |
| 868 | filename); |
| 869 | on_network = true; |
| 870 | if (MessageBox(buffer, "Warning", MB_YESNO) != IDYES) |
| 871 | return; |
| 872 | } |
| 873 | |
| 874 | if (!ScriptCreateEmptyScript(filename, (dlg.m_ScriptType == 0) ? ST_LEVEL : ST_GAME)) { |
| 875 | MessageBox("Unable to create file", "Error", MB_OK); |
| 876 | return; |
| 877 | } |
| 878 | |
| 879 | bool added_to_network = false; |
| 880 | |
| 881 | // we never found the file in the manage system |
| 882 | if (!on_network) { |
| 883 | if (Network_up) { |
| 884 | char buffer[_MAX_PATH + 100]; |
| 885 | sprintf(buffer, "Do you want to add\n%s\nto the network?", filename); |
| 886 | |
| 887 | if (cfexist(filename) && MessageBox(buffer, "Add to Data", MB_YESNO) == IDYES) { |
| 888 | ddio_MakePath(buffer, LocalScriptDir, filename, NULL); |
| 889 | AddNewGameFile(buffer, "scripts"); |
| 890 | UpdateDialog(); |
| 891 | added_to_network = true; |
| 892 | } |
| 893 | } else { |
| 894 | // doh! they didn't say yes |
| 895 | char buffer[_MAX_PATH]; |
| 896 | sprintf(buffer, "I would ask you if you wanted to add the new\nscript to the manage system, but\nsince you " |
| 897 | "said no to the data update, you'll have\nto add it manually"); |
| 898 | MessageBox(buffer, "Doh!", MB_OK); |
| 899 | } |
| 900 | |
| 901 | // now auto-compile the DLL |
| 902 | SetStatus("Initial Compile"); |
nothing calls this directly
no test coverage detected