mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-16 10:19:47 +02:00
62fddca21e
- IdentifierStorage is now a separate handler in VLC - Renamed ModHandler::Incompatibility exception to ModIncompatibility - Extracted ModScope namespace from ModHandler - Extracted ModUtilities namespace from ModHandler - Split CModHandler.cpp on per-class basis - Replaced some direct members with unique_ptr to reduce header includes
54 lines
1.4 KiB
C++
54 lines
1.4 KiB
C++
/*
|
|
* ModScope.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
|
|
|
|
namespace ModScope
|
|
{
|
|
|
|
/// returns true if scope is reserved for internal use and can not be used by mods
|
|
inline bool isScopeReserved(const std::string & scope)
|
|
{
|
|
//following scopes are reserved - either in use by mod system or by filesystem
|
|
static const std::array<std::string, 9> reservedScopes = {
|
|
"core", "map", "game", "root", "saves", "config", "local", "initial", "mapEditor"
|
|
};
|
|
|
|
return std::find(reservedScopes.begin(), reservedScopes.end(), scope) != reservedScopes.end();
|
|
}
|
|
|
|
/// reserved scope name for referencing built-in (e.g. H3) objects
|
|
inline const std::string & scopeBuiltin()
|
|
{
|
|
static const std::string scope = "core";
|
|
return scope;
|
|
}
|
|
|
|
/// reserved scope name for accessing objects from any loaded mod
|
|
inline const std::string & scopeGame()
|
|
{
|
|
static const std::string scope = "game";
|
|
return scope;
|
|
}
|
|
|
|
/// reserved scope name for accessing object for map loading
|
|
inline const std::string & scopeMap()
|
|
{
|
|
//TODO: implement accessing map dependencies for both H3 and VCMI maps
|
|
// for now, allow access to any identifiers
|
|
static const std::string scope = "game";
|
|
return scope;
|
|
}
|
|
|
|
};
|
|
|
|
VCMI_LIB_NAMESPACE_END
|