/*
* 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 .
*/
/*
* $Logfile: /DescentIII/Main/editor/ScriptLevelInterface.cpp $
* $Revision: 1.1.1.1 $
* $Date: 2003-08-26 03:57:38 $
* $Author: kevinb $
*
* ScriptLevelInterface.cpp : implementation file
*
* $Log: not supported by cvs2svn $
*
* 24 5/11/99 12:13p Jason
* added checks for messed up gamefiles
*
* 23 2/25/99 12:34p Jeff
* don't display message that someone has a file checked out during mass
* compile
*
* 22 2/24/99 9:39p Jeff
* only sync scripts when needed
*
* 21 2/23/99 11:52p Jeff
* new script dll sync dialog
*
* 20 2/21/99 8:04p Jeff
* better handling of out-of-sync scripts
*
* 19 2/18/99 8:29p Nate
* commented out some manage code
*
* 18 2/18/99 10:58a Jeff
* added a 'find in files' for gamefiles manage system
*
* 17 2/17/99 6:54p Jeff
* added check box for auto check in/out scripts with levels...fix
* checksum mprintf bug
*
* 16 2/09/99 4:43p Jeff
* fixed resource leak
*
* 15 2/01/99 11:55a Jeff
* automatically check in/out .msg and .str files
*
* 14 1/13/99 5:01p Jeff
* don't auto-checkin dll if the .cpp doesn't get checked in for a new
* file
*
* 13 1/11/99 3:34p Jeff
* added checks for when going editor->game to see if scripts are out of
* date, if so give the option of breaking out. Add some options to mass
* script compiler, along with a toolbar shortcut.
*
* 12 1/05/99 4:54p Jeff
* save the last script edited and set the on init
*
* 11 1/05/99 4:33p Jeff
* when "Display non checkout files" is checked, display the .cpp files in
* the directory...not just whats in the table file
*
* 10 12/21/98 6:41p Jeff
* auto-compile, check in and check back out for when new scripts are
* created. (yes must be said to the data update)
*
* 9 12/20/98 9:57p Jeff
* added ability to display scripts not checked out. don't display
* message on checkin/out
*
* 8 12/18/98 12:11p Jeff
* created a function to determine a script's type and hooked it in
*
* 7 12/18/98 12:11p Jeff
* added mass script compile dialog
*
* 6 12/18/98 10:40a Jeff
* save out settings to registry
*
* 5 12/13/98 7:50p Jeff
* automatically add new DLLs that aren't in the manage
* system...implemented create new script function, even though it's still
* in infancy.
*
* 4 12/13/98 3:10a Jeff
* fixed some bugs. Automatically check in/out/etc .dll when operating
* with .cpp. Hooked in compiler and compiler configuration. Very
* complete.
*
* 3 12/11/98 10:34p Jeff
* Updated the script/level interface, all manage system integration is
* complete. External Script Editor loading is setup too.
*
* 2 12/11/98 5:50p Jeff
* implemented and added changes regarding Level&Scripting manage system
* and compiler interface
*
* $NoKeywords: $
*/
// ScriptLevelInterface.cpp : implementation file
//
#include "stdafx.h"
#include "editor.h"
#include "ScriptLevelInterface.h"
#include "CreateNewScriptDlg.h"
#include "VirtualCompilerConfig.h"
#include "ScriptMassCompile.h"
#include "gamefile.h"
#include "gamefilepage.h"
#include "descent.h"
#include "mono.h"
#include "ddio.h"
#include "pserror.h"
#include "manage.h"
#include "mem.h"
#include "ScriptCompilerAPI.h"
#include "AppDatabase.h"
#include "Descent.h"
#include "ScriptSyncDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
bool AddNewGameFile(char *fullpath,char *directory);
bool DeleteGamefile(char *tempbuffer);
bool CheckInGamefile(char *tempbuffer,bool giveok);
bool CheckOutGamefile(char *tempbuffer,bool show_ok_confirmation,bool report_who_has_locked=true);
char LastScriptSelected[256];
bool Scripts_need_sync = true;
/////////////////////////////////////////////////////////////////////////////
// CScriptLevelInterface dialog
CScriptLevelInterface::CScriptLevelInterface(CWnd* pParent /*=NULL*/)
: CDialog(CScriptLevelInterface::IDD, pParent)
{
//{{AFX_DATA_INIT(CScriptLevelInterface)
m_ViewType = -1;
m_ScriptType = 0;
m_ShowNonCheckedOut = FALSE;
m_AutoCheckScripts = FALSE;
//}}AFX_DATA_INIT
InCritical = false;
}
void CScriptLevelInterface::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CScriptLevelInterface)
DDX_Control(pDX, IDC_LIST_AVAILABLE, m_ListAvailable);
DDX_Control(pDX, IDC_LIST_CHECKEDOUT, m_ListCheckedOut);
DDX_Control(pDX, IDC_SELECTED_SCRIPT, m_ScriptToCompile);
DDX_Radio(pDX, IDC_RADIO_LEVELS, m_ViewType);
DDX_Radio(pDX, IDC_SCRIPTGAME, m_ScriptType);
DDX_Check(pDX, IDC_LIST_NONCHECKED_OUT, m_ShowNonCheckedOut);
DDX_Check(pDX, IDC_AUTOCHECKSCRIPTS, m_AutoCheckScripts);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CScriptLevelInterface, CDialog)
//{{AFX_MSG_MAP(CScriptLevelInterface)
ON_BN_CLICKED(IDC_CHECKOUT, OnCheckout)
ON_BN_CLICKED(IDC_CHECKIN, OnCheckin)
ON_BN_CLICKED(IDC_UNDOCHECKOUT, OnUndocheckout)
ON_BN_CLICKED(IDC_RADIO_SCRIPTS, OnRadioScripts)
ON_BN_CLICKED(IDC_RADIO_LEVELS, OnRadioLevels)
ON_BN_CLICKED(IDC_COMPILE, OnCompile)
ON_BN_CLICKED(IDC_EDITSCRIPT, OnEditscript)
ON_CBN_CLOSEUP(IDC_SELECTED_SCRIPT, OnCloseupSelectedScript)
ON_BN_CLICKED(IDC_ADDNEW, OnAddnew)
ON_BN_CLICKED(IDC_DELETE, OnDelete)
ON_BN_CLICKED(IDC_CREATESCRIPT, OnCreatescript)
ON_WM_CLOSE()
ON_WM_DESTROY()
ON_BN_CLICKED(IDC_CONFIGCOMPILER, OnConfigcompiler)
ON_BN_CLICKED(IDC_MASSCOMPILE, OnMasscompile)
ON_CBN_SELCHANGE(IDC_SELECTED_SCRIPT, OnSelchangeSelectedScript)
ON_BN_CLICKED(IDC_LIST_NONCHECKED_OUT, OnListNoncheckedOut)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CScriptLevelInterface message handlers
void CScriptLevelInterface::SetStatus(char *str)
{
CWnd *wnd = (CWnd *)GetDlgItem(IDC_STATUS);
wnd->SetWindowText(str);
Descent->defer();
}
void CScriptLevelInterface::OnCheckout()
{
UpdateData(true);
InCritical = true;
SetStatus("Checking out files");
if(m_ViewType==0){
//we're working with levels & level scripts
if(CheckOutLevels())
UpdateDialog();
}else{
//we're working with game scripts
if(CheckOutScripts())
UpdateDialog();
}
InCritical = false;
SetStatus("Ready");
Scripts_need_sync = true;
}
void CScriptLevelInterface::OnCheckin()
{
UpdateData(true);
InCritical = true;
SetStatus("Checking in files");
if(m_ViewType==0){
//we're working with levels & level scripts
if(CheckInLevels())
UpdateDialog();
}else{
//we're working with game scripts
if(CheckInScripts())
UpdateDialog();
}
InCritical = false;
SetStatus("Ready");
}
void CScriptLevelInterface::OnUndocheckout()
{
UpdateData(true);
InCritical = true;
SetStatus("Undoing Checkout on files");
if(m_ViewType==0){
//we're working with levels & level scripts
if(UndoCheckOutLevels())
UpdateDialog();
}else{
//we're working with game scripts
if(UndoCheckOutScripts())
UpdateDialog();
}
InCritical = false;
SetStatus("Ready");
Scripts_need_sync = true;
}
void CScriptLevelInterface::OnRadioScripts()
{
UpdateDialog();
}
void CScriptLevelInterface::OnRadioLevels()
{
UpdateDialog();
}
CEdit *CompileOutputWindow;
CString CompileOutputData;
void CompileOutputCallback(char *str)
{
CompileOutputData += str;
CompileOutputWindow->SetWindowText(CompileOutputData);
}
void CScriptLevelInterface::OnCompile()
{
UpdateData(true);
SetStatus("Compiling...");
bool dll_exist = true;
char buffer[_MAX_PATH],filename[_MAX_PATH];
m_ScriptToCompile.GetLBText(m_ScriptToCompile.GetCurSel(),buffer);
ddio_SplitPath(buffer,NULL,filename,NULL);
strcat(filename,".dll");
if(!cfexist(filename)){
//there isn't a dll yet...lets make sure one isn't in the manage system
bool found;
int i;
found = false;
for (i=0;iGetCurSel();
combo->GetLBText(index,tempbuf);
if(m_ShowNonCheckedOut && (mng_FindTrackLock(tempbuf,PAGETYPE_GAMEFILE)==-1)){
//display a warning that this file is not checked out
MessageBox("This file is NOT checked out, you'll lose all changes on your\nnext data update!","Warning",MB_OK);
}
ddio_MakePath(fullpath,LocalScriptDir,tempbuf,NULL);
if(!cfexist(fullpath)){
sprintf(tempbuf,"Weird, I couldn't find %s to open...",fullpath);
MessageBox(tempbuf,"Error",MB_OK);
return;
}
SHELLEXECUTEINFO sei;
sei.cbSize = sizeof(sei);
sei.fMask = SEE_MASK_NOCLOSEPROCESS;
sei.hwnd = m_hWnd;
sei.lpVerb = "open";
sei.lpFile = fullpath;
sei.lpParameters = NULL;
sei.lpDirectory = LocalScriptDir;
sei.nShow = SW_NORMAL;
//int res = (int)ShellExecute(m_hWnd,"open",fullpath,NULL,LocalScriptDir,0);
int res;
ShellExecuteEx(&sei);
res = (int)sei.hInstApp;
if(res<=32){
char buffer[256];
switch(res){
case 0:
strcpy(buffer,"The operating system is out of memory or resources.");
break;
case ERROR_FILE_NOT_FOUND:
strcpy(buffer,"The specified file was not found.");
break;
case ERROR_PATH_NOT_FOUND:
strcpy(buffer,"The specified path was not found.");
break;
case ERROR_BAD_FORMAT:
strcpy(buffer,"The .exe file is invalid (non-Win32® .exe or error in .exe image).");
break;
case SE_ERR_ACCESSDENIED:
strcpy(buffer,"The operating system denied access to the specified file.");
break;
case SE_ERR_ASSOCINCOMPLETE:
strcpy(buffer,"The file name association is incomplete or invalid.");
break;
case SE_ERR_DDEBUSY:
strcpy(buffer,"The DDE transaction could not be completed because other DDE transactions were being processed.");
break;
case SE_ERR_DDEFAIL:
strcpy(buffer,"The DDE transaction failed.");
break;
case SE_ERR_DDETIMEOUT:
strcpy(buffer,"The DDE transaction could not be completed because the request timed out.");
break;
case SE_ERR_DLLNOTFOUND:
strcpy(buffer,"The specified dynamic-link library was not found.");
break;
//case SE_ERR_FNF:
// strcpy(buffer,"The specified file was not found.");
// break;
case SE_ERR_NOASSOC:
strcpy(buffer,"There is no application associated with the given file name extension.\nGet Jeff and he'll fix this problem for you quickly and easily.");
break;
case SE_ERR_OOM:
strcpy(buffer,"There was not enough memory to complete the operation.");
break;
//case SE_ERR_PNF:
// strcpy(buffer,"The specified path was not found.");
// break;
case SE_ERR_SHARE:
strcpy(buffer,"A sharing violation occurred.");
break;
default:
strcpy(buffer,"An unknown error occurred");
break;
}
MessageBox(buffer,"Error",MB_OK);
}
Scripts_need_sync = true;
}
void CScriptLevelInterface::OnCloseupSelectedScript()
{
UpdateData(true);
SetStatus("Determining script type...");
char buffer[_MAX_PATH];
int currsel = m_ScriptToCompile.GetCurSel();
if(currsel>=0){
m_ScriptToCompile.GetLBText(currsel,buffer);
strcpy(LastScriptSelected,buffer);
ubyte type = DetermineScriptType(buffer);
switch(type){
case ST_GAME:
m_ScriptType = 0;
break;
case ST_LEVEL:
m_ScriptType = 1;
break;
}
UpdateData(false);
}
SetStatus("Ready");
}
void CScriptLevelInterface::OnSelchangeSelectedScript()
{
OnCloseupSelectedScript();
}
void CScriptLevelInterface::UpdateAvailableWithLevels()
{
CCheckListBox *list = (CCheckListBox *)GetDlgItem(IDC_LIST_AVAILABLE);
if(!list)
return;
list->ResetContent();
SetStatus("Updating available levels");
char buffer[_MAX_PATH];
int length;
for (int i=0;iAddString(buffer);
}
}
}
SetStatus("Ready");
}
void CScriptLevelInterface::UpdateAvailableWithScripts()
{
CCheckListBox *list = (CCheckListBox *)GetDlgItem(IDC_LIST_AVAILABLE);
if(!list)
return;
list->ResetContent();
SetStatus("Updating available scripts");
char buffer[_MAX_PATH];
int length;
for (int i=0;iAddString(buffer);
}
}
}
SetStatus("Ready");
}
void CScriptLevelInterface::UpdateCheckedOutWithLevels()
{
CCheckListBox *list = (CCheckListBox *)GetDlgItem(IDC_LIST_CHECKEDOUT);
if(!list)
return;
list->ResetContent();
SetStatus("Updating checked out levels");
char buffer[_MAX_PATH];
int length;
for (int i=0;iAddString(buffer);
}
}
}
SetStatus("Ready");
}
void CScriptLevelInterface::UpdateCheckedOutWithScripts()
{
CCheckListBox *list = (CCheckListBox *)GetDlgItem(IDC_LIST_CHECKEDOUT);
if(!list)
return;
list->ResetContent();
SetStatus("Updating checked out scripts");
char buffer[_MAX_PATH];
int length;
for (int i=0;iAddString(buffer);
}
}
}
SetStatus("Ready");
}
void CScriptLevelInterface::UpdateScriptListWithLevels()
{
CComboBox *combo = (CComboBox *)GetDlgItem(IDC_SELECTED_SCRIPT);
if(!combo)
return;
combo->ResetContent();
SetStatus("Updating script list of level scripts");
char buffer[_MAX_PATH];
int length,i;
if(m_ShowNonCheckedOut){
char olddir[_MAX_PATH];
ddio_GetWorkingDir(olddir,_MAX_PATH);
ddio_SetWorkingDir(LocalScriptDir);
for (i=0;i4 && !stricmp(&Gamefiles[i].name[length-4],".d3l")){
strcpy(buffer,Gamefiles[i].name);
buffer[length-4] = '\0';
strcat(buffer,".cpp");
//ok we have a d3l, look to see if there is a script available for it
char temp[_MAX_PATH];
if(ddio_FindFileStart(buffer,temp)){
combo->AddString(buffer);
}
ddio_FindFileClose();
/*
for ( int j=0; jAddString(buffer);
break;
}
}
*/
}
}
}
ddio_SetWorkingDir(olddir);
}else{
for (i=0;i4 && !stricmp(&GlobalTrackLocks[i].name[length-4],".d3l")){
strcpy(buffer,GlobalTrackLocks[i].name);
buffer[length-4] = '\0';
strcat(buffer,".cpp");
//ok we have a checked out d3l, look to see if there is a script available for it
for( int j=0;jAddString(buffer);
break;
}
}
}
}
}
}
if(LastScriptSelected[0]!='\0' && cfexist(LastScriptSelected))
combo->SetCurSel(combo->FindStringExact(0,LastScriptSelected));
else
combo->SetCurSel(0);
SetStatus("Ready");
}
void CScriptLevelInterface::UpdateScriptListWithScripts()
{
CComboBox *combo = (CComboBox *)GetDlgItem(IDC_SELECTED_SCRIPT);
if(!combo)
return;
combo->ResetContent();
SetStatus("Updating script list with scripts");
char buffer[_MAX_PATH];
int length,i;
if(m_ShowNonCheckedOut){
char olddir[_MAX_PATH];
ddio_GetWorkingDir(olddir,_MAX_PATH);
ddio_SetWorkingDir(LocalScriptDir);
if(ddio_FindFileStart("*.cpp",buffer)){
combo->AddString(buffer);
while(ddio_FindNextFile(buffer)){
combo->AddString(buffer);
}
}
ddio_FindFileClose();
ddio_SetWorkingDir(olddir);
/*
for (i=0;i4 && !stricmp(&Gamefiles[i].name[length-4],".cpp")){
strcpy(buffer,Gamefiles[i].name);
combo->AddString(buffer);
}
}
}
*/
}else{
for (i=0;i4 && !stricmp(&GlobalTrackLocks[i].name[length-4],".cpp")){
strcpy(buffer,GlobalTrackLocks[i].name);
combo->AddString(buffer);
}
}
}
}
if(LastScriptSelected[0]!='\0' && cfexist(LastScriptSelected))
combo->SetCurSel(combo->FindStringExact(0,LastScriptSelected));
else
combo->SetCurSel(0);
SetStatus("Ready");
}
void CScriptLevelInterface::UpdateDialog()
{
UpdateData(true);
CWnd *stat1,*stat2;
stat1 = (CWnd *)GetDlgItem(IDC_AVAILABLE_GRP);
stat2 = (CWnd *)GetDlgItem(IDC_CHECKEDOUT_GRP);
if(m_ViewType==0){
//we're working with levels & level scripts
UpdateAvailableWithLevels();
UpdateCheckedOutWithLevels();
UpdateScriptListWithLevels();
stat1->SetWindowText("Levels Available");
stat2->SetWindowText("Levels CheckedOut");
}else{
//we're working with game scripts
UpdateAvailableWithScripts();
UpdateCheckedOutWithScripts();
UpdateScriptListWithScripts();
stat1->SetWindowText("Scripts Available");
stat2->SetWindowText("Scripts CheckedOut");
}
}
BOOL CScriptLevelInterface::OnInitDialog()
{
CDialog::OnInitDialog();
int value;
bool bvalue;
//restore settings
if(Database->read_int("EditorScriptViewType",&value)){
m_ViewType = value;
}else{
m_ViewType = 0;
}
if(Database->read_int("EditorScriptType",&value)){
m_ScriptType = value;
}else{
m_ScriptType = 0;
}
if(Database->read("EditorScriptShowNonCheckedOut",&bvalue)){
m_ShowNonCheckedOut = bvalue;
}else{
m_ShowNonCheckedOut = 0;
}
if(Database->read("EditorAutoCheckScriptsWithLevels",&bvalue)){
m_AutoCheckScripts = bvalue;
}else{
m_AutoCheckScripts = 0;
}
value = 256;
if(!Database->read("EditorLastScript",LastScriptSelected,&value)){
LastScriptSelected[0] = '\0';
}
UpdateData(false);
UpdateDialog();
SetStatus("Ready");
return TRUE;
}
void CScriptLevelInterface::OnAddnew()
{
InCritical = true;
SetStatus("Adding new files");
if(m_ViewType==0){
//we're working with levels & level scripts
if(AddNewLevel())
UpdateDialog();
}else{
//we're working with game scripts
if(AddNewScript())
UpdateDialog();
}
InCritical = false;
SetStatus("Ready");
Scripts_need_sync = true;
}
void CScriptLevelInterface::OnDelete()
{
UpdateData(true);
InCritical = true;
SetStatus("Deleting files");
if(m_ViewType==0){
if(DeleteLevel())
UpdateDialog();
}else{
if(DeleteScript())
UpdateDialog();
}
InCritical = false;
SetStatus("Ready");
}
void CScriptLevelInterface::OnCreatescript()
{
CCreateNewScriptDlg dlg;
if(dlg.DoModal()){
int i;
char filename[_MAX_PATH];
strcpy(filename,dlg.m_Filename.GetBuffer(0));
//see if we should add this to the manage system
for(i=0;iwrite("EditorScriptViewType",m_ViewType);
Database->write("EditorScriptType",m_ScriptType);
Database->write("EditorScriptShowNonCheckedOut",m_ShowNonCheckedOut);
Database->write("EditorLastScript",LastScriptSelected,strlen(LastScriptSelected)+1);
Database->write("EditorAutoCheckScriptsWithLevels",m_AutoCheckScripts);
CDialog::OnOK();
}
void CScriptLevelInterface::OnMasscompile()
{
CScriptMassCompile dlg;
SetStatus("Mass compiling scripts...");
dlg.DoModal();
UpdateDialog();
SetStatus("Ready");
}
void CScriptLevelInterface::OnListNoncheckedOut()
{
UpdateDialog();
}
// ======================File Checkin/Checkout Functions======================
bool CScriptLevelInterface::AddNewLevel(void)
{
char filename[255];
if (!Network_up){
OutrageMessageBox ("You need to say Yes on the initial data update, in order to\nadd files\n");
return false;
}
// Get the filename of the representing image
CString filter = "Descent III Levels (*.d3l)|*.d3l||";
if (!OpenFileDialog(this, (LPCTSTR)filter, filename, Current_files_dir, sizeof(Current_files_dir)))
return false;
return AddNewGameFile(filename,"levels");
}
bool CScriptLevelInterface::AddNewScript(void)
{
char filename[255];
if (!Network_up){
OutrageMessageBox ("You need to say Yes on the initial data update, in order to\nadd files\n");
return false;
}
// Get the filename of the representing image
CString filter = "Descent III Script Source (*.cpp)|*.cpp|Descent III Compiled Script (*.dll)|*.dll||";
if (!OpenFileDialog(this, (LPCTSTR)filter, filename, Current_files_dir, sizeof(Current_files_dir)))
return false;
return AddNewGameFile(filename,"scripts");
}
bool DeleteGamefile(char *tempbuffer)
{
int tl;
mngs_Pagelock pl;
bool removed = false;
// verify that we have it locked
if ((tl=mng_FindTrackLock (tempbuffer,PAGETYPE_GAMEFILE))==-1){
OutrageMessageBox ("%s is not yours to delete. Hmmm. Get Jeff",tempbuffer);
Int3();
return false;
}
strcpy (pl.name,tempbuffer);
pl.pagetype=PAGETYPE_GAMEFILE;
// Check to see if this is a local gamefile only. If so, only delete it locally
if (mng_CheckIfPageOwned (&pl,TableUser)!=1){
mng_FreeTrackLock (tl);
if (!mng_DeletePage (tempbuffer,PAGETYPE_GAMEFILE,1)){
mprintf ((0,ErrorString));
Int3();
}else{
removed = true;
}
}else{ // if its network, delete it from both the net and local drives
mng_FreeTrackLock (tl);
mng_DeletePage (tempbuffer,PAGETYPE_GAMEFILE,1);
mng_DeletePage (tempbuffer,PAGETYPE_GAMEFILE,0);
mng_DeletePagelock (tempbuffer,PAGETYPE_GAMEFILE);
removed = true;
}
if(removed){
for(int gf=0;gfGetCount();
int list_size = 0;
int i;
for(i=0;iGetCheck(i)){
list_size++;
}
}
if(list_size==0)
return false;
int *index_map = (int *)mem_malloc(list_size*sizeof(int));
if(!index_map)
return false;
int index = 0;
for(i=0;iGetCheck(i)){
index_map[index] = i;
index++;
}
}
if (!mng_MakeLocker()){
mem_free(index_map);
return false;
}
int j;
bool changed = false;
char buffer[_MAX_PATH+200];
char tempbuffer[_MAX_PATH];
char savename[_MAX_PATH];
for (i = 0; i < list_size; i++ ){
index = index_map[i];
list->GetText(index,tempbuffer);
strcpy(savename,tempbuffer);
strcat(tempbuffer,".d3l");
//this item is checked...we wish to delete
sprintf(buffer,"Are you sure you want to delete the level\n%s?",tempbuffer);
if(MessageBox(buffer,"Friendly Warning",MB_YESNO)==IDYES){
//go ahead and delete the sucker!
char t[256];
sprintf(t,"Deleting: %s",tempbuffer);
SetStatus(t);
if(DeleteGamefile(tempbuffer))
changed = true;
}
bool script_also;
script_also = false;
//ok the level has been deleted, see if there is a corresponding .cpp file
strcpy(tempbuffer,savename);
strcat(tempbuffer,".cpp");
for(j=0;jGetCount();
int list_size = 0;
int i;
for(i=0;iGetCheck(i)){
list_size++;
}
}
if(list_size==0)
return false;
int *index_map = (int *)mem_malloc(list_size*sizeof(int));
if(!index_map)
return false;
int index = 0;
for(i=0;iGetCheck(i)){
index_map[index] = i;
index++;
}
}
if (!mng_MakeLocker()){
mem_free(index_map);
return false;
}
int j;
bool changed = false;
char buffer[_MAX_PATH+200];
char tempbuffer[_MAX_PATH];
char savename[_MAX_PATH];
for (i = 0; i < list_size; i++ ){
index = index_map[i];
list->GetText(index,tempbuffer);
strcpy(savename,tempbuffer);
strcat(tempbuffer,".cpp");
//this item is checked...we wish to delete
sprintf(buffer,"Are you sure you want to delete script source file\n%s?",tempbuffer);
if(MessageBox(buffer,"Friendly Warning",MB_YESNO)==IDYES){
//go ahead and delete the sucker!
char t[256];
sprintf(t,"Deleting: %s",tempbuffer);
SetStatus(t);
if(DeleteGamefile(tempbuffer))
changed = true;
}
//ok, now see if there was a DLL too
strcpy(tempbuffer,savename);
strcat(tempbuffer,".dll");
for(j=0;jGetCount();
int list_size = 0;
int i;
for(i=0;iGetCheck(i)){
list_size++;
}
}
if(list_size==0)
return false;
int *index_map = (int *)mem_malloc(list_size*sizeof(int));
if(!index_map)
return false;
int index = 0;
for(i=0;iGetCheck(i)){
index_map[index] = i;
index++;
}
}
if (!mng_MakeLocker()){
mem_free(index_map);
return false;
}
int j;
bool changed = false;
char tempbuffer[_MAX_PATH];
char savename[_MAX_PATH];
for (i = 0; i < list_size; i++ ){
index = index_map[i];
list->GetText(index,tempbuffer);
strcpy(savename,tempbuffer);
strcat(tempbuffer,".cpp");
char t[256];
sprintf(t,"Checking In: %s",tempbuffer);
SetStatus(t);
//this item is checked...we wish to checkin
if(CheckInGamefile(tempbuffer,false))
changed = true;
//ok, now see if there was a DLL too
strcpy(tempbuffer,savename);
strcat(tempbuffer,".dll");
for(j=0;jGetCount();
int list_size = 0;
int i;
for(i=0;iGetCheck(i)){
list_size++;
}
}
if(list_size==0)
return false;
int *index_map = (int *)mem_malloc(list_size*sizeof(int));
if(!index_map)
return false;
int index = 0;
for(i=0;iGetCheck(i)){
index_map[index] = i;
index++;
}
}
if (!mng_MakeLocker()){
mem_free(index_map);
return false;
}
int j;
bool changed = false;
char buffer[_MAX_PATH+200];
char tempbuffer[_MAX_PATH];
char savename[_MAX_PATH];
for (i = 0; i < list_size; i++ ){
index = index_map[i];
list->GetText(index,tempbuffer);
strcpy(savename,tempbuffer);
strcat(tempbuffer,".d3l");
char t[256];
sprintf(t,"Checking In: %s",tempbuffer);
SetStatus(t);
//go ahead and check in
if(CheckInGamefile(tempbuffer,false))
changed = true;
bool script_also;
script_also = false;
//ok the level has been checked in, see if there is a corresponding .cpp file
strcpy(tempbuffer,savename);
strcat(tempbuffer,".cpp");
for(j=0;jGetCount();
int list_size = 0;
int i;
for(i=0;iGetCheck(i)){
list_size++;
}
}
if(list_size==0)
return false;
int *index_map = (int *)mem_malloc(list_size*sizeof(int));
if(!index_map)
return false;
int index = 0;
for(i=0;iGetCheck(i)){
index_map[index] = i;
index++;
}
}
if (!mng_MakeLocker()){
mem_free(index_map);
return false;
}
int j;
bool changed = false;
char tempbuffer[_MAX_PATH];
char savename[_MAX_PATH];
for (i = 0; i < list_size; i++ ){
index = index_map[i];
list->GetText(index,tempbuffer);
strcpy(savename,tempbuffer);
strcat(tempbuffer,".cpp");
char t[256];
sprintf(t,"Checking Out: %s",tempbuffer);
SetStatus(t);
//this item is checked...we wish to checkin
if(CheckOutGamefile(tempbuffer,false))
changed = true;
//ok, now see if there was a DLL too
strcpy(tempbuffer,savename);
strcat(tempbuffer,".dll");
for(j=0;jGetCount();
int list_size = 0;
int i;
for(i=0;iGetCheck(i)){
list_size++;
}
}
if(list_size==0)
return false;
int *index_map = (int *)mem_malloc(list_size*sizeof(int));
if(!index_map)
return false;
int index = 0;
for(i=0;iGetCheck(i)){
index_map[index] = i;
index++;
}
}
if (!mng_MakeLocker()){
mem_free(index_map);
return false;
}
int j;
bool changed = false;
char buffer[_MAX_PATH+200];
char tempbuffer[_MAX_PATH];
char savename[_MAX_PATH];
for (i = 0; i < list_size; i++ ){
index = index_map[i];
list->GetText(index,tempbuffer);
strcpy(savename,tempbuffer);
strcat(tempbuffer,".d3l");
char t[256];
sprintf(t,"Checking Out: %s",tempbuffer);
SetStatus(t);
//this item is checked...we wish to checkin
if(CheckOutGamefile(tempbuffer,false))
changed = true;
bool script_also;
script_also = false;
//ok the level has been checked in, see if there is a corresponding .cpp file
strcpy(tempbuffer,savename);
strcat(tempbuffer,".cpp");
for(j=0;jGetCount();
int list_size = 0;
int i;
for(i=0;iGetCheck(i)){
list_size++;
}
}
if(list_size==0)
return false;
int *index_map = (int *)mem_malloc(list_size*sizeof(int));
if(!index_map)
return false;
int index = 0;
for(i=0;iGetCheck(i)){
index_map[index] = i;
index++;
}
}
if (!mng_MakeLocker()){
mem_free(index_map);
return false;
}
int j;
bool changed = false;
char tempbuffer[_MAX_PATH];
char savename[_MAX_PATH];
for (i = 0; i < list_size; i++ ){
index = index_map[i];
list->GetText(index,tempbuffer);
strcpy(savename,tempbuffer);
strcat(tempbuffer,".cpp");
char t[256];
sprintf(t,"UndoCheck Out: %s",tempbuffer);
SetStatus(t);
//this item is checked...we wish to checkin
if(UndoCheckOutGamefile(tempbuffer))
changed = true;
//ok, now see if there was a DLL too
strcpy(tempbuffer,savename);
strcat(tempbuffer,".dll");
for(j=0;jGetCount();
int list_size = 0;
int i;
for(i=0;iGetCheck(i)){
list_size++;
}
}
if(list_size==0)
return false;
int *index_map = (int *)mem_malloc(list_size*sizeof(int));
if(!index_map)
return false;
int index = 0;
for(i=0;iGetCheck(i)){
index_map[index] = i;
index++;
}
}
if (!mng_MakeLocker()){
mem_free(index_map);
return false;
}
int j;
bool changed = false;
char buffer[_MAX_PATH+200];
char tempbuffer[_MAX_PATH];
char savename[_MAX_PATH];
for (i = 0; i < list_size; i++ ){
index = index_map[i];
list->GetText(index,tempbuffer);
strcpy(savename,tempbuffer);
strcat(tempbuffer,".d3l");
char t[256];
sprintf(t,"UndoCheck Out: %s",tempbuffer);
SetStatus(t);
//go ahead and check in
if(UndoCheckOutGamefile(tempbuffer))
changed = true;
bool script_also;
script_also = false;
//ok the level has been checked in, see if there is a corresponding .cpp file
strcpy(tempbuffer,savename);
strcat(tempbuffer,".cpp");
for(j=0;j