From e86c62b4a6bb0a2eeb145da770981c93670ecd03 Mon Sep 17 00:00:00 2001 From: Daniel Stevens Date: Tue, 18 Nov 2025 17:51:57 -0700 Subject: [PATCH 1/8] Add `#pragma once` to header files --- CClmReader.h | 1 + CClmWriter.h | 1 + CFileStreamReader.h | 1 + CFileStreamWriter.h | 1 + CMapFile.h | 1 + CMemoryStreamReader.h | 1 + CResourceManager.h | 1 + CResourceManagerFactory.h | 1 + CTileGroup.h | 1 + CTileSet.h | 1 + CTileSetManager.h | 1 + CTileSetSource.h | 1 + CVolReader.h | 1 + CVolWriter.h | 1 + GlobalFunctions.h | 1 + 15 files changed, 15 insertions(+) diff --git a/CClmReader.h b/CClmReader.h index 7fb2d92..0f4d89f 100644 --- a/CClmReader.h +++ b/CClmReader.h @@ -1,3 +1,4 @@ +#pragma once #include "OP2Editor.h" diff --git a/CClmWriter.h b/CClmWriter.h index 659438d..a49c195 100644 --- a/CClmWriter.h +++ b/CClmWriter.h @@ -1,3 +1,4 @@ +#pragma once #include "OP2Editor.h" diff --git a/CFileStreamReader.h b/CFileStreamReader.h index 9048125..1dcff46 100644 --- a/CFileStreamReader.h +++ b/CFileStreamReader.h @@ -1,3 +1,4 @@ +#pragma once #include "OP2Editor.h" diff --git a/CFileStreamWriter.h b/CFileStreamWriter.h index 43ef54c..e9c4f38 100644 --- a/CFileStreamWriter.h +++ b/CFileStreamWriter.h @@ -1,3 +1,4 @@ +#pragma once #include "OP2Editor.h" diff --git a/CMapFile.h b/CMapFile.h index ca9f2e5..473d5f2 100644 --- a/CMapFile.h +++ b/CMapFile.h @@ -1,3 +1,4 @@ +#pragma once #include "OP2Editor.h" #include "CTileGroup.h" diff --git a/CMemoryStreamReader.h b/CMemoryStreamReader.h index c849405..0731c75 100644 --- a/CMemoryStreamReader.h +++ b/CMemoryStreamReader.h @@ -1,3 +1,4 @@ +#pragma once #include "OP2Editor.h" diff --git a/CResourceManager.h b/CResourceManager.h index 30dfe8f..0f77df6 100644 --- a/CResourceManager.h +++ b/CResourceManager.h @@ -1,3 +1,4 @@ +#pragma once #include "OP2Editor.h" #include "CTileSetSource.h" diff --git a/CResourceManagerFactory.h b/CResourceManagerFactory.h index 43e659a..8e47d21 100644 --- a/CResourceManagerFactory.h +++ b/CResourceManagerFactory.h @@ -1,3 +1,4 @@ +#pragma once extern int g_cLocks; diff --git a/CTileGroup.h b/CTileGroup.h index 555fbd2..213ca7c 100644 --- a/CTileGroup.h +++ b/CTileGroup.h @@ -1,3 +1,4 @@ +#pragma once #include "OP2Editor.h" diff --git a/CTileSet.h b/CTileSet.h index 91a3211..43fbaf4 100644 --- a/CTileSet.h +++ b/CTileSet.h @@ -1,3 +1,4 @@ +#pragma once #include "OP2Editor.h" diff --git a/CTileSetManager.h b/CTileSetManager.h index d28cbb9..76dfe9c 100644 --- a/CTileSetManager.h +++ b/CTileSetManager.h @@ -1,3 +1,4 @@ +#pragma once class CTileSetManager : public TileSetManager, public ISupportErrorInfo diff --git a/CTileSetSource.h b/CTileSetSource.h index a63fc27..d2fa403 100644 --- a/CTileSetSource.h +++ b/CTileSetSource.h @@ -1,3 +1,4 @@ +#pragma once #include "OP2Editor.h" #include "CTileSet.h" diff --git a/CVolReader.h b/CVolReader.h index dbc09a8..a1f2353 100644 --- a/CVolReader.h +++ b/CVolReader.h @@ -1,3 +1,4 @@ +#pragma once #include "OP2Editor.h" diff --git a/CVolWriter.h b/CVolWriter.h index 97aab65..6c8cf3c 100644 --- a/CVolWriter.h +++ b/CVolWriter.h @@ -1,3 +1,4 @@ +#pragma once #include "OP2Editor.h" diff --git a/GlobalFunctions.h b/GlobalFunctions.h index 74a0c17..6f08d8a 100644 --- a/GlobalFunctions.h +++ b/GlobalFunctions.h @@ -1,3 +1,4 @@ +#pragma once From 8ea69976da5d9acddeae8870dea35d4fda50738c Mon Sep 17 00:00:00 2001 From: Daniel Stevens Date: Tue, 18 Nov 2025 17:52:44 -0700 Subject: [PATCH 2/8] Adjust blank lines around header includes for consistency --- CTileGroup.h | 1 - CTileSetSource.h | 1 + GlobalFunctions.h | 2 -- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/CTileGroup.h b/CTileGroup.h index 213ca7c..4904652 100644 --- a/CTileGroup.h +++ b/CTileGroup.h @@ -1,6 +1,5 @@ #pragma once - #include "OP2Editor.h" #include "CTileSetManager.h" diff --git a/CTileSetSource.h b/CTileSetSource.h index d2fa403..fbdd216 100644 --- a/CTileSetSource.h +++ b/CTileSetSource.h @@ -3,6 +3,7 @@ #include "OP2Editor.h" #include "CTileSet.h" + class CTileSetSource : public TileSetSource { public: diff --git a/GlobalFunctions.h b/GlobalFunctions.h index 6f08d8a..e15155d 100644 --- a/GlobalFunctions.h +++ b/GlobalFunctions.h @@ -1,8 +1,6 @@ #pragma once - - void PostErrorMsg(WCHAR *errorMsg); bool IsRelative(BSTR path); int RoundUpPowerOf2(int num); From 12c7730cb985be2a769a8ba4d6d7e8f510c619c9 Mon Sep 17 00:00:00 2001 From: Daniel Stevens Date: Tue, 18 Nov 2025 17:56:56 -0700 Subject: [PATCH 3/8] Adjust blank lines around includes in source files for consistency --- CClmReader.cpp | 1 - CClmWriter.cpp | 1 - CFileStreamReader.cpp | 1 - CFileStreamWriter.cpp | 1 - CMapFile.cpp | 2 -- CMemoryStreamReader.cpp | 1 - CResourceManager.cpp | 1 - CResourceManagerFactory.cpp | 2 -- CTileGroup.cpp | 1 - CTileSetManager.cpp | 1 - CTileSetSource.cpp | 1 - CVolReader.cpp | 1 - CVolWriter.cpp | 1 - GlobalFunctions.cpp | 2 -- 14 files changed, 17 deletions(-) diff --git a/CClmReader.cpp b/CClmReader.cpp index 9c72e97..857db0e 100644 --- a/CClmReader.cpp +++ b/CClmReader.cpp @@ -1,4 +1,3 @@ - #include "stdafx.h" #include "CClmReader.h" #include "CMemoryStreamReader.h" diff --git a/CClmWriter.cpp b/CClmWriter.cpp index 7e23a66..2481816 100644 --- a/CClmWriter.cpp +++ b/CClmWriter.cpp @@ -1,4 +1,3 @@ - #include "stdafx.h" #include "CClmWriter.h" diff --git a/CFileStreamReader.cpp b/CFileStreamReader.cpp index c9f956d..a7867a9 100644 --- a/CFileStreamReader.cpp +++ b/CFileStreamReader.cpp @@ -1,4 +1,3 @@ - #include "stdafx.h" #include "CFileStreamReader.h" diff --git a/CFileStreamWriter.cpp b/CFileStreamWriter.cpp index 81ca6bc..8a643f3 100644 --- a/CFileStreamWriter.cpp +++ b/CFileStreamWriter.cpp @@ -1,4 +1,3 @@ - #include "stdafx.h" #include "CFileStreamWriter.h" diff --git a/CMapFile.cpp b/CMapFile.cpp index 7e39559..7693fec 100644 --- a/CMapFile.cpp +++ b/CMapFile.cpp @@ -1,5 +1,3 @@ - - #include "stdafx.h" #include "CMapFile.h" #include "GlobalFunctions.h" diff --git a/CMemoryStreamReader.cpp b/CMemoryStreamReader.cpp index d3b21ae..a91894e 100644 --- a/CMemoryStreamReader.cpp +++ b/CMemoryStreamReader.cpp @@ -1,4 +1,3 @@ - #include "stdafx.h" #include "CMemoryStreamReader.h" diff --git a/CResourceManager.cpp b/CResourceManager.cpp index d9980ed..0cecc94 100644 --- a/CResourceManager.cpp +++ b/CResourceManager.cpp @@ -1,4 +1,3 @@ - #include "stdafx.h" #include "CResourceManager.h" #include "CFileStreamReader.h" diff --git a/CResourceManagerFactory.cpp b/CResourceManagerFactory.cpp index f06c686..3cdae93 100644 --- a/CResourceManagerFactory.cpp +++ b/CResourceManagerFactory.cpp @@ -1,10 +1,8 @@ - #include "stdafx.h" #include "CResourceManagerFactory.h" #include "CResourceManager.h" - ULONG CResourceManagerFactory::AddRef() { return ++m_cRef; diff --git a/CTileGroup.cpp b/CTileGroup.cpp index f1480b6..872cc84 100644 --- a/CTileGroup.cpp +++ b/CTileGroup.cpp @@ -1,4 +1,3 @@ - #include "stdafx.h" #include "CTileGroup.h" #include "GlobalFunctions.h" diff --git a/CTileSetManager.cpp b/CTileSetManager.cpp index 9e18b3d..c9a3b1f 100644 --- a/CTileSetManager.cpp +++ b/CTileSetManager.cpp @@ -1,4 +1,3 @@ - #include "stdafx.h" #include "OP2Editor.h" #include "CTileSetManager.h" diff --git a/CTileSetSource.cpp b/CTileSetSource.cpp index 8a70efa..c0304d3 100644 --- a/CTileSetSource.cpp +++ b/CTileSetSource.cpp @@ -1,4 +1,3 @@ - #include "stdafx.h" #include "CTileSetSource.h" diff --git a/CVolReader.cpp b/CVolReader.cpp index c75cf67..f480aaa 100644 --- a/CVolReader.cpp +++ b/CVolReader.cpp @@ -1,4 +1,3 @@ - #include "stdafx.h" #include "CVolReader.h" #include "CMemoryStreamReader.h" diff --git a/CVolWriter.cpp b/CVolWriter.cpp index 12c8568..cbc3539 100644 --- a/CVolWriter.cpp +++ b/CVolWriter.cpp @@ -1,4 +1,3 @@ - #include "stdafx.h" #include "CVolWriter.h" diff --git a/GlobalFunctions.cpp b/GlobalFunctions.cpp index 6507bad..8bc5c83 100644 --- a/GlobalFunctions.cpp +++ b/GlobalFunctions.cpp @@ -1,9 +1,7 @@ - #include "stdafx.h" #include "GlobalFunctions.h" - void PostErrorMsg(WCHAR *errorMsg) { // Provide rich error information From 48f31386728adddad195e0e03067c7f7706cb7ea Mon Sep 17 00:00:00 2001 From: Daniel Stevens Date: Tue, 18 Nov 2025 18:02:45 -0700 Subject: [PATCH 4/8] Adjust blank lines between source code sections --- CClmReader.cpp | 3 --- CClmWriter.cpp | 1 - CFileStreamReader.cpp | 3 --- CFileStreamWriter.cpp | 2 -- CMapFile.cpp | 7 ------- CMemoryStreamReader.cpp | 1 - CResourceManager.cpp | 15 --------------- CResourceManagerFactory.cpp | 1 - CTileGroup.cpp | 1 - CTileSet.cpp | 3 --- CTileSetSource.cpp | 2 -- CVolReader.cpp | 1 - CVolWriter.cpp | 1 - 13 files changed, 41 deletions(-) diff --git a/CClmReader.cpp b/CClmReader.cpp index 857db0e..4b7042f 100644 --- a/CClmReader.cpp +++ b/CClmReader.cpp @@ -40,7 +40,6 @@ HRESULT __stdcall CClmReader::QueryInterface(REFIID riid, void** ppv) } - // ArchiveReader // ************* @@ -141,8 +140,6 @@ HRESULT CClmReader::OpenStreamRead(BSTR fileName, StreamReader **stream) } - - // Class specific // ************** diff --git a/CClmWriter.cpp b/CClmWriter.cpp index 2481816..d92a49d 100644 --- a/CClmWriter.cpp +++ b/CClmWriter.cpp @@ -38,7 +38,6 @@ HRESULT __stdcall CClmWriter::QueryInterface(REFIID riid, void** ppv) } - // ArchiveWriter // ************* diff --git a/CFileStreamReader.cpp b/CFileStreamReader.cpp index a7867a9..dadfeb8 100644 --- a/CFileStreamReader.cpp +++ b/CFileStreamReader.cpp @@ -40,7 +40,6 @@ HRESULT __stdcall CFileStreamReader::QueryInterface(REFIID riid, void** ppv) } - // StreamReader // ************ @@ -105,8 +104,6 @@ HRESULT CFileStreamReader::Seek(int offset) } - - // Class specific // ************** diff --git a/CFileStreamWriter.cpp b/CFileStreamWriter.cpp index 8a643f3..1bf8fc1 100644 --- a/CFileStreamWriter.cpp +++ b/CFileStreamWriter.cpp @@ -38,8 +38,6 @@ HRESULT __stdcall CFileStreamWriter::QueryInterface(REFIID riid, void** ppv) } - - CFileStreamWriter::CFileStreamWriter(BSTR fileName) : m_cRef(1) { // Initialize class variables diff --git a/CMapFile.cpp b/CMapFile.cpp index 7693fec..cee4902 100644 --- a/CMapFile.cpp +++ b/CMapFile.cpp @@ -164,7 +164,6 @@ HRESULT CMapFile::Draw(int destDC, int sourcePixelX, int sourcePixelY, int pixel } - // MapFile functions // ***************** @@ -177,7 +176,6 @@ HRESULT CMapFile::get_AroundTheWorld(int *bAroundTheWorld) } - HRESULT CMapFile::get_TileData( /* [in] */ int tileX, /* [in] */ int tileY, @@ -1116,9 +1114,6 @@ HRESULT CMapFile::SaveMap(StreamWriter *stream, enum MapLoadSaveFormat saveFlags } - - - // ISupportErrorInfo // ***************** @@ -1131,11 +1126,9 @@ HRESULT CMapFile::InterfaceSupportsErrorInfo(REFIID riid) } - // Constructors/Destructor // *********************** - CMapFile::CMapFile(TileSetSource *tileSetSource, int width, int height) : m_cRef(1) { diff --git a/CMemoryStreamReader.cpp b/CMemoryStreamReader.cpp index a91894e..ca17d9b 100644 --- a/CMemoryStreamReader.cpp +++ b/CMemoryStreamReader.cpp @@ -40,7 +40,6 @@ HRESULT __stdcall CMemoryStreamReader::QueryInterface(REFIID riid, void** ppv) } - // StreamReader // ************ diff --git a/CResourceManager.cpp b/CResourceManager.cpp index 0cecc94..750b17f 100644 --- a/CResourceManager.cpp +++ b/CResourceManager.cpp @@ -45,9 +45,6 @@ HRESULT __stdcall CResourceManager::QueryInterface(REFIID riid, void** ppv) } - - - CResourceManager::CResourceManager(BSTR gamePath) : m_cRef(1) { // Initilize linked list of archives in search path @@ -102,7 +99,6 @@ CResourceManager::~CResourceManager() } - HRESULT CResourceManager::get_RootPath(BSTR *path) { SysReAllocString(path, this->path); @@ -140,9 +136,6 @@ HRESULT CResourceManager::put_RootPath(BSTR newPath) } - - - HRESULT CResourceManager::OpenStreamRead( /* [in] */ BSTR fileName, /* [retval][out] */ StreamReader **stream) @@ -264,8 +257,6 @@ HRESULT CResourceManager::OpenStreamWrite( } - - HRESULT CResourceManager::LoadMapFile(BSTR fileName, enum MapLoadSaveFormat loadFlags, MapFile **mapFile) { StreamReader *inStream; @@ -340,8 +331,6 @@ HRESULT CResourceManager::CreateNewMap(int width, int height, MapFile** newMap) } - - HRESULT CResourceManager::LoadTileSetFile(BSTR fileName, TileSet **tileSet) { StreamReader *inStream; @@ -416,8 +405,6 @@ HRESULT CResourceManager::CreateTileSet(int numTiles, int bitDepth, int width, T } - - HRESULT CResourceManager::LoadVolFile(BSTR fileName, int bAttachToStream, ArchiveReader **volReader) { StreamReader *inStream; @@ -638,8 +625,6 @@ HRESULT CResourceManager::ClearSearchPath() } - - // ISupportErrorInfo // ***************** diff --git a/CResourceManagerFactory.cpp b/CResourceManagerFactory.cpp index 3cdae93..f2c1d84 100644 --- a/CResourceManagerFactory.cpp +++ b/CResourceManagerFactory.cpp @@ -32,7 +32,6 @@ HRESULT CResourceManagerFactory::QueryInterface(REFIID riid, void** ppv) } - HRESULT CResourceManagerFactory::CreateInstance(IUnknown *pUnknownOuter, REFIID riid, void** ppv) { diff --git a/CTileGroup.cpp b/CTileGroup.cpp index 872cc84..609680a 100644 --- a/CTileGroup.cpp +++ b/CTileGroup.cpp @@ -137,7 +137,6 @@ HRESULT CTileGroup::Draw(int destDC, int sourcePixelX, int sourcePixelY, int pix } - // Class specific // ************** diff --git a/CTileSet.cpp b/CTileSet.cpp index 21e5400..e1576b3 100644 --- a/CTileSet.cpp +++ b/CTileSet.cpp @@ -101,7 +101,6 @@ HRESULT CTileSet::put_PaletteEntry(int index, int palEntry) } - HRESULT CTileSet::SetNumTiles(int newNumTiles) { HBITMAP newTileSet; @@ -217,11 +216,9 @@ HRESULT CTileSet::SaveTileSet(StreamWriter *stream, enum TileSetSaveFormat saveF } - // Private functions // ***************** - // Constructors // ************ diff --git a/CTileSetSource.cpp b/CTileSetSource.cpp index c0304d3..23f7cb2 100644 --- a/CTileSetSource.cpp +++ b/CTileSetSource.cpp @@ -35,8 +35,6 @@ HRESULT __stdcall CTileSetSource::QueryInterface(REFIID riid, void** ppv) } - - CTileSetSource::CTileSetSource(IResourceManager *resourceManager) : m_cRef(1) { head = NULL; // Initialize linked list of loaded files to empty diff --git a/CVolReader.cpp b/CVolReader.cpp index f480aaa..bdd42ba 100644 --- a/CVolReader.cpp +++ b/CVolReader.cpp @@ -37,7 +37,6 @@ HRESULT __stdcall CVolReader::QueryInterface(REFIID riid, void** ppv) } - // ArchiveReader // ************* diff --git a/CVolWriter.cpp b/CVolWriter.cpp index cbc3539..0bfbbba 100644 --- a/CVolWriter.cpp +++ b/CVolWriter.cpp @@ -35,7 +35,6 @@ HRESULT __stdcall CVolWriter::QueryInterface(REFIID riid, void** ppv) } - // ArchiveWriter // ************* From 81ef7b4a897b4df9b7705e0260620cfa7031de19 Mon Sep 17 00:00:00 2001 From: Daniel Stevens Date: Tue, 18 Nov 2025 18:03:11 -0700 Subject: [PATCH 5/8] Adjust blank lines between IDL sections --- OP2Editor.idl | 7 ------- 1 file changed, 7 deletions(-) diff --git a/OP2Editor.idl b/OP2Editor.idl index fd447fc..4d2b05f 100644 --- a/OP2Editor.idl +++ b/OP2Editor.idl @@ -8,8 +8,6 @@ import "oaidl.idl"; import "ocidl.idl"; - - // Interfaces // ********** @@ -42,7 +40,6 @@ interface SeekableStreamReader : StreamReader } - // StreamWriter [ object, uuid(B83597A2-3471-48db-B9BC-EB4749BA1AAA), oleautomation, nonextensible, @@ -88,8 +85,6 @@ interface ArchiveWriter : IUnknown } - - // TileSet [ object, uuid(C7F1E185-8079-4538-96CF-5950406AE1AA), oleautomation, nonextensible, @@ -485,8 +480,6 @@ interface IResourceManager : IUnknown } - - // ************ // Type Library // ************ From 5fec3eb6d0b9630181fa5dbf295ad79dacb3060f Mon Sep 17 00:00:00 2001 From: Daniel Stevens Date: Tue, 18 Nov 2025 18:03:30 -0700 Subject: [PATCH 6/8] Adjust blank lines in resource and precompiled files --- OP2Editor.rc | 1 - StdAfx.cpp | 5 ----- 2 files changed, 6 deletions(-) diff --git a/OP2Editor.rc b/OP2Editor.rc index e2dc8a6..ce6c4ce 100644 --- a/OP2Editor.rc +++ b/OP2Editor.rc @@ -112,7 +112,6 @@ END ///////////////////////////////////////////////////////////////////////////// - #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // diff --git a/StdAfx.cpp b/StdAfx.cpp index 4ab1221..e8d3fcb 100644 --- a/StdAfx.cpp +++ b/StdAfx.cpp @@ -10,8 +10,3 @@ #endif //#include - - - - - From 199d9b20f517093807ae3dd5e110919e3cbcb3e5 Mon Sep 17 00:00:00 2001 From: Daniel Stevens Date: Tue, 18 Nov 2025 18:05:03 -0700 Subject: [PATCH 7/8] Add extra blank line after includes --- CTileSetManager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/CTileSetManager.cpp b/CTileSetManager.cpp index c9a3b1f..fdab4e9 100644 --- a/CTileSetManager.cpp +++ b/CTileSetManager.cpp @@ -3,6 +3,7 @@ #include "CTileSetManager.h" #include "GlobalFunctions.h" + extern int g_cLocks; From 87db7a9554cf2df2c0e96b085de222a3380ad3dc Mon Sep 17 00:00:00 2001 From: Daniel Stevens Date: Tue, 18 Nov 2025 18:07:29 -0700 Subject: [PATCH 8/8] Uncomment header include This header was transitively included by the previous include. We should be explicit with all includes. Mind you, the old code lacked `#pragma once`, so there may have been a reason it was commented out and so only included once. Of course we can also switch to a forward declare for this particular include. Though we may want to do that separately, and verify includes are appropriate for switching to forward declares. --- CMapFile.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMapFile.h b/CMapFile.h index 473d5f2..d165304 100644 --- a/CMapFile.h +++ b/CMapFile.h @@ -2,7 +2,7 @@ #include "OP2Editor.h" #include "CTileGroup.h" -//#include "CTileSetManager.h" +#include "CTileSetManager.h" class CMapFile : public MapFile, public ISupportErrorInfo