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

Method OnInitDialog

editor/QuickCompile.cpp:89–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89BOOL CQuickCompile::OnInitDialog() {
90 CDialog::OnInitDialog();
91
92 quick_compile_string = "";
93 quick_compile_edit = (CEdit *)GetDlgItem(IDC_TEXT);
94 ret_value = 0;
95
96 char filename[_MAX_PATH];
97 char compiled_filename[_MAX_PATH];
98 bool isours = false;
99
100 ddio_SplitPath(m_scriptname, NULL, filename, NULL);
101 strcpy(compiled_filename, filename);
102 strcat(filename, ".cpp");
103 strcat(compiled_filename, ".dll");
104
105 if (mng_FindTrackLock(filename, PAGETYPE_GAMEFILE) != -1)
106 isours = true;
107
108 // grey out the OK button
109 CWnd *wnd = (CWnd *)GetDlgItem(IDOK);
110 wnd->EnableWindow(false);
111
112 if (cfexist(filename)) {
113 char full_path[_MAX_PATH];
114 ddio_MakePath(full_path, LocalScriptDir, compiled_filename, NULL);
115 if (cfexist(full_path)) {
116 ddio_DeleteFile(full_path);
117 }
118
119 if (!isours) {
120 quick_compile_string += "====================================================\r\n";
121 quick_compile_string += "=== SCRIPT IS NOT CHECKED OUT BY YOU!!!!!\r\n";
122 quick_compile_string += "====================================================\r\n";
123 quick_compile_edit->SetWindowText(quick_compile_string);
124 }
125
126 tCompilerInfo ci;
127 ci.callback = quickcompilercallback;
128 ci.script_type = DetermineScriptType(filename);
129 strcpy(ci.source_filename, filename);
130 ScriptCompile(&ci);
131
132 if (cfexist(compiled_filename)) {
133 ret_value = 1;
134 }
135
136 } else {
137 ret_value = -1;
138 char buffer[256];
139 sprintf(buffer, "'%s' does not exist", filename);
140 quick_compile_edit->SetWindowText(buffer);
141 }
142
143 wnd->EnableWindow(true);
144
145 return TRUE; // return TRUE unless you set the focus to a control
146 // EXCEPTION: OCX Property Pages should return FALSE

Callers

nothing calls this directly

Calls 7

mng_FindTrackLockFunction · 0.85
cfexistFunction · 0.85
DetermineScriptTypeFunction · 0.85
ScriptCompileFunction · 0.85
ddio_SplitPathFunction · 0.50
ddio_MakePathFunction · 0.50
ddio_DeleteFileFunction · 0.50

Tested by

no test coverage detected