1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Remove unused interface

This commit is contained in:
nordsoft 2023-04-16 14:00:01 +04:00
parent d244702abc
commit 67e1b48d47
3 changed files with 19 additions and 32 deletions

View File

@ -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())
{

View File

@ -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();

View File

@ -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.