From 14d82ff67eab5d94b69fb38ea6a0bc634674245c Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 26 Jan 2024 17:56:52 +0000 Subject: Remove the generic cache completely --- game/network/network.cpp | 1 - game/terrain.cpp | 2 -- game/vehicles/railVehicleClass.cpp | 14 -------------- lib/cache.cpp | 1 - lib/cache.h | 39 -------------------------------------- ui/font.cpp | 1 - ui/text.cpp | 1 - 7 files changed, 59 deletions(-) delete mode 100644 lib/cache.cpp delete mode 100644 lib/cache.h 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 -#include #include #include #include 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 -#include #include -#include #include #include #include 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 #include -#include -#include -#include -#include #include -#include #include #include -#include #include #include -#include -#include -#include -#include 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 -#include -#include -#include - -template class Cache { -public: - using Ptr = std::shared_ptr; - using Key = std::tuple; - - 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(keyparts...); - } - -private: - std::map> 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 -#include #include #include #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 -#include #include #include #include -- cgit v1.2.3