#33 fixed, taskforce delete should be normal now .

This commit is contained in:
Zero Fanker 2024-06-06 00:16:38 -04:00
parent 9cddabbb3a
commit 5cb110d9e5
2 changed files with 25 additions and 15 deletions

View file

@ -324,6 +324,12 @@ public:
this->SetString(section, key, INIHelper::ToString(value));
}
void RemoveValue(const CString& section, const CString& value) {
if (auto pSec = this->TryGetSection(section)) {
pSec->RemoveValue(value);
}
}
void RemoveValueByKey(const CString& section, const CString& key) {
if (auto pSec = this->TryGetSection(section)) {
pSec->RemoveByKey(key);

View file

@ -181,22 +181,26 @@ void CTaskForce::OnSelchangeTaskforces()
int i;
while (m_Units.DeleteString(0) != LB_ERR);
for (i = 0; i < sec.Size() - 2; i++) {
char p[50];
itoa(i, p, 10);
auto const& data = sec.GetString(p);
CString type = GetParam(data, 1);
CString s = GetParam(data, 0);
s += " ";
/*if(ini.sections.find((char*)(LPCTSTR)type)!=ini.sections.end() && ini.sections[(char*)(LPCTSTR)type].values.find("Name")!=ini.sections[(char*)(LPCTSTR)type].values.end())
s+=ini.sections[(char*)(LPCTSTR)type].values["Name"];
else
s+=rules.sections[(char*)(LPCTSTR)type].values["Name"];*/
s += Map->GetUnitName(type);
//s+=")";
m_Units.SetItemData(m_Units.AddString(s), i);
if (sec.Size()) {
for (i = 0; i < sec.Size() - 2; i++) {
char p[50];
itoa(i, p, 10);
auto const& data = sec.GetString(p);
CString type = GetParam(data, 1);
CString s = GetParam(data, 0);
s += " ";
/*if(ini.sections.find((char*)(LPCTSTR)type)!=ini.sections.end() && ini.sections[(char*)(LPCTSTR)type].values.find("Name")!=ini.sections[(char*)(LPCTSTR)type].values.end())
s+=ini.sections[(char*)(LPCTSTR)type].values["Name"];
else
s+=rules.sections[(char*)(LPCTSTR)type].values["Name"];*/
s += Map->GetUnitName(type);
//s+=")";
m_Units.SetItemData(m_Units.AddString(s), i);
}
}
UpdateData(FALSE);
if (m_Units.SetCurSel(0) != LB_ERR) {
@ -426,7 +430,7 @@ void CTaskForce::OnDeletetaskforce()
return;
}
ini.RemoveValueByKey("TaskForces", tf);
ini.RemoveValue("TaskForces", tf);
ini.DeleteSection(tf);
while (m_Units.DeleteString(0) != LB_ERR);
//UpdateDialog();