mirror of
https://github.com/electronicarts/CNC_TS_and_RA2_Mission_Editor.git
synced 2025-05-05 03:01:42 -04:00
fixed #22, corrected GetFreeID refactor logic issue .
This commit is contained in:
parent
4536636f13
commit
12914b8303
1 changed files with 22 additions and 6 deletions
|
@ -1268,24 +1268,40 @@ CString GetFreeID()
|
|||
int n = 1000000;
|
||||
|
||||
auto isIDInUse = [&ini](const CString& input) {
|
||||
static const CString typeListSections[] = {
|
||||
// [TypeList]
|
||||
// 0=TYPE1
|
||||
// 1=TYPE2
|
||||
static const CString typeLists[] = {
|
||||
"ScriptTypes",
|
||||
"TaskForces",
|
||||
"TeamTypes",
|
||||
};
|
||||
static const CString idListSections[] = {
|
||||
// [ItemList]
|
||||
// ID1=SOME_DEFINITION1
|
||||
// ID2=SOME_DEFINITION2
|
||||
static const CString itemLists[] = {
|
||||
"Triggers",
|
||||
"Events",
|
||||
"Tags",
|
||||
"Actions",
|
||||
"AITriggerTypes",
|
||||
};
|
||||
if (std::find(std::begin(typeListSections), std::end(typeListSections), input) != std::end(typeListSections)) {
|
||||
return true;
|
||||
|
||||
for (auto const& id : typeLists) {
|
||||
for (auto const& [_, id] : ini[id]) {
|
||||
if (id == input) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (std::find(std::begin(idListSections), std::end(idListSections), input) != std::end(idListSections)) {
|
||||
return true;
|
||||
for (auto const& id : itemLists) {
|
||||
for (auto const& [id, _] : ini[id]) {
|
||||
if (id == input) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue