Skip to content

Commit

Permalink
feat: add config setting for QoL improvement in generation
Browse files Browse the repository at this point in the history
  • Loading branch information
SaneEngineer committed Sep 15, 2024
1 parent f3d34b4 commit f98b6b6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/GrassControl/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ namespace GrassControl
static inline int DynDOLODGrassMode = 0;
static inline int MaxFailures = 2;
static inline bool FreezeCheck = true;
static inline bool Updating = true;

constexpr static inline std::string_view iniPath = "Data/SKSE/Plugins/GrassControl.ini";
};
Expand Down
1 change: 1 addition & 0 deletions src/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ namespace GrassControl
ini.SetLongValue("GrassConfig", "DynDOLOD-Grass-Mode", DynDOLODGrassMode, ";Enable grass compatibility mode with DynDOLOD Grass LODs. Valid values: 0 = Disabled; 1 = Display grass only in active cells(without fade) and let DynDOLOD handle inactive cell Grass; 2 = Display grass only in active cells and large ref loaded cells(without fade) and let DynDOLOD handle grass outside of large ref cells ");
ini.SetLongValue("GrassConfig", "Max-Failures", MaxFailures, ";Maximum number of attempts to generate a grass cache before skipping a cell.");
ini.SetBoolValue("GrassConfig", "Freeze-check-enabled", FreezeCheck, ";Enable or disable the freeze check that is run while generating a grass cache. Recommended to leave enabled unless the message repeately appears.");
ini.SetBoolValue("GrassConfig", "Updating-Cache", Updating, ";If you are generating a cache for a worldspace you have not generated yet, set this true. Otherwise, the cache files in your grass folder will be deleted. If you are updating a worldspace, then move all files you do not want to be deleted to a new folder and replace the old files in the folder once you have generated new cache files. Then rename/move the folder back.");

ini.SaveFile(iniPath.data());

Expand Down
8 changes: 5 additions & 3 deletions src/GidFileCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,11 @@ namespace GrassControl
create_directories(dir);
}

for (const auto& entry : std::filesystem::directory_iterator(dir)) {
if (entry.path().extension() == ".dgid" || entry.path().extension() == ".cgid" || entry.path().extension() == ".fail") {
remove(entry.path());
if (!Config::Updating) {
for (const auto& entry : std::filesystem::directory_iterator(dir)) {
if (entry.path().extension() == ".dgid" || entry.path().extension() == ".cgid" || entry.path().extension() == ".fail") {
remove(entry.path());
}
}
}
}
Expand Down

0 comments on commit f98b6b6

Please sign in to comment.