Skip to content

Commit 8ef81ae

Browse files
authored
Merge pull request #82580 from ehughsbaird/rm-data-cache
Make stale data warnings optional with build flag
2 parents 9c9b9a4 + 99fa385 commit 8ef81ae

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ jobs:
261261
- name: Build CDDA (linux)
262262
if: runner.os == 'Linux' && matrix.mxe == 'none' && matrix.android == 'none' && !matrix.wasm
263263
run: |
264-
make -j$((`nproc`+0)) TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} RELEASE=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=1 LIBBACKTRACE=${{ matrix.libbacktrace }} PCH=0 bindist
264+
make -j$((`nproc`+0)) TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} RELEASE=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=1 LIBBACKTRACE=${{ matrix.libbacktrace }} WARN_STALE_DATA=1 PCH=0 bindist
265265
mv cataclysmdda-0.J.tar.gz cdda-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.tar.gz
266266
- name: Build CDDA (WebAssembly)
267267
if: matrix.wasm && success()
@@ -274,7 +274,7 @@ jobs:
274274
env:
275275
PLATFORM: /opt/mxe/usr/bin/${{ matrix.mxe }}-w64-mingw32.static.gcc12-
276276
run: |
277-
make -j$((`nproc`+0)) CROSS="${PLATFORM}" TILES=1 SOUND=1 RELEASE=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=1 LIBBACKTRACE=${{ matrix.libbacktrace }} PCH=0 bindist
277+
make -j$((`nproc`+0)) CROSS="${PLATFORM}" TILES=1 SOUND=1 RELEASE=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=1 LIBBACKTRACE=${{ matrix.libbacktrace }} WARN_STALE_DATA=1 PCH=0 bindist
278278
mv cataclysmdda-0.J.zip cdda-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.zip
279279
- name: Build CDDA (windows msvc)
280280
if: runner.os == 'Windows'
@@ -290,7 +290,7 @@ jobs:
290290
- name: Build CDDA (osx)
291291
if: runner.os == 'macOS'
292292
run: |
293-
make -j3 TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} RELEASE=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=0 PCH=0 USE_HOME_DIR=1 FRAMEWORK=1 UNIVERSAL_BINARY=1 dmgdist
293+
make -j3 TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} RELEASE=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=0 PCH=0 USE_HOME_DIR=1 FRAMEWORK=1 UNIVERSAL_BINARY=1 WARN_STALE_DATA=1 dmgdist
294294
mv Cataclysm.dmg cdda-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.dmg
295295
- name: Set up JDK 8 (android)
296296
if: runner.os == 'Linux' && matrix.android != 'none' && matrix.mxe == 'none'

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,11 @@ IMTUI_DIR = $(SRC_DIR)/third-party/imtui
175175
LOCALIZE = 1
176176
ASTYLE_BINARY = astyle
177177

178+
# Disable stale game data warning by default
179+
ifndef WARN_STALE_DATA
180+
WARN_STALE_DATA = 0
181+
endif
182+
178183
# Enable debug by default
179184
ifndef RELEASE
180185
RELEASE = 0
@@ -350,6 +355,10 @@ ifeq ($(STRING_ID_DEBUG), 1)
350355
DEFINES += -DCATA_STRING_ID_DEBUGGING
351356
endif
352357

358+
ifeq ($(WARN_STALE_DATA), 0)
359+
DEFINES += -DNO_STALE_DATA_WARN
360+
endif
361+
353362
# This sets CXX and so must be up here
354363
ifneq ($(CLANG), 0)
355364
# Allow setting specific CLANG version

src/flexbuffer_cache.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ class flexbuffer_disk_cache
326326

327327
// Does the source file's mtime match what we cached previously
328328
if( source_mtime != disk_entry->second.mtime ) {
329+
#ifndef NO_STALE_DATA_WARN
329330
std::string filepath_and_name = disk_entry->first;
330331
// we use this as an exclusion condition. Configuration options can be changed all the time, we don't want to warn over those. Same for achievements.
331332
bool stale_game_data = *root_relative_source_path.begin() != std::filesystem::u8path( "config" ) &&
@@ -341,6 +342,7 @@ class flexbuffer_disk_cache
341342
filepath_and_name;
342343
}
343344
}
345+
#endif
344346
// Cached flexbuffer on disk is out of date, remove it.
345347
remove_file( disk_entry->second.flexbuffer_path.u8string() );
346348
cached_flexbuffers_.erase( disk_entry );

src/options.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2891,11 +2891,13 @@ void options_manager::add_options_debug()
28912891

28922892
add_empty_line();
28932893

2894+
#ifndef NO_STALE_DATA_WARN
28942895
add( "WARN_ON_MODIFIED", "debug", to_translation( "Warn if file integrity check fails" ),
28952896
to_translation( "This option controls whether the game will warn when it detects that the game's data has been modified." ),
28962897
true );
28972898

28982899
add_empty_line();
2900+
#endif
28992901

29002902
add( "SKIP_VERIFICATION", "debug", to_translation( "Skip verification step during loading" ),
29012903
to_translation( "If enabled, this skips the JSON verification step during loading. This may give a faster loading time, but risks JSON errors not being caught until runtime." ),

0 commit comments

Comments
 (0)