diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-26 17:56:52 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-26 17:56:52 +0000 |
commit | 14d82ff67eab5d94b69fb38ea6a0bc634674245c (patch) | |
tree | 2f66f17b95b23b0b4f053b1aa0f00d65297ab24a | |
parent | Remove the static font cache (diff) | |
download | ilt-14d82ff67eab5d94b69fb38ea6a0bc634674245c.tar.bz2 ilt-14d82ff67eab5d94b69fb38ea6a0bc634674245c.tar.xz ilt-14d82ff67eab5d94b69fb38ea6a0bc634674245c.zip |
Remove the generic cache completely
-rw-r--r-- | game/network/network.cpp | 1 | ||||
-rw-r--r-- | game/terrain.cpp | 2 | ||||
-rw-r--r-- | game/vehicles/railVehicleClass.cpp | 14 | ||||
-rw-r--r-- | lib/cache.cpp | 1 | ||||
-rw-r--r-- | lib/cache.h | 39 | ||||
-rw-r--r-- | ui/font.cpp | 1 | ||||
-rw-r--r-- | ui/text.cpp | 1 |
7 files changed, 0 insertions, 59 deletions
diff --git a/game/network/network.cpp b/game/network/network.cpp index 500742c..b6c52b8 100644 --- a/game/network/network.cpp +++ b/game/network/network.cpp @@ -1,7 +1,6 @@ #include "network.h" #include "routeWalker.h" #include <array> -#include <cache.h> #include <game/network/link.h> #include <gfx/models/texture.h> #include <glm/gtx/intersect.hpp> diff --git a/game/terrain.cpp b/game/terrain.cpp index a4b6510..d2c8593 100644 --- a/game/terrain.cpp +++ b/game/terrain.cpp @@ -2,9 +2,7 @@ #include "game/geoData.h" #include "gfx/models/texture.h" #include <algorithm> -#include <cache.h> #include <cstddef> -#include <filesystem> #include <gfx/gl/sceneShader.h> #include <gfx/gl/shadowMapper.h> #include <gfx/image.h> diff --git a/game/vehicles/railVehicleClass.cpp b/game/vehicles/railVehicleClass.cpp index 5fd7580..34c1359 100644 --- a/game/vehicles/railVehicleClass.cpp +++ b/game/vehicles/railVehicleClass.cpp @@ -2,26 +2,12 @@ #include "gfx/gl/sceneShader.h" #include "gfx/gl/shadowMapper.h" #include "gfx/gl/vertexArrayObject.h" -#include "gfx/models/mesh.h" -#include "gfx/models/texture.h" -#include "stream_support.h" -#include <algorithm> #include <array> -#include <cache.h> -#include <cmath> -#include <cstddef> -#include <filesystem> #include <glm/glm.hpp> -#include <iterator> #include <lib/resource.h> #include <location.h> -#include <map> #include <maths.h> #include <memory> -#include <set> -#include <string> -#include <utility> -#include <vector> bool RailVehicleClass::persist(Persistence::PersistenceStore & store) diff --git a/lib/cache.cpp b/lib/cache.cpp deleted file mode 100644 index 05b26b0..0000000 --- a/lib/cache.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "cache.h" diff --git a/lib/cache.h b/lib/cache.h deleted file mode 100644 index f5fd227..0000000 --- a/lib/cache.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include "special_members.h" -#include <functional> -#include <map> -#include <memory> -#include <tuple> - -template<typename Obj, typename... KeyParts> class Cache { -public: - using Ptr = std::shared_ptr<Obj>; - using Key = std::tuple<KeyParts...>; - - Cache() = default; - virtual ~Cache() = default; - DEFAULT_MOVE(Cache); - NO_COPY(Cache); - - [[nodiscard]] Ptr - get(const KeyParts &... keyparts) - { - auto key = std::tie(keyparts...); - if (auto e = cached.find(key); e != cached.end()) { - return e->second; - } - return cached.emplace(key, construct(keyparts...)).first->second; - } - - [[nodiscard]] virtual Ptr - construct(const KeyParts &... keyparts) const - { - return std::make_shared<Obj>(keyparts...); - } - -private: - std::map<Key, Ptr, std::less<>> cached; -}; - -// IWYU pragma: no_forward_declare Cache diff --git a/ui/font.cpp b/ui/font.cpp index 237c22d..b6669b0 100644 --- a/ui/font.cpp +++ b/ui/font.cpp @@ -1,6 +1,5 @@ #include "font.h" #include <algorithm> -#include <cache.h> #include <cctype> #include <ft2build.h> #include FT_FREETYPE_H diff --git a/ui/text.cpp b/ui/text.cpp index 7cb7d30..5b9e591 100644 --- a/ui/text.cpp +++ b/ui/text.cpp @@ -3,7 +3,6 @@ #include "gfx/gl/uiShader.h" #include "uiComponent.h" #include <array> -#include <cache.h> #include <glArrays.h> #include <glm/gtc/type_ptr.hpp> #include <utility> |