mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
Support for banned game entities in random map templates
The following entities can now be banned in a random map template definition: - Hero - Artifact - Spell - Secondary skill The ban follows the same rules as banning via the map settings in the map editor. It is also now possible to bypass dependencies and access identifiers from mods that are not dependencies when defining: - Banned entities in random map templates - the chance of a hero class appearing in a tavern of a specific faction - the chance of a spell appearing in a mage guild of a specific faction - the chance of a hero class receiving a secondary skill For this to work, the identifier must be specified in full, e.g. `modName:objectName`. If the specified mod is not active, the game will silently ignore this entry. This behaviour is not affected by mod load order. It is possible to use this format to access a mod that has not yet been loaded.
This commit is contained in:
@@ -32,13 +32,14 @@ class DLL_LINKAGE CIdentifierStorage
|
||||
std::string name; /// string ID
|
||||
std::function<void(si32)> callback;
|
||||
bool optional;
|
||||
bool bypassDependenciesCheck;
|
||||
bool dynamicType;
|
||||
|
||||
/// Builds callback from identifier in form "targetMod:type.name"
|
||||
static ObjectCallback fromNameWithType(const std::string & scope, const std::string & fullName, const std::function<void(si32)> & callback, bool optional);
|
||||
|
||||
/// Builds callback from identifier in form "targetMod:name"
|
||||
static ObjectCallback fromNameAndType(const std::string & scope, const std::string & type, const std::string & fullName, const std::function<void(si32)> & callback, bool optional);
|
||||
static ObjectCallback fromNameAndType(const std::string & scope, const std::string & type, const std::string & fullName, const std::function<void(si32)> & callback, bool optional, bool bypassDependenciesCheck);
|
||||
|
||||
private:
|
||||
ObjectCallback() = default;
|
||||
@@ -87,7 +88,9 @@ public:
|
||||
void requestIdentifier(const std::string & type, const JsonNode & name, const std::function<void(si32)> & callback) const;
|
||||
void requestIdentifier(const JsonNode & name, const std::function<void(si32)> & callback) const;
|
||||
|
||||
void requestIdentifierOptional(const std::string & type, const JsonNode & name, const std::function<void(si32)> & callback) const;
|
||||
void requestIdentifierIfNotNull(const std::string & type, const JsonNode & name, const std::function<void(si32)> & callback) const;
|
||||
void requestIdentifierIfFound(const std::string & type, const JsonNode & name, const std::function<void(si32)> & callback) const;
|
||||
void requestIdentifierIfFound(const std::string & scope, const std::string & type, const std::string & name, const std::function<void(si32)> & callback) const;
|
||||
|
||||
/// try to request ID. If ID with such name won't be loaded, callback function will not be called
|
||||
void tryRequestIdentifier(const std::string & scope, const std::string & type, const std::string & name, const std::function<void(si32)> & callback) const;
|
||||
|
||||
Reference in New Issue
Block a user