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

Function ScriptCompile

editor/ScriptCompilerAPI.cpp:97–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95#endif
96
97int ScriptCompile(tCompilerInfo *ci) {
98 char Compiler_path[_MAX_PATH];
99 int Warning_level = -1;
100 int Debug_type = -1;
101 int len = _MAX_PATH;
102
103 if (!cfexist(ci->source_filename))
104 return CERR_SOURCENOEXIST;
105
106#ifndef NEWEDITOR
107 // make sure there is a compiler defined
108 if (Database->read("EditorCompiler", Compiler_path, &len)) {
109 if (!cfexist(Compiler_path)) {
110 OutrageMessageBox(
111 "The configured virtual compiler (%s)\ncannot be found. Please make sure\nyou have specified a proper path "
112 "and\nthe file exists. Go into the Script and\nLevel dialog to configure your compiler.",
113 Compiler_path);
114 return CERR_COMPILERMISSING;
115 }
116 } else {
117 OutrageMessageBox(
118 "You haven't configured a virtual compiler to use.\nPlease go into the Script and Level Interface\nof the "
119 "editor and select the configure button\nto configure a virtual compiler to use.\nFind Jeff for help on this.");
120 return CERR_NOCOMPILERDEFINED;
121 }
122
123 Database->read_int("EditorVCWarningLevel", &Warning_level);
124 Database->read_int("EditorVCDebugLevel", &Debug_type);
125#else
126 // New Editor setup
127
128 // Determine the compiler
129 CString cs_Compiler_Path = AfxGetApp()->GetProfileString("settings", "EditorCompiler", "");
130 if (cs_Compiler_Path.GetLength() > 1) {
131 if (!cfexist(cs_Compiler_Path.GetBuffer(0))) {
132 OutrageMessageBox(
133 "The configured virtual compiler (%s)\ncannot be found. Please make sure\nyou have specified a proper path "
134 "and\nthe file exists. Select the configure button\nto configure your virtual compiler.",
135 cs_Compiler_Path.GetBuffer(0));
136 return CERR_COMPILERMISSING;
137 } else {
138 // valid compiler
139 strcpy(Compiler_path, cs_Compiler_Path.GetBuffer(0));
140 }
141 } else {
142 OutrageMessageBox("You haven't configured a virtual compiler to use.\nPlease select the configure option\nto "
143 "configure a virtual compiler to use.");
144 return CERR_NOCOMPILERDEFINED;
145 }
146
147 // Determine the Warning level
148 Warning_level = AfxGetApp()->GetProfileInt("settings", "EditorVCWarningLevel", 3);
149 ASSERT(Warning_level >= 0 && Warning_level <= 4);
150 if (Warning_level < 0 || Warning_level > 4)
151 Warning_level = 3;
152
153 // Determine the Debug type
154 Debug_type = AfxGetApp()->GetProfileInt("settings", "EditorVCDebugLevel", 2);

Callers 6

OnCompileMethod · 0.85
OnCreatescriptMethod · 0.85
Step3Method · 0.85
OnInitDialogMethod · 0.85
OnSaveButtonMethod · 0.85
DoStuffMethod · 0.85

Calls 5

cfexistFunction · 0.85
OutrageMessageBoxFunction · 0.85
GetLengthMethod · 0.80
GetBufferMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected