From 67e1b48d47b0ece50c393078c84d6ca899bb9a83 Mon Sep 17 00:00:00 2001 From: nordsoft Date: Sun, 16 Apr 2023 14:00:01 +0400 Subject: [PATCH] Remove unused interface --- lib/CGameState.cpp | 4 ++-- lib/CGameState.h | 6 +++--- lib/mapping/CMapService.h | 41 +++++++++++++-------------------------- 3 files changed, 19 insertions(+), 32 deletions(-) diff --git a/lib/CGameState.cpp b/lib/CGameState.cpp index 4df4cd9b7..78905d616 100644 --- a/lib/CGameState.cpp +++ b/lib/CGameState.cpp @@ -722,7 +722,7 @@ void CGameState::preInit(Services * services) this->services = services; } -void CGameState::init(const IMapService * mapService, StartInfo * si, bool allowSavingRandomMap) +void CGameState::init(const CMapService * mapService, StartInfo * si, bool allowSavingRandomMap) { preInitAuto(); logGlobal->info("\tUsing random seed: %d", si->seedToBeUsed); @@ -851,7 +851,7 @@ void CGameState::preInitAuto() } } -void CGameState::initNewGame(const IMapService * mapService, bool allowSavingRandomMap) +void CGameState::initNewGame(const CMapService * mapService, bool allowSavingRandomMap) { if(scenarioOps->createRandomMap()) { diff --git a/lib/CGameState.h b/lib/CGameState.h index 3877f6bc0..882c776be 100644 --- a/lib/CGameState.h +++ b/lib/CGameState.h @@ -57,7 +57,7 @@ class CQuest; class CCampaignScenario; struct EventCondition; class CScenarioTravel; -class IMapService; +class CMapService; template class CApplier; @@ -161,7 +161,7 @@ public: void preInit(Services * services); - void init(const IMapService * mapService, StartInfo * si, bool allowSavingRandomMap = false); + void init(const CMapService * mapService, StartInfo * si, bool allowSavingRandomMap = false); void updateOnLoad(StartInfo * si); ConstTransitivePtr scenarioOps, initialOpts; //second one is a copy of settings received from pregame (not randomized) @@ -253,7 +253,7 @@ private: // ----- initialization ----- void preInitAuto(); - void initNewGame(const IMapService * mapService, bool allowSavingRandomMap); + void initNewGame(const CMapService * mapService, bool allowSavingRandomMap); void initCampaign(); void checkMapChecksum(); void initGlobalBonuses(); diff --git a/lib/mapping/CMapService.h b/lib/mapping/CMapService.h index ab671c8ba..256fc8b3c 100644 --- a/lib/mapping/CMapService.h +++ b/lib/mapping/CMapService.h @@ -22,30 +22,30 @@ class IMapLoader; class IMapPatcher; /** - * The map service provides loading of VCMI/H3 map files. It can - * be extended to save maps later as well. + * The map service provides loading and saving of VCMI/H3 map files. */ -class DLL_LINKAGE IMapService +class DLL_LINKAGE CMapService { public: - IMapService() = default; - virtual ~IMapService() = default; + CMapService() = default; + virtual ~CMapService() = default; + /** * Loads the VCMI/H3 map file specified by the name. * * @param name the name of the map * @return a unique ptr to the loaded map class */ - virtual std::unique_ptr loadMap(const ResourceID & name) const = 0; - + std::unique_ptr loadMap(const ResourceID & name) const; + /** * Loads the VCMI/H3 map header specified by the name. * * @param name the name of the map * @return a unique ptr to the loaded map header class */ - virtual std::unique_ptr loadMapHeader(const ResourceID & name) const = 0; - + std::unique_ptr loadMapHeader(const ResourceID & name) const; + /** * Loads the VCMI/H3 map file from a buffer. This method is temporarily * in use to ease the transition to use the new map service. @@ -58,8 +58,8 @@ public: * @param name indicates name of file that will be used during map header patching * @return a unique ptr to the loaded map class */ - virtual std::unique_ptr loadMap(const ui8 * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding) const = 0; - + std::unique_ptr loadMap(const ui8 * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding) const; + /** * Loads the VCMI/H3 map header from a buffer. This method is temporarily * in use to ease the transition to use the new map service. @@ -72,22 +72,9 @@ public: * @param name indicates name of file that will be used during map header patching * @return a unique ptr to the loaded map class */ - virtual std::unique_ptr loadMapHeader(const ui8 * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding) const = 0; - - virtual void saveMap(const std::unique_ptr & map, boost::filesystem::path fullPath) const = 0; -}; - -class DLL_LINKAGE CMapService : public IMapService -{ -public: - CMapService() = default; - virtual ~CMapService() = default; - - std::unique_ptr loadMap(const ResourceID & name) const override; - std::unique_ptr loadMapHeader(const ResourceID & name) const override; - std::unique_ptr loadMap(const ui8 * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding) const override; - std::unique_ptr loadMapHeader(const ui8 * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding) const override; - void saveMap(const std::unique_ptr & map, boost::filesystem::path fullPath) const override; + std::unique_ptr loadMapHeader(const ui8 * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding) const; + + void saveMap(const std::unique_ptr & map, boost::filesystem::path fullPath) const; private: /** * Gets a map input stream object specified by a map name.