|
@@ -22,30 +22,30 @@ class IMapLoader;
|
|
class IMapPatcher;
|
|
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:
|
|
public:
|
|
- IMapService() = default;
|
|
|
|
- virtual ~IMapService() = default;
|
|
|
|
|
|
+ CMapService() = default;
|
|
|
|
+ virtual ~CMapService() = default;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Loads the VCMI/H3 map file specified by the name.
|
|
* Loads the VCMI/H3 map file specified by the name.
|
|
*
|
|
*
|
|
* @param name the name of the map
|
|
* @param name the name of the map
|
|
* @return a unique ptr to the loaded map class
|
|
* @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.
|
|
* Loads the VCMI/H3 map header specified by the name.
|
|
*
|
|
*
|
|
* @param name the name of the map
|
|
* @param name the name of the map
|
|
* @return a unique ptr to the loaded map header class
|
|
* @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
|
|
* 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.
|
|
* 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
|
|
* @param name indicates name of file that will be used during map header patching
|
|
* @return a unique ptr to the loaded map class
|
|
* @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
|
|
* 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.
|
|
* 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
|
|
* @param name indicates name of file that will be used during map header patching
|
|
* @return a unique ptr to the loaded map class
|
|
* @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:
|
|
private:
|
|
/**
|
|
/**
|
|
* Gets a map input stream object specified by a map name.
|
|
* Gets a map input stream object specified by a map name.
|