mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix input
This commit is contained in:
parent
bccdeec7b8
commit
611c6fa444
2 changed files with 13 additions and 4 deletions
|
|
@ -239,6 +239,13 @@ const Binding& Bindings::require(const std::string& name) const {
|
|||
throw std::runtime_error("binding '" + name + "' does not exist");
|
||||
}
|
||||
|
||||
Binding& Bindings::require(const std::string& name) {
|
||||
if (const auto found = get(name)) {
|
||||
return *found;
|
||||
}
|
||||
throw std::runtime_error("binding '" + name + "' does not exist");
|
||||
}
|
||||
|
||||
void Bindings::read(const dv::value& map, BindType bindType) {
|
||||
for (auto& [sectionName, section] : map.asObject()) {
|
||||
for (auto& [name, value] : section.asObject()) {
|
||||
|
|
|
|||
|
|
@ -204,7 +204,11 @@ public:
|
|||
}
|
||||
|
||||
Binding* get(const std::string& name) {
|
||||
return const_cast<Bindings*>(this)->get(name);
|
||||
const auto found = bindings.find(name);
|
||||
if (found == bindings.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
return &found->second;
|
||||
}
|
||||
|
||||
const Binding* get(const std::string& name) const {
|
||||
|
|
@ -215,9 +219,7 @@ public:
|
|||
return &found->second;
|
||||
}
|
||||
|
||||
Binding& require(const std::string& name) {
|
||||
return const_cast<Bindings*>(this)->require(name);
|
||||
}
|
||||
Binding& require(const std::string& name);
|
||||
|
||||
const Binding& require(const std::string& name) const;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue