Skip to content

Commit

Permalink
Adds Value::set_by_id()
Browse files Browse the repository at this point in the history
Seemed weird to not have this when get_by_id() is available. API improvements, woo!
  • Loading branch information
Altoids1 committed Sep 10, 2021
1 parent 9d09c80 commit d709851
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions byond-extools/src/core/byond_structures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ void Value::set(std::string name, Value newvalue)
SetVariable(type, value, Core::GetStringId(name), newvalue);
}

void Value::set_by_id(int id, Value newvalue)
{
SetVariable(type, value, id, newvalue);
}

ManagedValue Value::invoke(std::string name, std::vector<Value> args, Value usr)
{
std::replace(name.begin(), name.end(), '_', ' ');
Expand Down
1 change: 1 addition & 0 deletions byond-extools/src/core/byond_structures.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ struct Value
std::unordered_map<std::string, Value> get_all_vars();
bool has_var(std::string name);
void set(std::string name, Value value);
void set_by_id(int id, Value newvalue);
};

struct ManagedValue : Value
Expand Down

0 comments on commit d709851

Please sign in to comment.