diff --git a/src/tools/config_store.cpp b/src/tools/config_store.cpp index fa9a3bba0..9a6f2eb3c 100644 --- a/src/tools/config_store.cpp +++ b/src/tools/config_store.cpp @@ -9,8 +9,6 @@ void Process(IStorage *pStorage, const char *pMapName, const char *pConfigName) { IOHANDLE File = pStorage->OpenFile(pConfigName, IOFLAG_READ | IOFLAG_SKIP_BOM, IStorage::TYPE_ABSOLUTE); - std::vector vLines; - char *pSettings = NULL; if(!File) { dbg_msg("config_store", "config '%s' not found", pConfigName); @@ -22,6 +20,7 @@ void Process(IStorage *pStorage, const char *pMapName, const char *pConfigName) char *pLine; int TotalLength = 0; + std::vector vLines; while((pLine = LineReader.Get())) { int Length = str_length(pLine) + 1; @@ -32,7 +31,7 @@ void Process(IStorage *pStorage, const char *pMapName, const char *pConfigName) } io_close(File); - pSettings = (char *)malloc(maximum(1, TotalLength)); + char *pSettings = (char *)malloc(maximum(1, TotalLength)); int Offset = 0; for(auto &Line : vLines) { @@ -52,19 +51,18 @@ void Process(IStorage *pStorage, const char *pMapName, const char *pConfigName) bool FoundInfo = false; for(int i = 0; i < Reader.NumItems(); i++) { - int TypeID; - int ItemID; - int *pData = (int *)Reader.GetItem(i, &TypeID, &ItemID); + int Type, ID; + int *pItem = (int *)Reader.GetItem(i, &Type, &ID); int Size = Reader.GetItemSize(i); CMapItemInfoSettings MapInfo; - if(TypeID == MAPITEMTYPE_INFO && ItemID == 0) + if(Type == MAPITEMTYPE_INFO && ID == 0) { FoundInfo = true; - CMapItemInfoSettings *pInfo = (CMapItemInfoSettings *)pData; + CMapItemInfoSettings *pInfo = (CMapItemInfoSettings *)pItem; if(Size >= (int)sizeof(CMapItemInfoSettings)) { MapInfo = *pInfo; - pData = (int *)&MapInfo; + pItem = (int *)&MapInfo; Size = sizeof(MapInfo); if(pInfo->m_Settings > -1) { @@ -83,7 +81,7 @@ void Process(IStorage *pStorage, const char *pMapName, const char *pConfigName) { MapInfo = *pInfo; MapInfo.m_Settings = SettingsIndex; - pData = (int *)&MapInfo; + pItem = (int *)&MapInfo; Size = sizeof(MapInfo); } } @@ -91,11 +89,11 @@ void Process(IStorage *pStorage, const char *pMapName, const char *pConfigName) { *(CMapItemInfo *)&MapInfo = *(CMapItemInfo *)pInfo; MapInfo.m_Settings = SettingsIndex; - pData = (int *)&MapInfo; + pItem = (int *)&MapInfo; Size = sizeof(MapInfo); } } - Writer.AddItem(TypeID, ItemID, Size, pData); + Writer.AddItem(Type, ID, Size, pItem); } if(!FoundInfo)