Skip to content

Commit

Permalink
Fix custom patch file name template
Browse files Browse the repository at this point in the history
Follow-up to #309
  • Loading branch information
alexbatalov committed Jan 16, 2024
1 parent 70d5830 commit 1b18c2b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/game.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1364,15 +1364,14 @@ static int gameDbInit()
}

// SFALL: custom patch file name.
char* patch_filename = nullptr;
if (configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_PATCH_FILE, &patch_filename)) {
if (patch_filename == nullptr || *patch_file_name == '\0') {
patch_filename = "patch%03d.dat";
}
char* path_file_name_template = nullptr;
configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_PATCH_FILE, &path_file_name_template);
if (path_file_name_template == nullptr || *path_file_name_template == '\0') {
path_file_name_template = "patch%03d.dat";
}

for (patch_index = 0; patch_index < 1000; patch_index++) {
snprintf(filename, sizeof(filename), patch_filename, patch_index);
snprintf(filename, sizeof(filename), path_file_name_template, patch_index);

if (compat_access(filename, 0) == 0) {
dbOpen(filename, 0, nullptr, 1);
Expand Down

0 comments on commit 1b18c2b

Please sign in to comment.