1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
/*
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
--- HISTORICAL COMMENTS FOLLOW ---
* $Logfile: /DescentIII/Main/editor/QuickCompile.cpp $
* $Revision: 1.1.1.1 $
* $Date: 2003-08-26 03:57:38 $
* $Author: kevinb $
*
* Does a quick compile of a script
*
* $Log: not supported by cvs2svn $
*
* 2 12/30/98 4:38p Jeff
* initial creation
*
* $NoKeywords: $
*/
// QuickCompile.cpp : implementation file
//
#include "stdafx.h"
#include "editor.h"
#include "QuickCompile.h"
#include "scriptcompilerapi.h"
#include "ScriptMassCompile.h"
#include "ddio.h"
#include "cfile.h"
#include "manage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CQuickCompile dialog
CQuickCompile::CQuickCompile(char *scriptname, CWnd *pParent /*=NULL*/) : CDialog(CQuickCompile::IDD, pParent) {
//{{AFX_DATA_INIT(CQuickCompile)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
strcpy(m_scriptname, scriptname);
ret_value = 0;
}
void CQuickCompile::DoDataExchange(CDataExchange *pDX) {
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CQuickCompile)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CQuickCompile, CDialog)
//{{AFX_MSG_MAP(CQuickCompile)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CQuickCompile message handlers
CEdit *quick_compile_edit;
CString quick_compile_string;
void quickcompilercallback(char *str) {
quick_compile_string += str;
quick_compile_edit->SetWindowText(quick_compile_string);
}
BOOL CQuickCompile::OnInitDialog() {
CDialog::OnInitDialog();
quick_compile_string = "";
quick_compile_edit = (CEdit *)GetDlgItem(IDC_TEXT);
ret_value = 0;
char filename[_MAX_PATH];
char compiled_filename[_MAX_PATH];
bool isours = false;
ddio_SplitPath(m_scriptname, NULL, filename, NULL);
strcpy(compiled_filename, filename);
strcat(filename, ".cpp");
strcat(compiled_filename, ".dll");
if (mng_FindTrackLock(filename, PAGETYPE_GAMEFILE) != -1)
isours = true;
// grey out the OK button
CWnd *wnd = (CWnd *)GetDlgItem(IDOK);
wnd->EnableWindow(false);
if (cfexist(filename)) {
char full_path[_MAX_PATH];
ddio_MakePath(full_path, LocalScriptDir, compiled_filename, NULL);
if (cfexist(full_path)) {
ddio_DeleteFile(full_path);
}
if (!isours) {
quick_compile_string += "====================================================\r\n";
quick_compile_string += "=== SCRIPT IS NOT CHECKED OUT BY YOU!!!!!\r\n";
quick_compile_string += "====================================================\r\n";
quick_compile_edit->SetWindowText(quick_compile_string);
}
tCompilerInfo ci;
ci.callback = quickcompilercallback;
ci.script_type = DetermineScriptType(filename);
strcpy(ci.source_filename, filename);
ScriptCompile(&ci);
if (cfexist(compiled_filename)) {
ret_value = 1;
}
} else {
ret_value = -1;
char buffer[256];
sprintf(buffer, "'%s' does not exist", filename);
quick_compile_edit->SetWindowText(buffer);
}
wnd->EnableWindow(true);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CQuickCompile::OnDestroy() {
CDialog::OnDestroy();
quick_compile_string = "";
}
INT_PTR CQuickCompile::DoModal() { return CDialog::DoModal(); }
|