From f17badb3cd9436e984571a332d77f2dd115bffb7 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 25 May 2017 13:09:40 +0400 Subject: [PATCH] Makes cells cache size configurable --- apps/openmw/mwworld/cells.cpp | 3 ++- docs/source/reference/modding/settings/cells.rst | 9 +++++++++ files/settings-default.cfg | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwworld/cells.cpp b/apps/openmw/mwworld/cells.cpp index 6cd495ee6..752659eb6 100644 --- a/apps/openmw/mwworld/cells.cpp +++ b/apps/openmw/mwworld/cells.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -88,7 +89,7 @@ void MWWorld::Cells::writeCell (ESM::ESMWriter& writer, CellStore& cell) const MWWorld::Cells::Cells (const MWWorld::ESMStore& store, std::vector& reader) : mStore (store), mReader (reader), - mIdCache (40, std::pair ("", (CellStore*)0)), /// \todo make cache size configurable + mIdCache (Settings::Manager::getInt("pointers cache size", "Cells"), std::pair ("", (CellStore*)0)), mIdCacheIndex (0) {} diff --git a/docs/source/reference/modding/settings/cells.rst b/docs/source/reference/modding/settings/cells.rst index 6cda93194..bbde2fc32 100644 --- a/docs/source/reference/modding/settings/cells.rst +++ b/docs/source/reference/modding/settings/cells.rst @@ -164,3 +164,12 @@ cache expiry delay The amount of time (in seconds) that a preloaded texture or object will stay in cache after it is no longer referenced or required, for example, when all cells containing this texture have been unloaded. + +pointers cache size +------------------ + +:Type: integer +:Range: >0 +:Default: 40 + +The count of object pointers, that will be saved for a faster search by object ID. diff --git a/files/settings-default.cfg b/files/settings-default.cfg index ec3c2ade6..e7035af73 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -76,6 +76,9 @@ preload cell expiry delay = 5 # How long to keep models/textures/collision shapes in cache after they're no longer referenced/required (in seconds) cache expiry delay = 5 +# The count of pointers, that will be saved for a faster search by object ID. +pointers cache size = 40 + [Terrain] # If true, use paging and LOD algorithms to display the entire terrain. If false, only display terrain of the loaded cells