diff --git a/src/engine/shared/datafile.cpp b/src/engine/shared/datafile.cpp index c0f668487..c0c08c5dc 100644 --- a/src/engine/shared/datafile.cpp +++ b/src/engine/shared/datafile.cpp @@ -611,7 +611,7 @@ int CDataFileWriter::GetExtendedItemTypeIndex(int Type) return Index; } -int CDataFileWriter::AddItem(int Type, int ID, int Size, void *pData) +int CDataFileWriter::AddItem(int Type, int ID, int Size, const void *pData) { dbg_assert((Type >= 0 && Type < MAX_ITEM_TYPES) || Type >= OFFSET_UUID, "incorrect type"); dbg_assert(m_NumItems < 1024, "too many items"); @@ -650,7 +650,7 @@ int CDataFileWriter::AddItem(int Type, int ID, int Size, void *pData) return m_NumItems - 1; } -int CDataFileWriter::AddData(int Size, void *pData, int CompressionLevel) +int CDataFileWriter::AddData(int Size, const void *pData, int CompressionLevel) { dbg_assert(m_NumDatas < 1024, "too much data"); @@ -666,7 +666,7 @@ int CDataFileWriter::AddData(int Size, void *pData, int CompressionLevel) return m_NumDatas - 1; } -int CDataFileWriter::AddDataSwapped(int Size, void *pData) +int CDataFileWriter::AddDataSwapped(int Size, const void *pData) { dbg_assert(Size % sizeof(int) == 0, "incorrect boundary"); diff --git a/src/engine/shared/datafile.h b/src/engine/shared/datafile.h index abc5af217..c55f1fccf 100644 --- a/src/engine/shared/datafile.h +++ b/src/engine/shared/datafile.h @@ -126,9 +126,9 @@ public: void Init(); bool OpenFile(class IStorage *pStorage, const char *pFilename, int StorageType = IStorage::TYPE_SAVE); bool Open(class IStorage *pStorage, const char *pFilename, int StorageType = IStorage::TYPE_SAVE); - int AddData(int Size, void *pData, int CompressionLevel = Z_DEFAULT_COMPRESSION); - int AddDataSwapped(int Size, void *pData); - int AddItem(int Type, int ID, int Size, void *pData); + int AddData(int Size, const void *pData, int CompressionLevel = Z_DEFAULT_COMPRESSION); + int AddDataSwapped(int Size, const void *pData); + int AddItem(int Type, int ID, int Size, const void *pData); void Finish(); }; diff --git a/src/game/editor/io.cpp b/src/game/editor/io.cpp index f7ea4dac9..bf7539111 100644 --- a/src/game/editor/io.cpp +++ b/src/game/editor/io.cpp @@ -192,7 +192,7 @@ bool CEditorMap::Save(const char *pFileName) GItemEx.m_Version = CMapItemGroupEx::CURRENT_VERSION; GItemEx.m_ParallaxZoom = pGroup->m_ParallaxZoom; - for(const auto &pLayer : pGroup->m_vpLayers) + for(CLayer *pLayer : pGroup->m_vpLayers) { if(pLayer->m_Type == LAYERTYPE_TILES) { diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index e2b92ccbc..c95ab3407 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -3785,7 +3785,7 @@ void CGameContext::OnMapChange(char *pNewMapName, int MapNameSize) Writer.AddData(TotalLength, pSettings); continue; } - unsigned char *pData = (unsigned char *)Reader.GetData(i); + const void *pData = Reader.GetData(i); int Size = Reader.GetDataSize(i); Writer.AddData(Size, pData); Reader.UnloadData(i); diff --git a/src/tools/map_resave.cpp b/src/tools/map_resave.cpp index fbb65b482..1f6698828 100644 --- a/src/tools/map_resave.cpp +++ b/src/tools/map_resave.cpp @@ -24,7 +24,7 @@ int main(int argc, const char **argv) for(int Index = 0; Index < Reader.NumItems(); Index++) { int Type, ID; - void *pPtr = Reader.GetItem(Index, &Type, &ID); + const void *pPtr = Reader.GetItem(Index, &Type, &ID); // filter ITEMTYPE_EX items, they will be automatically added again if(Type == ITEMTYPE_EX) @@ -37,7 +37,7 @@ int main(int argc, const char **argv) // add all data for(int Index = 0; Index < Reader.NumData(); Index++) { - void *pPtr = Reader.GetData(Index); + const void *pPtr = Reader.GetData(Index); int Size = Reader.GetDataSize(Index); Writer.AddData(Size, pPtr); }