Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe changes replace manual path-separator searches with shared ChangesShared path filename extraction
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: 🔵 Low · up to Maps with mixed separator styles can miss their water-grid settings. This is a narrow, pre-existing limitation, so the change is mergeable with owner awareness. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change lets forward-slash map paths resolve to the intended filenames during transfers. Receiving clients retain destination and content checks, and no new security bypass was established. Some uncertainty remains about where all map paths originate. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
ffcf008 to
312cf98
Compare
xezon
left a comment
There was a problem hiding this comment.
Looks plausible. Can you make a full audit over the code if there are any other places like that and fix them too?
|
Done. Audited all places that take a file name from a path with only a backslash and switched them to getFileName or getLastPathSeparator. I left the windows-only tools stuff eg WorldBuilder and getMapLeafAndDirName alone |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 822dca59-ce18-4fcc-ae4a-c01b2145c2d2
📒 Files selected for processing (29)
Core/GameEngine/Source/Common/Audio/AudioEventRTS.cppCore/GameEngine/Source/Common/CRCDebug.cppCore/GameEngine/Source/Common/INI/INIMapCache.cppCore/GameEngine/Source/GameClient/MapUtil.cppCore/GameEngine/Source/GameLogic/Map/TerrainLogic.cppCore/GameEngine/Source/GameNetwork/FileTransfer.cppCore/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cppCore/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cppCore/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cppCore/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cppGenerals/Code/GameEngine/Source/Common/Recorder.cppGenerals/Code/GameEngine/Source/Common/StatsCollector.cppGenerals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cppGenerals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cppGeneralsMD/Code/GameEngine/Source/Common/Recorder.cppGeneralsMD/Code/GameEngine/Source/Common/StatsCollector.cppGeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cppGeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cppGeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cppGeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cppGeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cppGeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cppGeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
|
|
||
| // create stripped map name | ||
| c = strrchr( TheGlobalData->m_mapName.str(), '\\' ); | ||
| c = getLastPathSeparator( TheGlobalData->m_mapName.str() ); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Compare map filenames without their separators.
When the map path and configured path use different separators, the fallback compares strings such as /CHI01.map and \CHI01.map. The comparison fails, so the water-grid settings are not applied. Advance each separator pointer before setting the stripped name.
Core/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp#L1149-L1149: SetstrippedMapNameOnlyfromc + 1.Core/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp#L1156-L1156: SetstrippedCompareMapNameOnlyfromc + 1.Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp#L1149-L1149: SetstrippedMapNameOnlyfromc + 1.Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp#L1156-L1156: SetstrippedCompareMapNameOnlyfromc + 1.
📍 Affects 2 files
Core/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp#L1149-L1149(this comment)Core/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp#L1156-L1156Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp#L1149-L1149Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp#L1156-L1156
10a872c to
a426ff8
Compare
| strippedCompareMapNameOnly = TheGlobalData->m_vertexWaterAvailableMaps[ i ]; | ||
| // TheSuperHackers @bugfix bobtista 29/09/2026 Match water settings regardless of path separators. | ||
| AsciiString strippedMapNameOnly = getFileName( TheGlobalData->m_mapName.str() ); | ||
| AsciiString strippedCompareMapNameOnly = getFileName( TheGlobalData->m_vertexWaterAvailableMaps[ i ].str() ); |
There was a problem hiding this comment.
Can we also make most of these const char* then?
| return path; | ||
| } | ||
|
|
||
| AsciiString GetExtensionFromFile( AsciiString fname ) |
There was a problem hiding this comment.
This function appears to be uncalled. Remove?
|
|
||
| // now try this compare | ||
| if( strippedMapNameOnly.compareNoCase( strippedCompareMapNameOnly.str() ) == 0 ) | ||
| if( _stricmp( strippedMapNameOnly, strippedCompareMapNameOnly ) == 0 ) |
| const char *fname = mapName.reverseFind('\\'); | ||
| if (fname) | ||
| mapName = fname+1; | ||
| AsciiString mapName = getFileName(game->getMap().str()); |
There was a problem hiding this comment.
While at it, this mumbo jumbo can be simplified by using constructor AsciiString(const char* s, int len)
| @@ -183,7 +183,7 @@ void outputCRCDumpLines() | |||
|
|
|||
| static AsciiString getFname(AsciiString path) | |||
Several filename extractions search only for a backslash. Paths using forward slashes can therefore retain directory names, and some callers use an invalid pointer when no backslash is found.
Use
getFileNameandgetLastPathSeparatorfromPathUtil.hto handle both separators. For example, the save list fallback label now usesfoo.mapforMaps/foo/foo.map. Existing map labels remain unchanged.The changes cover save labels and default descriptions, map cache names, lobby and game setup map names, replay lists, generated stats and replay filenames, audio localization, file transfer helpers, and diagnostic output. Applied to Generals and Zero Hour.
getMapLeafAndDirName, which constructs the portable save path, and Windows-only tools such as WorldBuilder are unchanged. The vertex water map comparison continues to include the separator in the compared names.Verification:
In-game verification covers the save list fallback label. The other changed call sites have not been tested in game.