mirror of
https://github.com/electronicarts/CNC_TS_and_RA2_Mission_Editor.git
synced 2025-04-30 09:01:41 -04:00
Fix: trigger deletion causing mismatched event & action deleted (#114)
* used copied 'triggerId' instead of reference, because it will be deleted and becomes invalid .
This commit is contained in:
parent
11c93c3b3b
commit
f7e3d96881
8 changed files with 15 additions and 1635 deletions
|
@ -659,9 +659,6 @@ void CFinalSunDlg::UpdateDialogs(BOOL bOnlyMissionControl, BOOL bNoRepos)
|
|||
if (m_Scripttypes.m_hWnd) {
|
||||
m_Scripttypes.UpdateDialog();
|
||||
}
|
||||
if (m_triggers.m_hWnd) {
|
||||
m_triggers.UpdateDialog();
|
||||
}
|
||||
if (m_triggereditor.m_hWnd) {
|
||||
m_triggereditor.UpdateDialog();
|
||||
}
|
||||
|
@ -2284,8 +2281,6 @@ void CFinalSunDlg::HideAllDialogs()
|
|||
m_taskforces.ShowWindow(SW_HIDE);
|
||||
if (m_teamtypes)
|
||||
m_teamtypes.ShowWindow(SW_HIDE);
|
||||
if (m_triggers)
|
||||
m_triggers.ShowWindow(SW_HIDE);
|
||||
}
|
||||
|
||||
void CFinalSunDlg::OnFileValidatemap()
|
||||
|
@ -2542,18 +2537,6 @@ void CFinalSunDlg::OnEditTeams()
|
|||
|
||||
void CFinalSunDlg::OnEditTriggers()
|
||||
{
|
||||
if (m_triggers.m_hWnd == NULL) {
|
||||
if (!m_triggers.Create(CTriggers::IDD, NULL)) {
|
||||
MessageBox(GetLanguageStringACP("Err_CreateErr"), "Error");
|
||||
}
|
||||
}
|
||||
|
||||
if (m_triggers.m_hWnd != NULL) {
|
||||
//m_triggers.UpdateStrings();
|
||||
m_triggers.UpdateDialog();
|
||||
m_triggers.ShowWindow(SW_SHOW);
|
||||
Sound(SOUND_POSITIVE);
|
||||
}
|
||||
}
|
||||
|
||||
void CFinalSunDlg::OnSetFocus(CWnd* pOldWnd)
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#define AFX_TIBERIANSUNMISSIONEDITORDLG_H__9F773424_63BB_11D3_99E0_C30F10710B17__INCLUDED_
|
||||
|
||||
#include "ScriptTypes.h"
|
||||
#include "Triggers.h"
|
||||
#include "Houses.h"
|
||||
#include "Basic.h"
|
||||
#include "all.h"
|
||||
|
@ -80,7 +79,6 @@ public:
|
|||
void SaveMap(CString FileName);
|
||||
void SetReady();
|
||||
CScriptTypes m_Scripttypes;
|
||||
CTriggers m_triggers;
|
||||
CTriggerEditorDlg m_triggereditor;
|
||||
CTags m_tags;
|
||||
CTaskForce m_taskforces;
|
||||
|
|
|
@ -220,11 +220,13 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void RemoveByKey(const CString& key) {
|
||||
bool RemoveByKey(const CString& key) {
|
||||
auto const idx = this->FindIndex(key);
|
||||
if (idx >= 0) {
|
||||
RemoveAt(idx);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void RemoveValue(const CString& val) {
|
||||
|
@ -384,10 +386,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void RemoveValueByKey(const CString& section, const CString& key) {
|
||||
bool RemoveValueByKey(const CString& section, const CString& key) {
|
||||
if (auto pSec = this->TryGetSection(section)) {
|
||||
pSec->RemoveByKey(key);
|
||||
return pSec->RemoveByKey(key);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ================= Iterator Related =============================
|
||||
|
|
|
@ -586,7 +586,6 @@
|
|||
<ClCompile Include="TriggerEditorDlg.cpp" />
|
||||
<ClCompile Include="TriggerEventsDlg.cpp" />
|
||||
<ClCompile Include="TriggerOptionsDlg.cpp" />
|
||||
<ClCompile Include="Triggers.cpp" />
|
||||
<ClCompile Include="TSOptions.cpp" />
|
||||
<ClCompile Include="Tube.cpp" />
|
||||
<ClCompile Include="TubeTool.cpp" />
|
||||
|
@ -688,7 +687,6 @@
|
|||
<ClInclude Include="TriggerEditorDlg.h" />
|
||||
<ClInclude Include="TriggerEventsDlg.h" />
|
||||
<ClInclude Include="TriggerOptionsDlg.h" />
|
||||
<ClInclude Include="Triggers.h" />
|
||||
<ClInclude Include="TSOptions.h" />
|
||||
<ClInclude Include="Tube.h" />
|
||||
<ClInclude Include="TubeTool.h" />
|
||||
|
|
|
@ -240,9 +240,6 @@
|
|||
<ClCompile Include="TriggerOptionsDlg.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Triggers.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TSOptions.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -538,9 +535,6 @@
|
|||
<ClInclude Include="TriggerOptionsDlg.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Triggers.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TSOptions.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -215,7 +215,7 @@ void CTriggerEditorDlg::OnDeletetrigger()
|
|||
return;
|
||||
}
|
||||
|
||||
auto const& triggerId = ini["Triggers"].Nth(curtrig).first;
|
||||
auto const triggerId = ini["Triggers"].Nth(curtrig).first;
|
||||
|
||||
if (res == IDYES) {
|
||||
std::vector<CString> keysToDelete;
|
||||
|
@ -230,9 +230,14 @@ void CTriggerEditorDlg::OnDeletetrigger()
|
|||
}
|
||||
}
|
||||
|
||||
ini.RemoveValueByKey("Triggers", triggerId);
|
||||
ini.RemoveValueByKey("Events", triggerId);
|
||||
ini.RemoveValueByKey("Actions", triggerId);
|
||||
bool deleted = false;
|
||||
deleted = ini.RemoveValueByKey("Triggers", triggerId);
|
||||
ASSERT(deleted);
|
||||
deleted = ini.RemoveValueByKey("Events", triggerId);
|
||||
ASSERT(deleted);
|
||||
deleted = ini.RemoveValueByKey("Actions", triggerId);
|
||||
ASSERT(deleted);
|
||||
(void)deleted;
|
||||
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->UpdateDialogs(TRUE);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,140 +0,0 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
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 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/>.
|
||||
*/
|
||||
|
||||
#if !defined(AFX_TRIGGERS_H__1E811180_939D_11D3_B63B_F94AB129C441__INCLUDED_)
|
||||
#define AFX_TRIGGERS_H__1E811180_939D_11D3_B63B_F94AB129C441__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// Triggers.h : Header-Datei
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Dialogfeld CTriggers
|
||||
|
||||
class CTriggers : public CDialog
|
||||
{
|
||||
DECLARE_DYNCREATE(CTriggers)
|
||||
|
||||
// Konstruktion
|
||||
public:
|
||||
void UpdateDialog();
|
||||
CTriggers();
|
||||
~CTriggers();
|
||||
|
||||
// Dialogfelddaten
|
||||
//{{AFX_DATA(CTriggers)
|
||||
enum { IDD = IDD_TRIGGERS };
|
||||
CComboBox m_E2;
|
||||
CComboBox m_E1;
|
||||
CComboBox m_A6;
|
||||
CComboBox m_A5;
|
||||
CComboBox m_A4;
|
||||
CComboBox m_A3;
|
||||
CComboBox m_A2;
|
||||
CComboBox m_A1;
|
||||
CComboBox m_House;
|
||||
CComboBox m_Trigger2;
|
||||
CComboBox m_Trigger;
|
||||
CComboBox m_EventType;
|
||||
CComboBox m_Event;
|
||||
CComboBox m_ActionWaypoint;
|
||||
CComboBox m_ActionType;
|
||||
CComboBox m_Action;
|
||||
CString m_F1;
|
||||
CString m_F2;
|
||||
CString m_F3;
|
||||
CString m_F4;
|
||||
CString m_F5;
|
||||
CString m_LA1;
|
||||
CString m_LA2;
|
||||
CString m_LA3;
|
||||
CString m_LA4;
|
||||
CString m_LA5;
|
||||
CString m_LA6;
|
||||
CString m_LE1;
|
||||
CString m_LE2;
|
||||
CString m_Name;
|
||||
CString m_LAW;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Überschreibungen
|
||||
// Der Klassen-Assistent generiert virtuelle Funktionsüberschreibungen
|
||||
//{{AFX_VIRTUAL(CTriggers)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementierung
|
||||
protected:
|
||||
// Generierte Nachrichtenzuordnungsfunktionen
|
||||
//{{AFX_MSG(CTriggers)
|
||||
afx_msg void OnSelchangeTrigger();
|
||||
afx_msg void OnSelchangeEvent();
|
||||
afx_msg void OnSelchangeAction();
|
||||
afx_msg void OnEditchangeHouse();
|
||||
afx_msg void OnSelchangeHouse();
|
||||
afx_msg void OnChangeName();
|
||||
afx_msg void OnChangeFlag1();
|
||||
afx_msg void OnChangeFlag2();
|
||||
afx_msg void OnChangeFlag3();
|
||||
afx_msg void OnChangeFlag4();
|
||||
afx_msg void OnChangeFlag5();
|
||||
afx_msg void OnEditchangeTrigger2();
|
||||
afx_msg void OnSelchangeTrigger2();
|
||||
afx_msg void OnEditchangeEventtype();
|
||||
afx_msg void OnSelchangeEventtype();
|
||||
afx_msg void OnEditchangeEventparam1();
|
||||
afx_msg void OnSelchangeEventparam1();
|
||||
afx_msg void OnEditchangeEventparam2();
|
||||
afx_msg void OnSelchangeEventparam2();
|
||||
afx_msg void OnEditchangeActiontype();
|
||||
afx_msg void OnSelchangeActiontype();
|
||||
afx_msg void OnEditchangeActionwaypoint();
|
||||
afx_msg void OnSelchangeActionwaypoint();
|
||||
afx_msg void OnEditchangeActionparam1();
|
||||
afx_msg void OnSelchangeActionparam1();
|
||||
afx_msg void OnEditchangeActionparam2();
|
||||
afx_msg void OnSelchangeActionparam2();
|
||||
afx_msg void OnEditchangeActionparam3();
|
||||
afx_msg void OnSelchangeActionparam3();
|
||||
afx_msg void OnEditchangeActionparam4();
|
||||
afx_msg void OnSelchangeActionparam4();
|
||||
afx_msg void OnEditchangeActionparam5();
|
||||
afx_msg void OnSelchangeActionparam5();
|
||||
afx_msg void OnEditchangeActionparam6();
|
||||
afx_msg void OnSelchangeActionparam6();
|
||||
afx_msg void OnAddevent();
|
||||
afx_msg void OnDeleteevent();
|
||||
afx_msg void OnAddaction();
|
||||
afx_msg void OnDeleteaction();
|
||||
afx_msg void OnDeletetrigger();
|
||||
afx_msg void OnAddtrigger();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ fügt unmittelbar vor der vorhergehenden Zeile zusätzliche Deklarationen ein.
|
||||
|
||||
#endif // AFX_TRIGGERS_H__1E811180_939D_11D3_B63B_F94AB129C441__INCLUDED_
|
Loading…
Add table
Reference in a new issue