Small optimization
This commit is contained in:
parent
5c2e089404
commit
d8a3bf135e
@ -64,7 +64,7 @@ void notification::vm_notify_stub(const unsigned int notify_id, const unsigned s
|
|||||||
|
|
||||||
if (e.name == "touch") return; // Skip that for now
|
if (e.name == "touch") return; // Skip that for now
|
||||||
|
|
||||||
//printf("%X %X: %s\n", e.entity_id, *game::native::levelEntityId, e.name.data());
|
//printf("%X: %s\n", e.entity_id, e.name.data());
|
||||||
|
|
||||||
for (auto value = stack; value->type != game::native::SCRIPT_END; --value)
|
for (auto value = stack; value->type != game::native::SCRIPT_END; --value)
|
||||||
{
|
{
|
||||||
|
@ -75,12 +75,12 @@ void scripting::entity::notify(const std::string& event, const std::vector<chais
|
|||||||
this->environment_->notify(event, this->get_entity_id(), arguments);
|
this->environment_->notify(event, this->get_entity_id(), arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
void scripting::entity::set(const std::string& field, const chaiscript::Boxed_Value& value)
|
void scripting::entity::set(const std::string& field, const chaiscript::Boxed_Value& value) const
|
||||||
{
|
{
|
||||||
this->environment_->set_entity_field(field, this->get_entity_id(), value);
|
this->environment_->set_entity_field(field, this->get_entity_id(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
chaiscript::Boxed_Value scripting::entity::get(const std::string& field)
|
chaiscript::Boxed_Value scripting::entity::get(const std::string& field) const
|
||||||
{
|
{
|
||||||
return this->environment_->get_entity_field(field, this->get_entity_id());
|
return this->environment_->get_entity_field(field, this->get_entity_id());
|
||||||
}
|
}
|
||||||
@ -543,7 +543,7 @@ void scripting::stop_execution()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int scripting::get_field_id(const int classnum, const std::string& field)
|
int scripting::get_field_id(const int classnum, const std::string& field) const
|
||||||
{
|
{
|
||||||
const auto field_name = utils::string::to_lower(field);
|
const auto field_name = utils::string::to_lower(field);
|
||||||
const auto class_id = game::native::g_classMap[classnum].id;
|
const auto class_id = game::native::g_classMap[classnum].id;
|
||||||
@ -626,7 +626,7 @@ chaiscript::Boxed_Value scripting::get_entity_field(const std::string& field, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
void scripting::notify(const std::string& event, const unsigned int entity_id,
|
void scripting::notify(const std::string& event, const unsigned int entity_id,
|
||||||
std::vector<chaiscript::Boxed_Value> arguments)
|
std::vector<chaiscript::Boxed_Value> arguments) const
|
||||||
{
|
{
|
||||||
stack_context _;
|
stack_context _;
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ public:
|
|||||||
chaiscript::Boxed_Value call(const std::string& function, const std::vector<chaiscript::Boxed_Value>& arguments) const;
|
chaiscript::Boxed_Value call(const std::string& function, const std::vector<chaiscript::Boxed_Value>& arguments) const;
|
||||||
void notify(const std::string& event, const std::vector<chaiscript::Boxed_Value>& arguments) const;
|
void notify(const std::string& event, const std::vector<chaiscript::Boxed_Value>& arguments) const;
|
||||||
|
|
||||||
void set(const std::string& field, const chaiscript::Boxed_Value& value);
|
void set(const std::string& field, const chaiscript::Boxed_Value& value) const;
|
||||||
chaiscript::Boxed_Value get(const std::string& field);
|
chaiscript::Boxed_Value get(const std::string& field) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
scripting* environment_;
|
scripting* environment_;
|
||||||
@ -111,14 +111,14 @@ private:
|
|||||||
static void start_execution();
|
static void start_execution();
|
||||||
static void stop_execution();
|
static void stop_execution();
|
||||||
|
|
||||||
int get_field_id(int classnum, const std::string& field);
|
int get_field_id(int classnum, const std::string& field) const;
|
||||||
void set_entity_field(const std::string& field, unsigned int entity_id, const chaiscript::Boxed_Value& value);
|
void set_entity_field(const std::string& field, unsigned int entity_id, const chaiscript::Boxed_Value& value);
|
||||||
chaiscript::Boxed_Value get_entity_field(const std::string& field, unsigned int entity_id);
|
chaiscript::Boxed_Value get_entity_field(const std::string& field, unsigned int entity_id);
|
||||||
|
|
||||||
static bool set_entity_field_safe(game::native::scr_entref_t entref, int offset);
|
static bool set_entity_field_safe(game::native::scr_entref_t entref, int offset);
|
||||||
static bool get_entity_field_safe(game::native::scr_entref_t entref, int offset, game::native::VariableValue* value);
|
static bool get_entity_field_safe(game::native::scr_entref_t entref, int offset, game::native::VariableValue* value);
|
||||||
|
|
||||||
void notify(const std::string& event, unsigned int entity_id, std::vector<chaiscript::Boxed_Value> arguments);
|
void notify(const std::string& event, unsigned int entity_id, std::vector<chaiscript::Boxed_Value> arguments) const;
|
||||||
|
|
||||||
void push_param(const chaiscript::Boxed_Value& value) const;
|
void push_param(const chaiscript::Boxed_Value& value) const;
|
||||||
chaiscript::Boxed_Value get_return_value();
|
chaiscript::Boxed_Value get_return_value();
|
||||||
|
Loading…
Reference in New Issue
Block a user