1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-10-31 00:07:39 +02:00
Files
vcmi/include/vcmi/Entity.h
Ivan Savenko 47c1803c42 Finalization of refactoring:
- Entity interface now has getNameTranslated & getNameTextID methods
- Entity interface no longer has getName method
- removed (most) usages of normalizeIndentifier workaround method
- all moddable objects have identifier in form of mod:name
- all moddable object register strings in form of mod.type.name
2023-01-20 15:18:36 +02:00

48 lines
1.1 KiB
C++

/*
* Entity.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
VCMI_LIB_NAMESPACE_BEGIN
class IBonusBearer;
class DLL_LINKAGE Entity
{
public:
using IconRegistar = std::function<void(int32_t index, int32_t group, const std::string & listName, const std::string & imageName)>;
virtual ~Entity() = default;
virtual int32_t getIndex() const = 0;
virtual int32_t getIconIndex() const = 0;
virtual std::string getJsonKey() const = 0;
virtual std::string getNameTranslated() const = 0;
virtual std::string getNameTextID() const = 0;
virtual void registerIcons(const IconRegistar & cb) const = 0;
};
template <typename IdType>
class DLL_LINKAGE EntityT : public Entity
{
public:
virtual IdType getId() const = 0;
};
template <typename IdType>
class DLL_LINKAGE EntityWithBonuses : public EntityT<IdType>
{
public:
virtual const IBonusBearer * accessBonuses() const = 0;
};
VCMI_LIB_NAMESPACE_END