mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 05:21:49 +00:00
add resource-aliases.json
This commit is contained in:
parent
e154bd6ac1
commit
4c3ce8c174
4 changed files with 41 additions and 1 deletions
|
|
@ -137,12 +137,21 @@ public:
|
|||
|
||||
static constexpr size_t MISSING = SIZE_MAX;
|
||||
|
||||
void add(std::string name, dv::value map) {
|
||||
void add(const std::string& name, dv::value map) {
|
||||
indices[name] = names.size();
|
||||
names.push_back(name);
|
||||
savedData->push_back(std::move(map));
|
||||
}
|
||||
|
||||
void addAlias(const std::string& name, const std::string& alias) {
|
||||
size_t index = indexOf(name);
|
||||
if (index == MISSING) {
|
||||
throw std::runtime_error(
|
||||
"resource does not exists: "+name);
|
||||
}
|
||||
indices[alias] = index;
|
||||
}
|
||||
|
||||
const std::string& getName(size_t index) const {
|
||||
return names.at(index);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue