Added function to get sectionID for a specified section name, returning -1 if section name not registered.
This commit is contained in:
parent
50fbe5d00c
commit
1a9ef29ac5
|
@ -885,6 +885,15 @@ void SaveManager::AddPostFunction(const std::string& name, PostFunc func) {
|
||||||
postHandlers[name] = func;
|
postHandlers[name] = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns -1 if section name not found
|
||||||
|
int SaveManager::GetSaveSectionID(std::string& sectionName) {
|
||||||
|
if (sectionRegistry.contains(sectionName)) {
|
||||||
|
return sectionRegistry.find(sectionName)->second;
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SaveManager::CreateDefaultGlobal() {
|
void SaveManager::CreateDefaultGlobal() {
|
||||||
gSaveContext.audioSetting = 0;
|
gSaveContext.audioSetting = 0;
|
||||||
gSaveContext.zTargetSetting = 0;
|
gSaveContext.zTargetSetting = 0;
|
||||||
|
|
|
@ -65,6 +65,7 @@ public:
|
||||||
void InitFile(bool isDebug);
|
void InitFile(bool isDebug);
|
||||||
void SaveFile(int fileNum);
|
void SaveFile(int fileNum);
|
||||||
void SaveSection(int fileNum, int sectionID);
|
void SaveSection(int fileNum, int sectionID);
|
||||||
|
int GetSaveSectionID(std::string& name);
|
||||||
void SaveGlobal();
|
void SaveGlobal();
|
||||||
void LoadFile(int fileNum);
|
void LoadFile(int fileNum);
|
||||||
bool SaveFile_Exist(int fileNum);
|
bool SaveFile_Exist(int fileNum);
|
||||||
|
@ -162,7 +163,7 @@ public:
|
||||||
int sectionIndex = SECTION_ID_MAX;
|
int sectionIndex = SECTION_ID_MAX;
|
||||||
std::map<std::string, int> coreSectionIDsByName;
|
std::map<std::string, int> coreSectionIDsByName;
|
||||||
std::map<int, SaveFuncInfo> sectionSaveHandlers;
|
std::map<int, SaveFuncInfo> sectionSaveHandlers;
|
||||||
std::set<std::string> sectionRegistry;
|
std::map<std::string, int> sectionRegistry;
|
||||||
|
|
||||||
std::map<std::string, PostFunc> postHandlers;
|
std::map<std::string, PostFunc> postHandlers;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue