瀏覽代碼

Remove unused interface

nordsoft 2 年之前
父節點
當前提交
67e1b48d47
共有 3 個文件被更改,包括 19 次插入32 次删除
  1. 2 2
      lib/CGameState.cpp
  2. 3 3
      lib/CGameState.h
  3. 14 27
      lib/mapping/CMapService.h

+ 2 - 2
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())
 	{

+ 3 - 3
lib/CGameState.h

@@ -57,7 +57,7 @@ class CQuest;
 class CCampaignScenario;
 struct EventCondition;
 class CScenarioTravel;
-class IMapService;
+class CMapService;
 
 
 template<typename T> 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<StartInfo> 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();

+ 14 - 27
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<CMap> loadMap(const ResourceID & name) const = 0;
-
+	std::unique_ptr<CMap> 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<CMapHeader> loadMapHeader(const ResourceID & name) const = 0;
-
+	std::unique_ptr<CMapHeader> 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<CMap> loadMap(const ui8 * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding) const = 0;
-
+	std::unique_ptr<CMap> 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<CMapHeader> 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<CMap> & map, boost::filesystem::path fullPath) const = 0;
-};
-
-class DLL_LINKAGE CMapService : public IMapService
-{
-public:
-	CMapService() = default;
-	virtual ~CMapService() = default;
-
-	std::unique_ptr<CMap> loadMap(const ResourceID & name) const override;
-	std::unique_ptr<CMapHeader> loadMapHeader(const ResourceID & name) const override;
-	std::unique_ptr<CMap> loadMap(const ui8 * buffer, int size, const std::string & name, const std::string & modName, const std::string & encoding) const override;
-	std::unique_ptr<CMapHeader> 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<CMap> & map, boost::filesystem::path fullPath) const override;
+	std::unique_ptr<CMapHeader> 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<CMap> & map, boost::filesystem::path fullPath) const;
 private:
 	/**
 	 * Gets a map input stream object specified by a map name.