mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Clean up localization mgr lookups and add some missing mnemonics
This commit is contained in:
@ -691,11 +691,14 @@ bool pfLocalizationDataMgr::pf3PartMap<mapT>::exists(const plString & key)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// now check individually
|
// now check individually
|
||||||
if (fData.find(age) == fData.end()) // age doesn't exist
|
auto curAge = fData.find(age);
|
||||||
|
if (curAge == fData.end()) // age doesn't exist
|
||||||
return false;
|
return false;
|
||||||
if (fData[age].find(set) == fData[age].end()) // set doesn't exist
|
auto curSet = curAge->second.find(set);
|
||||||
|
if (curSet == curAge->second.end()) // set doesn't exist
|
||||||
return false;
|
return false;
|
||||||
if (fData[age][set].find(name) == fData[age][set].end()) // name doesn't exist
|
auto curElement = curSet->second.find(name);
|
||||||
|
if (curElement == curSet->second.end()) // name doesn't exist
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// we passed all the tests, return true!
|
// we passed all the tests, return true!
|
||||||
@ -713,9 +716,11 @@ bool pfLocalizationDataMgr::pf3PartMap<mapT>::setExists(const plString & key)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// now check individually
|
// now check individually
|
||||||
if (fData.find(age) == fData.end()) // age doesn't exist
|
auto curAge = fData.find(age);
|
||||||
|
if (curAge == fData.end()) // age doesn't exist
|
||||||
return false;
|
return false;
|
||||||
if (fData[age].find(set) == fData[age].end()) // set doesn't exist
|
auto curSet = curAge->second.find(set);
|
||||||
|
if (curSet == curAge->second.end()) // set doesn't exist
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// we passed all the tests, return true!
|
// we passed all the tests, return true!
|
||||||
@ -733,19 +738,22 @@ void pfLocalizationDataMgr::pf3PartMap<mapT>::erase(const plString & key)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// now check individually
|
// now check individually
|
||||||
if (fData.find(age) == fData.end()) // age doesn't exist
|
auto curAge = fData.find(age);
|
||||||
|
if (curAge == fData.end()) // age doesn't exist
|
||||||
return;
|
return;
|
||||||
if (fData[age].find(set) == fData[age].end()) // set doesn't exist
|
auto curSet = curAge->second.find(set);
|
||||||
|
if (curSet == curAge->second.end()) // set doesn't exist
|
||||||
return;
|
return;
|
||||||
if (fData[age][set].find(name) == fData[age][set].end()) // name doesn't exist
|
auto curElement = curSet->second.find(name);
|
||||||
|
if (curElement == curSet->second.end()) // name doesn't exist
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// ok, so now we want to nuke it!
|
// ok, so now we want to nuke it!
|
||||||
fData[age][set].erase(name);
|
curSet->second.erase(name);
|
||||||
if (fData[age][set].size() == 0) // is the set now empty?
|
if (curSet->second.size() == 0) // is the set now empty?
|
||||||
fData[age].erase(set); // nuke it!
|
curAge->second.erase(curSet); // nuke it!
|
||||||
if (fData[age].size() == 0) // is the age now empty?
|
if (curAge->second.size() == 0) // is the age now empty?
|
||||||
fData.erase(age); // nuke it!
|
fData.erase(curAge); // nuke it!
|
||||||
}
|
}
|
||||||
|
|
||||||
//// operator[]() ////////////////////////////////////////////////////
|
//// operator[]() ////////////////////////////////////////////////////
|
||||||
@ -780,10 +788,11 @@ std::vector<plString> pfLocalizationDataMgr::pf3PartMap<mapT>::getSetList(const
|
|||||||
std::vector<plString> retVal;
|
std::vector<plString> retVal;
|
||||||
typename std::map<plString, std::map<plString, mapT> >::iterator curSet;
|
typename std::map<plString, std::map<plString, mapT> >::iterator curSet;
|
||||||
|
|
||||||
if (fData.find(age) == fData.end())
|
auto curAge = fData.find(age);
|
||||||
|
if (curAge == fData.end())
|
||||||
return retVal; // return an empty list, the age doesn't exist
|
return retVal; // return an empty list, the age doesn't exist
|
||||||
|
|
||||||
for (curSet = fData[age].begin(); curSet != fData[age].end(); curSet++)
|
for (curSet = curAge->second.begin(); curSet != curAge->second.end(); curSet++)
|
||||||
retVal.push_back(curSet->first);
|
retVal.push_back(curSet->first);
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
@ -797,13 +806,15 @@ std::vector<plString> pfLocalizationDataMgr::pf3PartMap<mapT>::getNameList(const
|
|||||||
std::vector<plString> retVal;
|
std::vector<plString> retVal;
|
||||||
typename std::map<plString, mapT>::iterator curName;
|
typename std::map<plString, mapT>::iterator curName;
|
||||||
|
|
||||||
if (fData.find(age) == fData.end())
|
auto curAge = fData.find(age);
|
||||||
|
if (curAge == fData.end())
|
||||||
return retVal; // return an empty list, the age doesn't exist
|
return retVal; // return an empty list, the age doesn't exist
|
||||||
|
|
||||||
if (fData[age].find(set) == fData[age].end())
|
auto curSet = curAge->second.find(set);
|
||||||
|
if (curSet == curAge->second.end())
|
||||||
return retVal; // return an empty list, the set doesn't exist
|
return retVal; // return an empty list, the set doesn't exist
|
||||||
|
|
||||||
for (curName = fData[age][set].begin(); curName != fData[age][set].end(); curName++)
|
for (curName = curSet->second.begin(); curName != curSet->second.end(); curName++)
|
||||||
retVal.push_back(curName->first);
|
retVal.push_back(curName->first);
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
|
@ -127,7 +127,7 @@ void EditDialog::LoadLocalization(const plString &locPath)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
fCurrentLocPath = locPath;
|
fCurrentLocPath = locPath;
|
||||||
fUI->fTextPathLabel->setText(QString("Text (%1):").arg(locPath.c_str()));
|
fUI->fTextPathLabel->setText(QString("&Text (%1):").arg(locPath.c_str()));
|
||||||
|
|
||||||
plString ageName, setName, elementName, elementLanguage;
|
plString ageName, setName, elementName, elementLanguage;
|
||||||
SplitLocalizationPath(locPath, ageName, setName, elementName, elementLanguage);
|
SplitLocalizationPath(locPath, ageName, setName, elementName, elementLanguage);
|
||||||
@ -147,9 +147,9 @@ void EditDialog::LoadLocalization(const plString &locPath)
|
|||||||
if (!elementLanguage.IsEmpty()) // they have selected a language
|
if (!elementLanguage.IsEmpty()) // they have selected a language
|
||||||
{
|
{
|
||||||
fEditMode = kEditLocalization;
|
fEditMode = kEditLocalization;
|
||||||
fUI->fAddButton->setText(tr("Add Localization"));
|
fUI->fAddButton->setText(tr("&Add Localization"));
|
||||||
fUI->fAddButton->setEnabled(true);
|
fUI->fAddButton->setEnabled(true);
|
||||||
fUI->fDeleteButton->setText(tr("Delete Localization"));
|
fUI->fDeleteButton->setText(tr("&Delete Localization"));
|
||||||
|
|
||||||
// don't allow them to delete the default language
|
// don't allow them to delete the default language
|
||||||
fUI->fDeleteButton->setEnabled(elementLanguage != "English");
|
fUI->fDeleteButton->setEnabled(elementLanguage != "English");
|
||||||
@ -157,9 +157,9 @@ void EditDialog::LoadLocalization(const plString &locPath)
|
|||||||
else // they have selected something else
|
else // they have selected something else
|
||||||
{
|
{
|
||||||
fEditMode = kEditElement;
|
fEditMode = kEditElement;
|
||||||
fUI->fAddButton->setText(tr("Add Element"));
|
fUI->fAddButton->setText(tr("&Add Element"));
|
||||||
fUI->fAddButton->setEnabled(true);
|
fUI->fAddButton->setEnabled(true);
|
||||||
fUI->fDeleteButton->setText(tr("Delete Element"));
|
fUI->fDeleteButton->setText(tr("&Delete Element"));
|
||||||
if (!elementName.IsEmpty()) // they have selected an individual element
|
if (!elementName.IsEmpty()) // they have selected an individual element
|
||||||
{
|
{
|
||||||
std::vector<plString> elementNames = pfLocalizationDataMgr::Instance().GetElementList(ageName, setName);
|
std::vector<plString> elementNames = pfLocalizationDataMgr::Instance().GetElementList(ageName, setName);
|
||||||
|
Reference in New Issue
Block a user