mirror of
https://github.com/electronicarts/CNC_TS_and_RA2_Mission_Editor.git
synced 2025-07-17 19:56:38 -04:00
code reformatted .
This commit is contained in:
parent
76d336504f
commit
1de6ad56c2
265 changed files with 18240 additions and 21591 deletions
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
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 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.
|
||||
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 <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// All1.cpp: Implementierungsdatei
|
||||
|
@ -87,10 +87,10 @@ void CAll::UpdateDialog()
|
|||
{
|
||||
//m_Sections.Clear();
|
||||
|
||||
while(m_Sections.DeleteString(0)!=-1);
|
||||
while(m_Keys.DeleteString(0)!=-1);
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
while (m_Sections.DeleteString(0) != -1);
|
||||
while (m_Keys.DeleteString(0) != -1);
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
|
||||
m_Value.SetWindowText("");
|
||||
|
||||
|
@ -105,22 +105,21 @@ void CAll::UpdateDialog()
|
|||
OnSelchangeSections();
|
||||
}
|
||||
|
||||
void CAll::OnSelchangeSections()
|
||||
void CAll::OnSelchangeSections()
|
||||
{
|
||||
while(m_Keys.DeleteString(0)!=CB_ERR);
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
while (m_Keys.DeleteString(0) != CB_ERR);
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
CString cuSection;
|
||||
m_Sections.GetWindowText(cuSection);
|
||||
|
||||
if(cuSection.GetLength())
|
||||
{
|
||||
if (cuSection.GetLength()) {
|
||||
int i;
|
||||
m_Keys.SetRedraw(FALSE);
|
||||
SetCursor(LoadCursor(0,IDC_WAIT));
|
||||
for(auto const&[key, val] : ini[cuSection]) {
|
||||
SetCursor(LoadCursor(0, IDC_WAIT));
|
||||
for (auto const& [key, val] : ini[cuSection]) {
|
||||
m_Keys.InsertString(-1, key);
|
||||
|
||||
|
||||
}
|
||||
SetCursor(m_hArrowCursor);
|
||||
m_Keys.SetRedraw(TRUE);
|
||||
|
@ -129,62 +128,62 @@ void CAll::OnSelchangeSections()
|
|||
}
|
||||
|
||||
|
||||
void CAll::OnChangeValue()
|
||||
void CAll::OnChangeValue()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
CString t;
|
||||
m_Value.GetWindowText(t);
|
||||
|
||||
CString cuSection;
|
||||
m_Sections.GetWindowText(cuSection);
|
||||
|
||||
|
||||
|
||||
CString cuKey;
|
||||
if (m_Keys.GetCurSel() >= 0) {
|
||||
m_Keys.GetText(m_Keys.GetCurSel(), cuKey);
|
||||
}
|
||||
|
||||
ini.SetString(cuSection, cuKey, t);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CAll::OnSelchangeKeys()
|
||||
void CAll::OnSelchangeKeys()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
CString cuSection;
|
||||
m_Sections.GetWindowText(cuSection);
|
||||
|
||||
CString cuKey;
|
||||
m_Keys.GetText(m_Keys.GetCurSel(), cuKey) ;
|
||||
|
||||
m_Keys.GetText(m_Keys.GetCurSel(), cuKey);
|
||||
|
||||
m_Value.SetWindowText(ini.GetString(cuSection, cuKey));
|
||||
}
|
||||
|
||||
void CAll::OnUpdateValue()
|
||||
void CAll::OnUpdateValue()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CAll::OnAddsection()
|
||||
void CAll::OnAddsection()
|
||||
{
|
||||
CString name = InputBox("Please set the name of the new section (the section may already exist)", "Insert Section");
|
||||
|
||||
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
ini.AddSection(name);
|
||||
|
||||
|
||||
UpdateDialog();
|
||||
}
|
||||
|
||||
void CAll::OnDeletesection()
|
||||
void CAll::OnDeletesection()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
int cusection;
|
||||
cusection=m_Sections.GetCurSel();
|
||||
if (cusection==-1) {
|
||||
cusection = m_Sections.GetCurSel();
|
||||
if (cusection == -1) {
|
||||
MessageBox("You cannot delete a section without choosing one.");
|
||||
return;
|
||||
}
|
||||
|
@ -195,65 +194,65 @@ void CAll::OnDeletesection()
|
|||
if (MessageBox(CString((CString)"Are you sure you want to delete " + str + "? You should be really careful, you may not be able to use the map afterwards."), "Delete section", MB_YESNO) == IDNO) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ini.DeleteSection(str);
|
||||
|
||||
UpdateDialog();
|
||||
}
|
||||
|
||||
void CAll::OnDeletekey()
|
||||
void CAll::OnDeletekey()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
int cukey;
|
||||
if(m_Sections.GetCurSel()<0) return;
|
||||
cukey=m_Keys.GetCurSel();
|
||||
if(cukey==-1) {
|
||||
if (m_Sections.GetCurSel() < 0) return;
|
||||
cukey = m_Keys.GetCurSel();
|
||||
if (cukey == -1) {
|
||||
MessageBox("You cannot delete a key without choosing one.");
|
||||
return;
|
||||
}
|
||||
|
||||
CString str;
|
||||
CString sec;
|
||||
int cuSection=m_Sections.GetCurSel();
|
||||
int cuSection = m_Sections.GetCurSel();
|
||||
m_Sections.GetLBText(cuSection, sec);
|
||||
m_Keys.GetText(cukey, str);
|
||||
|
||||
if (MessageBox(CString((CString)"Are you sure you want to delete " + str + "? You should be really careful, you may not be able to use the map afterwards."), "Delete key", MB_YESNO) == IDNO) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ini.RemoveValueByKey(sec, str);
|
||||
|
||||
UpdateDialog();
|
||||
UpdateDialog();
|
||||
|
||||
m_Sections.SetCurSel(cuSection);
|
||||
OnSelchangeSections();
|
||||
}
|
||||
|
||||
void CAll::OnAddkey()
|
||||
void CAll::OnAddkey()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
int cusection;
|
||||
cusection=m_Sections.GetCurSel();
|
||||
if(cusection==-1) {
|
||||
cusection = m_Sections.GetCurSel();
|
||||
if (cusection == -1) {
|
||||
MessageBox("You need to specify a section first.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
CString sec;
|
||||
m_Sections.GetLBText(cusection, sec);
|
||||
|
||||
CString key, value;
|
||||
key=InputBox("Please set the name and value for the current key here: (for example, setting a new key ""Strength"" with the value 200 can be written as ""Strength=200"". You don´t need to specify a value.)", "Create key");
|
||||
key = InputBox("Please set the name and value for the current key here: (for example, setting a new key ""Strength"" with the value 200 can be written as ""Strength=200"". You don´t need to specify a value.)", "Create key");
|
||||
|
||||
if (key.Find("=") != -1) {
|
||||
// value specified
|
||||
// MW BUGFIX
|
||||
value=key.Right(key.GetLength()-key.Find("=")-1);
|
||||
key=key.Left(key.Find("="));
|
||||
value = key.Right(key.GetLength() - key.Find("=") - 1);
|
||||
key = key.Left(key.Find("="));
|
||||
}
|
||||
|
||||
|
||||
ini.SetString(sec, key, value);
|
||||
|
||||
UpdateDialog();
|
||||
|
@ -261,25 +260,23 @@ void CAll::OnAddkey()
|
|||
OnSelchangeSections();
|
||||
}
|
||||
|
||||
void CAll::OnInisection()
|
||||
void CAll::OnInisection()
|
||||
{
|
||||
CFileDialog dlg(FALSE, ".ini", "*.ini", OFN_HIDEREADONLY | OFN_FILEMUSTEXIST, "INI files|*.ini|");
|
||||
|
||||
char cuPath[MAX_PATH];
|
||||
BOOL hidePreview=FALSE;
|
||||
BOOL previewPrinted=FALSE;
|
||||
BOOL hidePreview = FALSE;
|
||||
BOOL previewPrinted = FALSE;
|
||||
GetCurrentDirectory(MAX_PATH, cuPath);
|
||||
dlg.m_ofn.lpstrInitialDir=cuPath;
|
||||
dlg.m_ofn.lpstrInitialDir = cuPath;
|
||||
|
||||
if(theApp.m_Options.TSExe.GetLength()) dlg.m_ofn.lpstrInitialDir=(char*)(LPCTSTR)theApp.m_Options.TSExe;
|
||||
if (theApp.m_Options.TSExe.GetLength()) dlg.m_ofn.lpstrInitialDir = (char*)(LPCTSTR)theApp.m_Options.TSExe;
|
||||
|
||||
if(dlg.DoModal()!=IDCANCEL)
|
||||
{
|
||||
if (dlg.DoModal() != IDCANCEL) {
|
||||
CImportINI impini;
|
||||
impini.m_FileName=dlg.GetPathName();
|
||||
if(impini.DoModal()!=IDCANCEL)
|
||||
{
|
||||
UpdateDialog();
|
||||
impini.m_FileName = dlg.GetPathName();
|
||||
if (impini.DoModal() != IDCANCEL) {
|
||||
UpdateDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue