bugfix(watertracks): Correct the path handling for .wak files in the WaterTracksRenderSystem#2634
Conversation
|
| Filename | Overview |
|---|---|
| Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp | Correctly replaces fixed-size char buffer + strlcpy/strlcat with FileSystem::removeExtension + AsciiString::concat in both saveTracks and loadTracks; fix is consistent, logically sound, and eliminates the 256-byte buffer truncation risk. |
Sequence Diagram
sequenceDiagram
participant Caller
participant WaterTracksRenderSystem
participant TerrainLogic
participant FileSystem
Caller->>WaterTracksRenderSystem: saveTracks() / loadTracks()
WaterTracksRenderSystem->>TerrainLogic: getSourceFilename()
TerrainLogic-->>WaterTracksRenderSystem: "Maps/MyMap.map"
WaterTracksRenderSystem->>FileSystem: removeExtension(fileName)
Note over FileSystem: strrchr finds '.' → truncateTo drops ".map"
FileSystem-->>WaterTracksRenderSystem: fileName = "Maps/MyMap"
WaterTracksRenderSystem->>WaterTracksRenderSystem: fileName.concat(".wak")
Note over WaterTracksRenderSystem: fileName = "Maps/MyMap.wak"
WaterTracksRenderSystem->>FileSystem: openFile("Maps/MyMap.wak", READ|BINARY)
Reviews (4): Last reviewed commit: "fix(W3DWaterTracks): Correct the path ha..." | Re-trigger Greptile
|
I have made a new PR to extend the functionality of AsciiString and UnicodeString with a removeExtensions() function that will remove all file extensions from a path. The implementation relies on looking for the first full stop symbol denoting the first extension in the path name. I tested it by substituting it in where i was performing the |
63a5787 to
6b30b99
Compare
6b30b99 to
30ebc7d
Compare
|
Updated the implementation to remove the raw c-string handling. |
|
|
||
| strlcpy(path, fileName.str(), ARRAY_SIZE(path)); | ||
| strlcat(path, ".wak", ARRAY_SIZE(path)); | ||
| TheFileSystem->removeExtension(fileName); |
There was a problem hiding this comment.
Oh yes, i forgot i made it static.
…WaterTracksRenderSystem
30ebc7d to
915dff1
Compare
|
Tweaked to call the static function on the class instead of the instance of the file system. |

Closes: #2633
Merge After: #2635
This fixes a file loading issue which was introduced by a regression in #1808
The functionality that was overlooked was the original code truncating the
.mapextension from the file name.We now use the
AsciiString::truncateBy()TheFileSystem::removeExtension() function to remove theAsciiString::removeExtensions().mapextension before copying the ascii string.