From 9997b28757992f37ed5d8d69912d09100788b16b Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 26 Feb 2021 22:38:26 -0800 Subject: [PATCH] Add comment to magic numbers in FILESYSTEM_mountassets() Now you know why there's a 7, a 14, and a 1 in the first SDL_strlcpy() of the function. --- desktop_version/src/FileSystemUtils.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/desktop_version/src/FileSystemUtils.cpp b/desktop_version/src/FileSystemUtils.cpp index ac306be7..82d50780 100644 --- a/desktop_version/src/FileSystemUtils.cpp +++ b/desktop_version/src/FileSystemUtils.cpp @@ -208,6 +208,14 @@ void FILESYSTEM_mountassets(const char* path) const char* zip_normal; char dir[MAX_PATH]; + /* path is going to look like "levels/LEVELNAME.vvvvvv". + * We want LEVELNAME, which entails starting from index 7 + * (which is how long "levels/" is) + * and then grabbing path_size-14 characters + * (14 chars because "levels/" and ".vvvvvv" are both 7 chars). + * We also add 1 when calculating the amount of bytes to grab + * to account for the null terminator. + */ SDL_strlcpy( filename, &path[7],