1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-21 00:19:29 +02:00

First version that works - banning objects is possible

This commit is contained in:
Tomasz Zieliński
2024-08-21 20:16:41 +02:00
parent 7fe9c473b4
commit 85ee859b6e
9 changed files with 612 additions and 104 deletions

View File

@ -74,6 +74,8 @@ class DLL_LINKAGE CObjectClassesHandler : public IHandlerBase, boost::noncopyabl
/// map that is filled during construction with all known handlers. Not serializeable due to usage of std::function
std::map<std::string, std::function<TObjectTypeHandler()> > handlerConstructors;
std::vector<std::pair<CompoundMapObjectID, std::function<void(CompoundMapObjectID)>>> objectIdHandlers;
/// container with H3 templates, used only during loading, no need to serialize it
using TTemplatesContainer = std::multimap<std::pair<MapObjectID, MapObjectSubID>, std::shared_ptr<const ObjectTemplate>>;
TTemplatesContainer legacyTemplates;
@ -110,15 +112,19 @@ public:
TObjectTypeHandler getHandlerFor(MapObjectID type, MapObjectSubID subtype) const;
TObjectTypeHandler getHandlerFor(const std::string & scope, const std::string & type, const std::string & subtype) const;
TObjectTypeHandler getHandlerFor(CompoundMapObjectID compoundIdentifier) const;
CompoundMapObjectID getCompoundIdentifier(const std::string & scope, const std::string & type, const std::string & subtype) const;
CompoundMapObjectID getCompoundIdentifier(const std::string & objectName) const;
std::string getObjectName(MapObjectID type, MapObjectSubID subtype) const;
SObjectSounds getObjectSounds(MapObjectID type, MapObjectSubID subtype) const;
void resolveObjectCompoundId(const std::string & id, std::function<void(CompoundMapObjectID)> callback);
/// Returns handler string describing the handler (for use in client)
std::string getObjectHandlerName(MapObjectID type) const;
std::string getJsonKey(MapObjectID type) const;
};
VCMI_LIB_NAMESPACE_END
VCMI_LIB_NAMESPACE_END