| 272 | } |
| 273 | |
| 274 | void CScriptLevelInterface::OnCompile() { |
| 275 | UpdateData(true); |
| 276 | |
| 277 | SetStatus("Compiling..."); |
| 278 | |
| 279 | bool dll_exist = true; |
| 280 | |
| 281 | char buffer[_MAX_PATH], filename[_MAX_PATH]; |
| 282 | m_ScriptToCompile.GetLBText(m_ScriptToCompile.GetCurSel(), buffer); |
| 283 | ddio_SplitPath(buffer, NULL, filename, NULL); |
| 284 | strcat(filename, ".dll"); |
| 285 | if (!cfexist(filename)) { |
| 286 | // there isn't a dll yet...lets make sure one isn't in the manage system |
| 287 | bool found; |
| 288 | int i; |
| 289 | |
| 290 | found = false; |
| 291 | for (i = 0; i < MAX_GAMEFILES; i++) { |
| 292 | if (Gamefiles[i].used && (!stricmp(filename, Gamefiles[i].name))) { |
| 293 | found = true; |
| 294 | break; |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | if (!found) { |
| 299 | // ok there wasn't one in the gamefiles make sure there isn't a tracklocked |
| 300 | if (mng_FindTrackLock(filename, PAGETYPE_GAMEFILE) == -1) { |
| 301 | // there isn't one in the track lock...this is our first compile! |
| 302 | dll_exist = false; |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | tCompilerInfo ci; |
| 308 | ci.callback = CompileOutputCallback; |
| 309 | ci.script_type = (m_ScriptType == 0) ? ST_GAME : ST_LEVEL; |
| 310 | strcpy(ci.source_filename, buffer); |
| 311 | CompileOutputWindow = (CEdit *)GetDlgItem(IDC_COMPILER_OUTPUT); |
| 312 | CompileOutputData = ""; |
| 313 | |
| 314 | ScriptCompile(&ci); |
| 315 | |
| 316 | SetStatus("Ready"); |
| 317 | CompileOutputData = ""; // no need for this to hang around |
| 318 | |
| 319 | if (!dll_exist && cfexist(filename)) { |
| 320 | // yeah! we created a dll, ask the user if they want to put it into the manage system |
| 321 | if (Network_up) { |
| 322 | sprintf(buffer, |
| 323 | "Congratulations! It looks like a dll was successfully created. I\ndon't see the DLL in the manage " |
| 324 | "system, so\nwould you like me to add it into the manage system for you?(HIGHLY recommended)"); |
| 325 | if (MessageBox(buffer, "Congratulations", MB_YESNO) == IDYES) { |
| 326 | ddio_MakePath(buffer, LocalScriptDir, filename, NULL); |
| 327 | if (!cfexist(buffer)) { |
| 328 | sprintf(buffer, |
| 329 | "I can't seem to find %s in your data\\scripts directory...Sorry,\nbut I can't automatically add it " |
| 330 | "for you.\nYou'll have to manually add %s into the manage system.", |
| 331 | filename, filename); |
nothing calls this directly
no test coverage detected