Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Style: Apply `readability-identifier-naming` rules

Thaddeus Crewsa3088fecf183
diff --git a/core/config/engine.cpp b/core/config/engine.cpp
index 6c9834726a6..9c2fecda39e 100644
--- a/core/config/engine.cpp
+++ b/core/config/engine.cpp
@@ -174,18 +174,18 @@ Dictionary Engine::get_version_info() const {
return dict;
}
-static Array array_from_info(const char *const *info_list) {
+static Array array_from_info(const char *const *p_info_list) {
Array arr;
- for (int i = 0; info_list[i] != nullptr; i++) {
- arr.push_back(String::utf8(info_list[i]));
+ for (int i = 0; p_info_list[i] != nullptr; i++) {
+ arr.push_back(String::utf8(p_info_list[i]));
}
return arr;
}
-static Array array_from_info_count(const char *const *info_list, int info_count) {
+static Array array_from_info_count(const char *const *p_info_list, int p_info_count) {
Array arr;
- for (int i = 0; i < info_count; i++) {
- arr.push_back(String::utf8(info_list[i]));
+ for (int i = 0; i < p_info_count; i++) {
+ arr.push_back(String::utf8(p_info_list[i]));
}
return arr;
}
diff --git a/core/config/project_settings.h b/core/config/project_settings.h
index e197a8d93b8..bd6f7162ae6 100644
--- a/core/config/project_settings.h
+++ b/core/config/project_settings.h
@@ -133,8 +133,8 @@ protected:
Error _load_settings_binary(const String &p_path);
Error _load_settings_text_or_binary(const String &p_text_path, const String &p_bin_path);
- Error _save_settings_text(const String &p_file, const RBMap<String, List<String>> &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
- Error _save_settings_binary(const String &p_file, const RBMap<String, List<String>> &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
+ Error _save_settings_text(const String &p_file, const RBMap<String, List<String>> &p_props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
+ Error _save_settings_binary(const String &p_file, const RBMap<String, List<String>> &p_props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
Error _save_custom_bnd(const String &p_file);
diff --git a/core/core_bind.cpp b/core/core_bind.cpp
index 72a57476c74..effc7f659f0 100644
--- a/core/core_bind.cpp
+++ b/core/core_bind.cpp
@@ -946,9 +946,9 @@ Variant Geometry2D::line_intersects_line(const Vector2 &p_from_a, const Vector2
}
}
-Vector<Vector2> Geometry2D::get_closest_points_between_segments(const Vector2 &p1, const Vector2 &q1, const Vector2 &p2, const Vector2 &q2) {
+Vector<Vector2> Geometry2D::get_closest_points_between_segments(const Vector2 &p_p1, const Vector2 &p_q1, const Vector2 &p_p2, const Vector2 &p_q2) {
Vector2 r1, r2;
- ::Geometry2D::get_closest_points_between_segments(p1, q1, p2, q2, r1, r2);
+ ::Geometry2D::get_closest_points_between_segments(p_p1, p_q1, p_p2, p_q2, r1, r2);
Vector<Vector2> r = { r1, r2 };
return r;
}
@@ -961,8 +961,8 @@ Vector2 Geometry2D::get_closest_point_to_segment_uncapped(const Vector2 &p_point
return ::Geometry2D::get_closest_point_to_segment_uncapped(p_point, p_a, p_b);
}
-bool Geometry2D::point_is_inside_triangle(const Vector2 &s, const Vector2 &a, const Vector2 &b, const Vector2 &c) const {
- return ::Geometry2D::is_point_in_triangle(s, a, b, c);
+bool Geometry2D::point_is_inside_triangle(const Vector2 &p_s, const Vector2 &p_a, const Vector2 &p_b, const Vector2 &p_c) const {
+ return ::Geometry2D::is_point_in_triangle(p_s, p_a, p_b, p_c);
}
bool Geometry2D::is_polygon_clockwise(const Vector<Vector2> &p_polygon) {
@@ -1205,9 +1205,9 @@ TypedArray<Plane> Geometry3D::build_capsule_planes(float p_radius, float p_heigh
return ret;
}
-Vector<Vector3> Geometry3D::get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2) {
+Vector<Vector3> Geometry3D::get_closest_points_between_segments(const Vector3 &p_p1, const Vector3 &p_p2, const Vector3 &p_q1, const Vector3 &p_q2) {
Vector3 r1, r2;
- ::Geometry3D::get_closest_points_between_segments(p1, p2, q1, q2, r1, r2);
+ ::Geometry3D::get_closest_points_between_segments(p_p1, p_p2, p_q1, p_q2, r1, r2);
Vector<Vector3> r = { r1, r2 };
return r;
}
@@ -1461,8 +1461,8 @@ void Mutex::_bind_methods() {
////// Thread //////
-void Thread::_start_func(void *ud) {
- Ref<Thread> *tud = (Ref<Thread> *)ud;
+void Thread::_start_func(void *p_ud) {
+ Ref<Thread> *tud = (Ref<Thread> *)p_ud;
Ref<Thread> t = *tud;
memdelete(tud);
diff --git a/core/core_bind.h b/core/core_bind.h
index b71a1d50901..b12beeeb673 100644
--- a/core/core_bind.h
+++ b/core/core_bind.h
@@ -335,10 +335,10 @@ public:
static Geometry2D *get_singleton();
Variant segment_intersects_segment(const Vector2 &p_from_a, const Vector2 &p_to_a, const Vector2 &p_from_b, const Vector2 &p_to_b);
Variant line_intersects_line(const Vector2 &p_from_a, const Vector2 &p_dir_a, const Vector2 &p_from_b, const Vector2 &p_dir_b);
- Vector<Vector2> get_closest_points_between_segments(const Vector2 &p1, const Vector2 &q1, const Vector2 &p2, const Vector2 &q2);
+ Vector<Vector2> get_closest_points_between_segments(const Vector2 &p_p1, const Vector2 &p_q1, const Vector2 &p_p2, const Vector2 &p_q2);
Vector2 get_closest_point_to_segment(const Vector2 &p_point, const Vector2 &p_a, const Vector2 &p_b);
Vector2 get_closest_point_to_segment_uncapped(const Vector2 &p_point, const Vector2 &p_a, const Vector2 &p_b);
- bool point_is_inside_triangle(const Vector2 &s, const Vector2 &a, const Vector2 &b, const Vector2 &c) const;
+ bool point_is_inside_triangle(const Vector2 &p_s, const Vector2 &p_a, const Vector2 &p_b, const Vector2 &p_c) const;
bool is_point_in_circle(const Vector2 &p_point, const Vector2 &p_circle_pos, real_t p_circle_radius);
real_t segment_intersects_circle(const Vector2 &p_from, const Vector2 &p_to, const Vector2 &p_circle_pos, real_t p_circle_radius);
@@ -403,7 +403,7 @@ public:
TypedArray<Plane> build_box_planes(const Vector3 &p_extents);
TypedArray<Plane> build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis = Vector3::AXIS_Z);
TypedArray<Plane> build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis = Vector3::AXIS_Z);
- Vector<Vector3> get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2);
+ Vector<Vector3> get_closest_points_between_segments(const Vector3 &p_p1, const Vector3 &p_p2, const Vector3 &p_q1, const Vector3 &p_q2);
Vector3 get_closest_point_to_segment(const Vector3 &p_point, const Vector3 &p_a, const Vector3 &p_b);
Vector3 get_closest_point_to_segment_uncapped(const Vector3 &p_point, const Vector3 &p_a, const Vector3 &p_b);
Vector3 get_triangle_barycentric_coords(const Vector3 &p_point, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2);
@@ -482,7 +482,7 @@ protected:
Callable target_callable;
::Thread thread;
static void _bind_methods();
- static void _start_func(void *ud);
+ static void _start_func(void *p_ud);
public:
enum Priority {
diff --git a/core/crypto/crypto.h b/core/crypto/crypto.h
index 53393219659..84a741b5535 100644
--- a/core/crypto/crypto.h
+++ b/core/crypto/crypto.h
@@ -63,7 +63,7 @@ public:
virtual Error load_from_memory(const uint8_t *p_buffer, int p_len) = 0;
virtual Error save(const String &p_path) = 0;
virtual String save_to_string() = 0;
- virtual Error load_from_string(const String &string) = 0;
+ virtual Error load_from_string(const String &p_string) = 0;
};
class TLSOptions : public RefCounted {
diff --git a/core/debugger/debugger_marshalls.cpp b/core/debugger/debugger_marshalls.cpp
index d66f92b20a5..fc4dfecf20b 100644
--- a/core/debugger/debugger_marshalls.cpp
+++ b/core/debugger/debugger_marshalls.cpp
@@ -62,7 +62,7 @@ bool DebuggerMarshalls::ScriptStackDump::deserialize(const Array &p_arr) {
return true;
}
-Array DebuggerMarshalls::ScriptStackVariable::serialize(int max_size) {
+Array DebuggerMarshalls::ScriptStackVariable::serialize(int p_max_size) {
Array arr = { name, type, value.get_type() };
Variant var = value;
@@ -76,7 +76,7 @@ Array DebuggerMarshalls::ScriptStackVariable::serialize(int max_size) {
ERR_PRINT("Failed to encode variant.");
}
- if (len > max_size) {
+ if (len > p_max_size) {
arr.push_back(Variant());
} else {
arr.push_back(var);
diff --git a/core/debugger/debugger_marshalls.h b/core/debugger/debugger_marshalls.h
index e0ed5c3cf8f..57494a78a01 100644
--- a/core/debugger/debugger_marshalls.h
+++ b/core/debugger/debugger_marshalls.h
@@ -41,7 +41,7 @@ struct DebuggerMarshalls {
int var_type = -1;
String type_hint;
- Array serialize(int max_size = 1 << 20); // 1 MiB default.
+ Array serialize(int p_max_size = 1 << 20); // 1 MiB default.
bool deserialize(const Array &p_arr);
};
diff --git a/core/debugger/local_debugger.cpp b/core/debugger/local_debugger.cpp
index 42e6c323244..6b174ea763b 100644
--- a/core/debugger/local_debugger.cpp
+++ b/core/debugger/local_debugger.cpp
@@ -38,8 +38,8 @@
struct LocalDebugger::ScriptsProfiler {
struct ProfileInfoSort {
- bool operator()(const ScriptLanguage::ProfilingInfo &A, const ScriptLanguage::ProfilingInfo &B) const {
- return A.total_time > B.total_time;
+ bool operator()(const ScriptLanguage::ProfilingInfo &p_left, const ScriptLanguage::ProfilingInfo &p_right) const {
+ return p_left.total_time > p_right.total_time;
}
};
@@ -330,20 +330,20 @@ void LocalDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
}
}
-void LocalDebugger::print_variables(const List<String> &names, const List<Variant> &values, const String &variable_prefix) {
+void LocalDebugger::print_variables(const List<String> &p_names, const List<Variant> &p_values, const String &p_variable_prefix) {
String value;
Vector<String> value_lines;
- const List<Variant>::Element *V = values.front();
- for (const String &E : names) {
+ const List<Variant>::Element *V = p_values.front();
+ for (const String &E : p_names) {
value = String(V->get());
- if (variable_prefix.is_empty()) {
+ if (p_variable_prefix.is_empty()) {
print_line(E + ": " + String(V->get()));
} else {
print_line(E + ":");
value_lines = value.split("\n");
for (int i = 0; i < value_lines.size(); ++i) {
- print_line(variable_prefix + value_lines[i]);
+ print_line(p_variable_prefix + value_lines[i]);
}
}
diff --git a/core/debugger/local_debugger.h b/core/debugger/local_debugger.h
index 91c8d8be409..04c2648d5a8 100644
--- a/core/debugger/local_debugger.h
+++ b/core/debugger/local_debugger.h
@@ -43,7 +43,7 @@ private:
HashMap<String, String> options;
Pair<String, int> to_breakpoint(const String &p_line);
- void print_variables(const List<String> &names, const List<Variant> &values, const String &variable_prefix);
+ void print_variables(const List<String> &p_names, const List<Variant> &p_values, const String &p_variable_prefix);
public:
void debug(bool p_can_continue, bool p_is_error_breakpoint);
diff --git a/core/debugger/remote_debugger_peer.cpp b/core/debugger/remote_debugger_peer.cpp
index 483fdf1ba1c..c42c4f2ffcf 100644
--- a/core/debugger/remote_debugger_peer.cpp
+++ b/core/debugger/remote_debugger_peer.cpp
@@ -170,24 +170,24 @@ void RemoteDebuggerPeerTCP::_read_in() {
}
}
-Error RemoteDebuggerPeerTCP::_try_connect(Ref<StreamPeerSocket> tcp_client) {
+Error RemoteDebuggerPeerTCP::_try_connect(Ref<StreamPeerSocket> p_tcp_client) {
const int tries = 6;
const int waits[tries] = { 1, 10, 100, 1000, 1000, 1000 };
for (int i = 0; i < tries; i++) {
- tcp_client->poll();
- if (tcp_client->get_status() == StreamPeerTCP::STATUS_CONNECTED) {
+ p_tcp_client->poll();
+ if (p_tcp_client->get_status() == StreamPeerTCP::STATUS_CONNECTED) {
print_verbose("Remote Debugger: Connected!");
break;
} else {
const int ms = waits[i];
OS::get_singleton()->delay_usec(ms * 1000);
- print_verbose("Remote Debugger: Connection failed with status: '" + String::num_int64(tcp_client->get_status()) + "', retrying in " + String::num_int64(ms) + " msec.");
+ print_verbose("Remote Debugger: Connection failed with status: '" + String::num_int64(p_tcp_client->get_status()) + "', retrying in " + String::num_int64(ms) + " msec.");
}
}
- if (tcp_client->get_status() != StreamPeerTCP::STATUS_CONNECTED) {
- ERR_PRINT(vformat("Remote Debugger: Unable to connect. Status: %s.", String::num_int64(tcp_client->get_status())));
+ if (p_tcp_client->get_status() != StreamPeerTCP::STATUS_CONNECTED) {
+ ERR_PRINT(vformat("Remote Debugger: Unable to connect. Status: %s.", String::num_int64(p_tcp_client->get_status())));
return FAILED;
}
return OK;
diff --git a/core/error/error_macros.h b/core/error/error_macros.h
index e4c34a267af..3a00d54815a 100644
--- a/core/error/error_macros.h
+++ b/core/error/error_macros.h
@@ -78,8 +78,8 @@ _NO_INLINE_ void _err_print_error(const char *p_function, const char *p_file, in
_NO_INLINE_ void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, const String &p_message, bool p_editor_notify = false, ErrorHandlerType p_type = ERR_HANDLER_ERROR);
_NO_INLINE_ void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, const String &p_message, bool p_editor_notify = false, ErrorHandlerType p_type = ERR_HANDLER_ERROR);
void _err_print_error_asap(const String &p_error, ErrorHandlerType p_type = ERR_HANDLER_ERROR);
-_NO_INLINE_ void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, const char *p_message = "", bool p_editor_notify = false, bool fatal = false);
-_NO_INLINE_ void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, const String &p_message, bool p_editor_notify = false, bool fatal = false);
+_NO_INLINE_ void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, const char *p_message = "", bool p_editor_notify = false, bool p_fatal = false);
+_NO_INLINE_ void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, const String &p_message, bool p_editor_notify = false, bool p_fatal = false);
_NO_INLINE_ void _err_flush_stdout();
void _physics_interpolation_warning(const char *p_function, const char *p_file, int p_line, ObjectID p_id, const char *p_warn_string);
diff --git a/core/extension/extension_api_dump.cpp b/core/extension/extension_api_dump.cpp
index 9094c26f0bf..59cd8fef73c 100644
--- a/core/extension/extension_api_dump.cpp
+++ b/core/extension/extension_api_dump.cpp
@@ -88,9 +88,9 @@ static String get_property_info_type_name(const PropertyInfo &p_info) {
return get_builtin_or_variant_type_name(p_info.type);
}
-static String get_type_meta_name(const GodotTypeInfo::Metadata metadata) {
+static String get_type_meta_name(const GodotTypeInfo::Metadata p_metadata) {
static const char *argmeta[14] = { "none", "int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64", "float", "double", "char16", "char32", "required" };
- return argmeta[metadata];
+ return argmeta[p_metadata];
}
static String fix_doc_description(const String &p_bbcode) {
@@ -143,8 +143,8 @@ Dictionary GDExtensionAPIDump::generate_extension_api(bool p_include_docs) {
uint32_t size_64_bits_real_double;
// For compile-time size check.
- constexpr uint32_t operator[](int index) const {
- switch (index) {
+ constexpr uint32_t operator[](int p_index) const {
+ switch (p_index) {
#ifndef REAL_T_IS_DOUBLE
case sizeof(uint32_t):
return size_32_bits_real_float;
diff --git a/core/input/input.cpp b/core/input/input.cpp
index 2983a40908d..54045c47ccb 100644
--- a/core/input/input.cpp
+++ b/core/input/input.cpp
@@ -1973,11 +1973,11 @@ void Input::_update_joypad_features(int p_device) {
}
}
-Input::JoyEvent Input::_get_mapped_button_event(const JoyDeviceMapping &mapping, JoyButton p_button) {
+Input::JoyEvent Input::_get_mapped_button_event(const JoyDeviceMapping &p_mapping, JoyButton p_button) {
JoyEvent event;
- for (int i = 0; i < mapping.bindings.size(); i++) {
- const JoyBinding binding = mapping.bindings[i];
+ for (int i = 0; i < p_mapping.bindings.size(); i++) {
+ const JoyBinding binding = p_mapping.bindings[i];
if (binding.inputType == TYPE_BUTTON && binding.input.button == p_button) {
event.type = binding.outputType;
switch (binding.outputType) {
@@ -2008,11 +2008,11 @@ Input::JoyEvent Input::_get_mapped_button_event(const JoyDeviceMapping &mapping,
return event;
}
-Input::JoyEvent Input::_get_mapped_axis_event(const JoyDeviceMapping &mapping, JoyAxis p_axis, float p_value, JoyAxisRange &r_range) {
+Input::JoyEvent Input::_get_mapped_axis_event(const JoyDeviceMapping &p_mapping, JoyAxis p_axis, float p_value, JoyAxisRange &r_range) {
JoyEvent event;
- for (int i = 0; i < mapping.bindings.size(); i++) {
- const JoyBinding binding = mapping.bindings[i];
+ for (int i = 0; i < p_mapping.bindings.size(); i++) {
+ const JoyBinding binding = p_mapping.bindings[i];
if (binding.inputType == TYPE_AXIS && binding.input.axis.axis == p_axis) {
float value = p_value;
if (binding.input.axis.invert) {
@@ -2078,9 +2078,9 @@ Input::JoyEvent Input::_get_mapped_axis_event(const JoyDeviceMapping &mapping, J
return event;
}
-void Input::_get_mapped_hat_events(const JoyDeviceMapping &mapping, HatDir p_hat, JoyEvent r_events[(size_t)HatDir::MAX]) {
- for (int i = 0; i < mapping.bindings.size(); i++) {
- const JoyBinding binding = mapping.bindings[i];
+void Input::_get_mapped_hat_events(const JoyDeviceMapping &p_mapping, HatDir p_hat, JoyEvent r_events[(size_t)HatDir::MAX]) {
+ for (int i = 0; i < p_mapping.bindings.size(); i++) {
+ const JoyBinding binding = p_mapping.bindings[i];
if (binding.inputType == TYPE_HAT && binding.input.hat.hat == p_hat) {
HatDir hat_direction;
switch (binding.input.hat.hat_mask) {
@@ -2129,18 +2129,18 @@ void Input::_get_mapped_hat_events(const JoyDeviceMapping &mapping, HatDir p_hat
}
}
-JoyButton Input::_get_output_button(const String &output) {
+JoyButton Input::_get_output_button(const String &p_output) {
for (int i = 0; i < (int)JoyButton::SDL_MAX; i++) {
- if (output == _joy_buttons[i]) {
+ if (p_output == _joy_buttons[i]) {
return JoyButton(i);
}
}
return JoyButton::INVALID;
}
-JoyAxis Input::_get_output_axis(const String &output) {
+JoyAxis Input::_get_output_axis(const String &p_output) {
for (int i = 0; i < (int)JoyAxis::SDL_MAX; i++) {
- if (output == _joy_axes[i]) {
+ if (p_output == _joy_axes[i]) {
return JoyAxis(i);
}
}
diff --git a/core/input/input.h b/core/input/input.h
index 43cd5b41ee8..a976a1693c3 100644
--- a/core/input/input.h
+++ b/core/input/input.h
@@ -306,11 +306,11 @@ private:
void _set_joypad_mapping(Joypad &p_js, int p_map_index);
- JoyEvent _get_mapped_button_event(const JoyDeviceMapping &mapping, JoyButton p_button);
- JoyEvent _get_mapped_axis_event(const JoyDeviceMapping &mapping, JoyAxis p_axis, float p_value, JoyAxisRange &r_range);
- void _get_mapped_hat_events(const JoyDeviceMapping &mapping, HatDir p_hat, JoyEvent r_events[(size_t)HatDir::MAX]);
- JoyButton _get_output_button(const String &output);
- JoyAxis _get_output_axis(const String &output);
+ JoyEvent _get_mapped_button_event(const JoyDeviceMapping &p_mapping, JoyButton p_button);
+ JoyEvent _get_mapped_axis_event(const JoyDeviceMapping &p_mapping, JoyAxis p_axis, float p_value, JoyAxisRange &r_range);
+ void _get_mapped_hat_events(const JoyDeviceMapping &p_mapping, HatDir p_hat, JoyEvent r_events[(size_t)HatDir::MAX]);
+ JoyButton _get_output_button(const String &p_output);
+ JoyAxis _get_output_axis(const String &p_output);
void _button_event(int p_device, JoyButton p_index, bool p_pressed);
void _axis_event(int p_device, JoyAxis p_axis, float p_value);
void _update_action_cache(const StringName &p_action_name, ActionState &r_action_state);
diff --git a/core/input/input_enums.h b/core/input/input_enums.h
index b0bd1540064..97f558965cb 100644
--- a/core/input/input_enums.h
+++ b/core/input/input_enums.h
@@ -153,10 +153,10 @@ enum class MouseButtonMask {
MB_XBUTTON2 = (1 << (int(MouseButton::MB_XBUTTON2) - 1)),
};
-inline MouseButtonMask mouse_button_to_mask(MouseButton button) {
- ERR_FAIL_COND_V(button == MouseButton::NONE, MouseButtonMask::NONE);
+inline MouseButtonMask mouse_button_to_mask(MouseButton p_button) {
+ ERR_FAIL_COND_V(p_button == MouseButton::NONE, MouseButtonMask::NONE);
- return MouseButtonMask(1 << ((int)button - 1));
+ return MouseButtonMask(1 << ((int)p_button - 1));
}
constexpr MouseButtonMask operator|(MouseButtonMask p_a, MouseButtonMask p_b) {
diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp
index 4228d13537f..6f16b5ad178 100644
--- a/core/input/input_event.cpp
+++ b/core/input/input_event.cpp
@@ -233,11 +233,11 @@ bool InputEventWithModifiers::is_meta_pressed() const {
return meta_pressed;
}
-void InputEventWithModifiers::set_modifiers_from_event(const InputEventWithModifiers *event) {
- set_alt_pressed(event->is_alt_pressed());
- set_shift_pressed(event->is_shift_pressed());
- set_ctrl_pressed(event->is_ctrl_pressed());
- set_meta_pressed(event->is_meta_pressed());
+void InputEventWithModifiers::set_modifiers_from_event(const InputEventWithModifiers *p_event) {
+ set_alt_pressed(p_event->is_alt_pressed());
+ set_shift_pressed(p_event->is_shift_pressed());
+ set_ctrl_pressed(p_event->is_ctrl_pressed());
+ set_meta_pressed(p_event->is_meta_pressed());
}
BitField<KeyModifierMask> InputEventWithModifiers::get_modifiers_mask() const {
diff --git a/core/input/input_event.h b/core/input/input_event.h
index c6f37d20794..a4ee7d77264 100644
--- a/core/input/input_event.h
+++ b/core/input/input_event.h
@@ -140,7 +140,7 @@ public:
void set_meta_pressed(bool p_pressed);
bool is_meta_pressed() const;
- void set_modifiers_from_event(const InputEventWithModifiers *event);
+ void set_modifiers_from_event(const InputEventWithModifiers *p_event);
BitField<KeyModifierMask> get_modifiers_mask() const;
diff --git a/core/input/input_event_codec.cpp b/core/input/input_event_codec.cpp
index ac24eb45027..71eef68e6dd 100644
--- a/core/input/input_event_codec.cpp
+++ b/core/input/input_event_codec.cpp
@@ -45,8 +45,8 @@ enum class BoolShift : uint8_t {
};
// cast operator for BoolShift to uint8_t
-inline uint8_t operator<<(uint8_t a, BoolShift b) {
- return a << static_cast<uint8_t>(b);
+inline uint8_t operator<<(uint8_t p_left, BoolShift p_right) {
+ return p_left << static_cast<uint8_t>(p_right);
}
uint8_t encode_key_modifier_state(Ref<InputEventWithModifiers> p_event) {
@@ -58,11 +58,11 @@ uint8_t encode_key_modifier_state(Ref<InputEventWithModifiers> p_event) {
return bools;
}
-void decode_key_modifier_state(uint8_t bools, Ref<InputEventWithModifiers> p_event) {
- p_event->set_shift_pressed(bools & (1 << BoolShift::SHIFT));
- p_event->set_ctrl_pressed(bools & (1 << BoolShift::CTRL));
- p_event->set_alt_pressed(bools & (1 << BoolShift::ALT));
- p_event->set_meta_pressed(bools & (1 << BoolShift::META));
+void decode_key_modifier_state(uint8_t p_bools, Ref<InputEventWithModifiers> p_event) {
+ p_event->set_shift_pressed(p_bools & (1 << BoolShift::SHIFT));
+ p_event->set_ctrl_pressed(p_bools & (1 << BoolShift::CTRL));
+ p_event->set_alt_pressed(p_bools & (1 << BoolShift::ALT));
+ p_event->set_meta_pressed(p_bools & (1 << BoolShift::META));
}
int encode_vector2(const Vector2 &p_vector, uint8_t *p_data) {
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp
index dd5c068660f..81b72a0ef82 100644
--- a/core/io/config_file.cpp
+++ b/core/io/config_file.cpp
@@ -188,22 +188,22 @@ Error ConfigFile::save_encrypted_pass(const String &p_path, const String &p_pass
return _internal_save(fae);
}
-Error ConfigFile::_internal_save(Ref<FileAccess> file) {
+Error ConfigFile::_internal_save(Ref<FileAccess> p_file) {
bool first = true;
for (const KeyValue<String, HashMap<String, Variant>> &E : values) {
if (first) {
first = false;
} else {
- file->store_string("\n");
+ p_file->store_string("\n");
}
if (!E.key.is_empty()) {
- file->store_string("[" + E.key.replace("]", "\\]") + "]\n\n");
+ p_file->store_string("[" + E.key.replace("]", "\\]") + "]\n\n");
}
for (const KeyValue<String, Variant> &F : E.value) {
String vstr;
VariantWriter::write_to_string(F.value, vstr);
- file->store_string(F.key.property_name_encode() + "=" + vstr + "\n");
+ p_file->store_string(F.key.property_name_encode() + "=" + vstr + "\n");
}
}
@@ -256,9 +256,9 @@ Error ConfigFile::load_encrypted_pass(const String &p_path, const String &p_pass
return _internal_load(p_path, fae);
}
-Error ConfigFile::_internal_load(const String &p_path, Ref<FileAccess> f) {
+Error ConfigFile::_internal_load(const String &p_path, Ref<FileAccess> p_file) {
VariantParser::StreamFile stream;
- stream.f = f;
+ stream.f = p_file;
Error err = _parse(p_path, &stream);
diff --git a/core/io/config_file.h b/core/io/config_file.h
index 518361f4a7f..784956b2490 100644
--- a/core/io/config_file.h
+++ b/core/io/config_file.h
@@ -40,8 +40,8 @@ class ConfigFile : public RefCounted {
HashMap<String, HashMap<String, Variant>> values;
- Error _internal_load(const String &p_path, Ref<FileAccess> f);
- Error _internal_save(Ref<FileAccess> file);
+ Error _internal_load(const String &p_path, Ref<FileAccess> p_file);
+ Error _internal_save(Ref<FileAccess> p_file);
Error _parse(const String &p_path, VariantParser::Stream *p_stream);
diff --git a/core/io/dir_access.cpp b/core/io/dir_access.cpp
index dcd24db7b33..ddec83b0b54 100644
--- a/core/io/dir_access.cpp
+++ b/core/io/dir_access.cpp
@@ -75,39 +75,39 @@ bool DirAccess::drives_are_shortcuts() {
return false;
}
-static Error _erase_recursive(DirAccess *da) {
+static Error _erase_recursive(DirAccess *p_dir) {
List<String> dirs;
List<String> files;
- da->list_dir_begin();
- String n = da->get_next();
+ p_dir->list_dir_begin();
+ String n = p_dir->get_next();
while (!n.is_empty()) {
if (n != "." && n != "..") {
- if (da->current_is_dir() && !da->is_link(n)) {
+ if (p_dir->current_is_dir() && !p_dir->is_link(n)) {
dirs.push_back(n);
} else {
files.push_back(n);
}
}
- n = da->get_next();
+ n = p_dir->get_next();
}
- da->list_dir_end();
+ p_dir->list_dir_end();
for (const String &E : dirs) {
- Error err = da->change_dir(E);
+ Error err = p_dir->change_dir(E);
if (err == OK) {
- err = _erase_recursive(da);
+ err = _erase_recursive(p_dir);
if (err) {
- da->change_dir("..");
+ p_dir->change_dir("..");
return err;
}
- err = da->change_dir("..");
+ err = p_dir->change_dir("..");
if (err) {
return err;
}
- err = da->remove(da->get_current_dir().path_join(E));
+ err = p_dir->remove(p_dir->get_current_dir().path_join(E));
if (err) {
return err;
}
@@ -117,7 +117,7 @@ static Error _erase_recursive(DirAccess *da) {
}
for (const String &E : files) {
- Error err = da->remove(da->get_current_dir().path_join(E));
+ Error err = p_dir->remove(p_dir->get_current_dir().path_join(E));
if (err) {
return err;
}
diff --git a/core/io/file_access.cpp b/core/io/file_access.cpp
index 9bd1b450ac0..e16e06eb393 100644
--- a/core/io/file_access.cpp
+++ b/core/io/file_access.cpp
@@ -432,12 +432,12 @@ public:
capacity(std_size(stack_buffer)) {
}
- _FORCE_INLINE_ void push_back(char c) {
+ _FORCE_INLINE_ void push_back(char p_char) {
if (written >= capacity) {
ERR_FAIL_COND(!grow());
}
- buffer[written++] = c;
+ buffer[written++] = p_char;
}
_FORCE_INLINE_ const char *get_data() const {
diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp
index 2bb9db761d4..38688121ecc 100644
--- a/core/io/file_access_zip.cpp
+++ b/core/io/file_access_zip.cpp
@@ -40,8 +40,8 @@ struct ZipData {
Ref<FileAccess> f;
};
-static void *godot_open(voidpf opaque, const char *p_fname, int mode) {
- if (mode & ZLIB_FILEFUNC_MODE_WRITE) {
+static void *godot_open(voidpf p_opaque, const char *p_fname, int p_mode) {
+ if (p_mode & ZLIB_FILEFUNC_MODE_WRITE) {
return nullptr;
}
@@ -53,31 +53,31 @@ static void *godot_open(voidpf opaque, const char *p_fname, int mode) {
return zd;
}
-static uLong godot_read(voidpf opaque, voidpf stream, void *buf, uLong size) {
- ZipData *zd = (ZipData *)stream;
- zd->f->get_buffer((uint8_t *)buf, size);
- return size;
+static uLong godot_read(voidpf p_opaque, voidpf p_stream, void *r_buf, uLong p_size) {
+ ZipData *zd = (ZipData *)p_stream;
+ zd->f->get_buffer((uint8_t *)r_buf, p_size);
+ return p_size;
}
-static uLong godot_write(voidpf opaque, voidpf stream, const void *buf, uLong size) {
+static uLong godot_write(voidpf p_opaque, voidpf p_stream, const void *p_buf, uLong p_size) {
return 0;
}
-static long godot_tell(voidpf opaque, voidpf stream) {
- ZipData *zd = (ZipData *)stream;
+static long godot_tell(voidpf p_opaque, voidpf p_stream) {
+ ZipData *zd = (ZipData *)p_stream;
return zd->f->get_position();
}
-static long godot_seek(voidpf opaque, voidpf stream, uLong offset, int origin) {
- ZipData *zd = (ZipData *)stream;
+static long godot_seek(voidpf p_opaque, voidpf p_stream, uLong p_offset, int p_origin) {
+ ZipData *zd = (ZipData *)p_stream;
- uint64_t pos = offset;
- switch (origin) {
+ uint64_t pos = p_offset;
+ switch (p_origin) {
case ZLIB_FILEFUNC_SEEK_CUR:
- pos = zd->f->get_position() + offset;
+ pos = zd->f->get_position() + p_offset;
break;
case ZLIB_FILEFUNC_SEEK_END:
- pos = zd->f->get_length() + offset;
+ pos = zd->f->get_length() + p_offset;
break;
default:
break;
@@ -87,23 +87,23 @@ static long godot_seek(voidpf opaque, voidpf stream, uLong offset, int origin) {
return 0;
}
-static int godot_close(voidpf opaque, voidpf stream) {
- ZipData *zd = (ZipData *)stream;
+static int godot_close(voidpf p_opaque, voidpf p_stream) {
+ ZipData *zd = (ZipData *)p_stream;
memdelete(zd);
return 0;
}
-static int godot_testerror(voidpf opaque, voidpf stream) {
- ZipData *zd = (ZipData *)stream;
+static int godot_testerror(voidpf p_opaque, voidpf p_stream) {
+ ZipData *zd = (ZipData *)p_stream;
return zd->f->get_error() != OK ? 1 : 0;
}
-static voidpf godot_alloc(voidpf opaque, uInt items, uInt size) {
- return memalloc((size_t)items * size);
+static voidpf godot_alloc(voidpf p_opaque, uInt p_items, uInt p_size) {
+ return memalloc((size_t)p_items * p_size);
}
-static void godot_free(voidpf opaque, voidpf address) {
- memfree(address);
+static void godot_free(voidpf p_opaque, voidpf r_address) {
+ memfree(r_address);
}
} // extern "C"
diff --git a/core/io/image.cpp b/core/io/image.cpp
index e5fa7178d40..28ac327021b 100644
--- a/core/io/image.cpp
+++ b/core/io/image.cpp
@@ -408,9 +408,9 @@ void Image::get_mipmap_offset_and_size(int p_mipmap, int64_t &r_ofs, int64_t &r_
r_size = ofs2 - ofs;
}
-void Image::get_mipmap_offset_size_and_dimensions(int p_mipmap, int64_t &r_ofs, int64_t &r_size, int &w, int &h) const {
+void Image::get_mipmap_offset_size_and_dimensions(int p_mipmap, int64_t &r_ofs, int64_t &r_size, int &p_w, int &p_h) const {
int64_t ofs;
- _get_mipmap_offset_and_size(p_mipmap, ofs, w, h);
+ _get_mipmap_offset_and_size(p_mipmap, ofs, p_w, p_h);
int64_t ofs2;
int w2, h2;
_get_mipmap_offset_and_size(p_mipmap + 1, ofs2, w2, h2);
@@ -895,15 +895,15 @@ enum ImageScaleType {
IMAGE_SCALING_FLOAT,
};
-static double _bicubic_interp_kernel(double x) {
- x = Math::abs(x);
+static double _bicubic_interp_kernel(double p_x) {
+ p_x = Math::abs(p_x);
double bc = 0;
- if (x <= 1) {
- bc = (1.5 * x - 2.5) * x * x + 1;
- } else if (x < 2) {
- bc = ((-0.5 * x + 2.5) * x - 4) * x + 2;
+ if (p_x <= 1) {
+ bc = (1.5 * p_x - 2.5) * p_x * p_x + 1;
+ } else if (p_x < 2) {
+ bc = ((-0.5 * p_x + 2.5) * p_x - 4) * p_x + 2;
}
return bc;
@@ -3456,134 +3456,134 @@ _FORCE_INLINE_ uint16_t color_to_rgb565(Color p_col) {
return rgba;
}
-Color Image::_get_color_at_ofs(const uint8_t *ptr, uint32_t ofs) const {
+Color Image::_get_color_at_ofs(const uint8_t *p_ptr, uint32_t p_ofs) const {
switch (format) {
case FORMAT_L8: {
- float l = ptr[ofs] / 255.0;
+ float l = p_ptr[p_ofs] / 255.0;
return Color(l, l, l, 1);
}
case FORMAT_LA8: {
- float l = ptr[ofs * 2 + 0] / 255.0;
- float a = ptr[ofs * 2 + 1] / 255.0;
+ float l = p_ptr[p_ofs * 2 + 0] / 255.0;
+ float a = p_ptr[p_ofs * 2 + 1] / 255.0;
return Color(l, l, l, a);
}
case FORMAT_R8: {
- float r = ptr[ofs] / 255.0;
+ float r = p_ptr[p_ofs] / 255.0;
return Color(r, 0, 0, 1);
}
case FORMAT_RG8: {
- float r = ptr[ofs * 2 + 0] / 255.0;
- float g = ptr[ofs * 2 + 1] / 255.0;
+ float r = p_ptr[p_ofs * 2 + 0] / 255.0;
+ float g = p_ptr[p_ofs * 2 + 1] / 255.0;
return Color(r, g, 0, 1);
}
case FORMAT_RGB8: {
- float r = ptr[ofs * 3 + 0] / 255.0;
- float g = ptr[ofs * 3 + 1] / 255.0;
- float b = ptr[ofs * 3 + 2] / 255.0;
+ float r = p_ptr[p_ofs * 3 + 0] / 255.0;
+ float g = p_ptr[p_ofs * 3 + 1] / 255.0;
+ float b = p_ptr[p_ofs * 3 + 2] / 255.0;
return Color(r, g, b, 1);
}
case FORMAT_RGBA8: {
- float r = ptr[ofs * 4 + 0] / 255.0;
- float g = ptr[ofs * 4 + 1] / 255.0;
- float b = ptr[ofs * 4 + 2] / 255.0;
- float a = ptr[ofs * 4 + 3] / 255.0;
+ float r = p_ptr[p_ofs * 4 + 0] / 255.0;
+ float g = p_ptr[p_ofs * 4 + 1] / 255.0;
+ float b = p_ptr[p_ofs * 4 + 2] / 255.0;
+ float a = p_ptr[p_ofs * 4 + 3] / 255.0;
return Color(r, g, b, a);
}
case FORMAT_RGBA4444: {
- return color_from_rgba4444(((uint16_t *)ptr)[ofs]);
+ return color_from_rgba4444(((uint16_t *)p_ptr)[p_ofs]);
}
case FORMAT_RGB565: {
- return color_from_rgb565(((uint16_t *)ptr)[ofs]);
+ return color_from_rgb565(((uint16_t *)p_ptr)[p_ofs]);
}
case FORMAT_RF: {
- float r = ((float *)ptr)[ofs];
+ float r = ((float *)p_ptr)[p_ofs];
return Color(r, 0, 0, 1);
}
case FORMAT_RGF: {
- float r = ((float *)ptr)[ofs * 2 + 0];
- float g = ((float *)ptr)[ofs * 2 + 1];
+ float r = ((float *)p_ptr)[p_ofs * 2 + 0];
+ float g = ((float *)p_ptr)[p_ofs * 2 + 1];
return Color(r, g, 0, 1);
}
case FORMAT_RGBF: {
- float r = ((float *)ptr)[ofs * 3 + 0];
- float g = ((float *)ptr)[ofs * 3 + 1];
- float b = ((float *)ptr)[ofs * 3 + 2];
+ float r = ((float *)p_ptr)[p_ofs * 3 + 0];
+ float g = ((float *)p_ptr)[p_ofs * 3 + 1];
+ float b = ((float *)p_ptr)[p_ofs * 3 + 2];
return Color(r, g, b, 1);
}
case FORMAT_RGBAF: {
- float r = ((float *)ptr)[ofs * 4 + 0];
- float g = ((float *)ptr)[ofs * 4 + 1];
- float b = ((float *)ptr)[ofs * 4 + 2];
- float a = ((float *)ptr)[ofs * 4 + 3];
+ float r = ((float *)p_ptr)[p_ofs * 4 + 0];
+ float g = ((float *)p_ptr)[p_ofs * 4 + 1];
+ float b = ((float *)p_ptr)[p_ofs * 4 + 2];
+ float a = ((float *)p_ptr)[p_ofs * 4 + 3];
return Color(r, g, b, a);
}
case FORMAT_RH: {
- uint16_t r = ((uint16_t *)ptr)[ofs];
+ uint16_t r = ((uint16_t *)p_ptr)[p_ofs];
return Color(Math::half_to_float(r), 0, 0, 1);
}
case FORMAT_RGH: {
- uint16_t r = ((uint16_t *)ptr)[ofs * 2 + 0];
- uint16_t g = ((uint16_t *)ptr)[ofs * 2 + 1];
+ uint16_t r = ((uint16_t *)p_ptr)[p_ofs * 2 + 0];
+ uint16_t g = ((uint16_t *)p_ptr)[p_ofs * 2 + 1];
return Color(Math::half_to_float(r), Math::half_to_float(g), 0, 1);
}
case FORMAT_RGBH: {
- uint16_t r = ((uint16_t *)ptr)[ofs * 3 + 0];
- uint16_t g = ((uint16_t *)ptr)[ofs * 3 + 1];
- uint16_t b = ((uint16_t *)ptr)[ofs * 3 + 2];
+ uint16_t r = ((uint16_t *)p_ptr)[p_ofs * 3 + 0];
+ uint16_t g = ((uint16_t *)p_ptr)[p_ofs * 3 + 1];
+ uint16_t b = ((uint16_t *)p_ptr)[p_ofs * 3 + 2];
return Color(Math::half_to_float(r), Math::half_to_float(g), Math::half_to_float(b), 1);
}
case FORMAT_RGBAH: {
- uint16_t r = ((uint16_t *)ptr)[ofs * 4 + 0];
- uint16_t g = ((uint16_t *)ptr)[ofs * 4 + 1];
- uint16_t b = ((uint16_t *)ptr)[ofs * 4 + 2];
- uint16_t a = ((uint16_t *)ptr)[ofs * 4 + 3];
+ uint16_t r = ((uint16_t *)p_ptr)[p_ofs * 4 + 0];
+ uint16_t g = ((uint16_t *)p_ptr)[p_ofs * 4 + 1];
+ uint16_t b = ((uint16_t *)p_ptr)[p_ofs * 4 + 2];
+ uint16_t a = ((uint16_t *)p_ptr)[p_ofs * 4 + 3];
return Color(Math::half_to_float(r), Math::half_to_float(g), Math::half_to_float(b), Math::half_to_float(a));
}
case FORMAT_RGBE9995: {
- return Color::from_rgbe9995(((uint32_t *)ptr)[ofs]);
+ return Color::from_rgbe9995(((uint32_t *)p_ptr)[p_ofs]);
}
case FORMAT_R16: {
- float r = ((uint16_t *)ptr)[ofs] / 65535.0f;
+ float r = ((uint16_t *)p_ptr)[p_ofs] / 65535.0f;
return Color(r, 0, 0, 1);
}
case FORMAT_RG16: {
- float r = ((uint16_t *)ptr)[ofs * 2 + 0] / 65535.0f;
- float g = ((uint16_t *)ptr)[ofs * 2 + 1] / 65535.0f;
+ float r = ((uint16_t *)p_ptr)[p_ofs * 2 + 0] / 65535.0f;
+ float g = ((uint16_t *)p_ptr)[p_ofs * 2 + 1] / 65535.0f;
return Color(r, g, 0, 1);
}
case FORMAT_RGB16: {
- float r = ((uint16_t *)ptr)[ofs * 3 + 0] / 65535.0f;
- float g = ((uint16_t *)ptr)[ofs * 3 + 1] / 65535.0f;
- float b = ((uint16_t *)ptr)[ofs * 3 + 2] / 65535.0f;
+ float r = ((uint16_t *)p_ptr)[p_ofs * 3 + 0] / 65535.0f;
+ float g = ((uint16_t *)p_ptr)[p_ofs * 3 + 1] / 65535.0f;
+ float b = ((uint16_t *)p_ptr)[p_ofs * 3 + 2] / 65535.0f;
return Color(r, g, b, 1);
}
case FORMAT_RGBA16: {
- float r = ((uint16_t *)ptr)[ofs * 4 + 0] / 65535.0f;
- float g = ((uint16_t *)ptr)[ofs * 4 + 1] / 65535.0f;
- float b = ((uint16_t *)ptr)[ofs * 4 + 2] / 65535.0f;
- float a = ((uint16_t *)ptr)[ofs * 4 + 3] / 65535.0f;
+ float r = ((uint16_t *)p_ptr)[p_ofs * 4 + 0] / 65535.0f;
+ float g = ((uint16_t *)p_ptr)[p_ofs * 4 + 1] / 65535.0f;
+ float b = ((uint16_t *)p_ptr)[p_ofs * 4 + 2] / 65535.0f;
+ float a = ((uint16_t *)p_ptr)[p_ofs * 4 + 3] / 65535.0f;
return Color(r, g, b, a);
}
case FORMAT_R16I: {
- uint16_t r = ((uint16_t *)ptr)[ofs];
+ uint16_t r = ((uint16_t *)p_ptr)[p_ofs];
return Color(r, 0, 0, 1);
}
case FORMAT_RG16I: {
- uint16_t r = ((uint16_t *)ptr)[ofs * 2 + 0];
- uint16_t g = ((uint16_t *)ptr)[ofs * 2 + 1];
+ uint16_t r = ((uint16_t *)p_ptr)[p_ofs * 2 + 0];
+ uint16_t g = ((uint16_t *)p_ptr)[p_ofs * 2 + 1];
return Color(r, g, 0, 1);
}
case FORMAT_RGB16I: {
- uint16_t r = ((uint16_t *)ptr)[ofs * 3 + 0];
- uint16_t g = ((uint16_t *)ptr)[ofs * 3 + 1];
- uint16_t b = ((uint16_t *)ptr)[ofs * 3 + 2];
+ uint16_t r = ((uint16_t *)p_ptr)[p_ofs * 3 + 0];
+ uint16_t g = ((uint16_t *)p_ptr)[p_ofs * 3 + 1];
+ uint16_t b = ((uint16_t *)p_ptr)[p_ofs * 3 + 2];
return Color(r, g, b, 1);
}
case FORMAT_RGBA16I: {
- uint16_t r = ((uint16_t *)ptr)[ofs * 4 + 0];
- uint16_t g = ((uint16_t *)ptr)[ofs * 4 + 1];
- uint16_t b = ((uint16_t *)ptr)[ofs * 4 + 2];
- uint16_t a = ((uint16_t *)ptr)[ofs * 4 + 3];
+ uint16_t r = ((uint16_t *)p_ptr)[p_ofs * 4 + 0];
+ uint16_t g = ((uint16_t *)p_ptr)[p_ofs * 4 + 1];
+ uint16_t b = ((uint16_t *)p_ptr)[p_ofs * 4 + 2];
+ uint16_t a = ((uint16_t *)p_ptr)[p_ofs * 4 + 3];
return Color(r, g, b, a);
}
@@ -3593,113 +3593,113 @@ Color Image::_get_color_at_ofs(const uint8_t *ptr, uint32_t ofs) const {
}
}
-void Image::_set_color_at_ofs(uint8_t *ptr, uint32_t ofs, const Color &p_color) {
+void Image::_set_color_at_ofs(uint8_t *r_ptr, uint32_t p_ofs, const Color &p_color) {
switch (format) {
case FORMAT_L8: {
- ptr[ofs] = uint8_t(CLAMP(p_color.get_v() * 255.0, 0, 255));
+ r_ptr[p_ofs] = uint8_t(CLAMP(p_color.get_v() * 255.0, 0, 255));
} break;
case FORMAT_LA8: {
- ptr[ofs * 2 + 0] = uint8_t(CLAMP(p_color.get_v() * 255.0, 0, 255));
- ptr[ofs * 2 + 1] = uint8_t(CLAMP(p_color.a * 255.0, 0, 255));
+ r_ptr[p_ofs * 2 + 0] = uint8_t(CLAMP(p_color.get_v() * 255.0, 0, 255));
+ r_ptr[p_ofs * 2 + 1] = uint8_t(CLAMP(p_color.a * 255.0, 0, 255));
} break;
case FORMAT_R8: {
- ptr[ofs] = uint8_t(CLAMP(p_color.r * 255.0, 0, 255));
+ r_ptr[p_ofs] = uint8_t(CLAMP(p_color.r * 255.0, 0, 255));
} break;
case FORMAT_RG8: {
- ptr[ofs * 2 + 0] = uint8_t(CLAMP(p_color.r * 255.0, 0, 255));
- ptr[ofs * 2 + 1] = uint8_t(CLAMP(p_color.g * 255.0, 0, 255));
+ r_ptr[p_ofs * 2 + 0] = uint8_t(CLAMP(p_color.r * 255.0, 0, 255));
+ r_ptr[p_ofs * 2 + 1] = uint8_t(CLAMP(p_color.g * 255.0, 0, 255));
} break;
case FORMAT_RGB8: {
- ptr[ofs * 3 + 0] = uint8_t(CLAMP(p_color.r * 255.0, 0, 255));
- ptr[ofs * 3 + 1] = uint8_t(CLAMP(p_color.g * 255.0, 0, 255));
- ptr[ofs * 3 + 2] = uint8_t(CLAMP(p_color.b * 255.0, 0, 255));
+ r_ptr[p_ofs * 3 + 0] = uint8_t(CLAMP(p_color.r * 255.0, 0, 255));
+ r_ptr[p_ofs * 3 + 1] = uint8_t(CLAMP(p_color.g * 255.0, 0, 255));
+ r_ptr[p_ofs * 3 + 2] = uint8_t(CLAMP(p_color.b * 255.0, 0, 255));
} break;
case FORMAT_RGBA8: {
- ptr[ofs * 4 + 0] = uint8_t(CLAMP(p_color.r * 255.0, 0, 255));
- ptr[ofs * 4 + 1] = uint8_t(CLAMP(p_color.g * 255.0, 0, 255));
- ptr[ofs * 4 + 2] = uint8_t(CLAMP(p_color.b * 255.0, 0, 255));
- ptr[ofs * 4 + 3] = uint8_t(CLAMP(p_color.a * 255.0, 0, 255));
+ r_ptr[p_ofs * 4 + 0] = uint8_t(CLAMP(p_color.r * 255.0, 0, 255));
+ r_ptr[p_ofs * 4 + 1] = uint8_t(CLAMP(p_color.g * 255.0, 0, 255));
+ r_ptr[p_ofs * 4 + 2] = uint8_t(CLAMP(p_color.b * 255.0, 0, 255));
+ r_ptr[p_ofs * 4 + 3] = uint8_t(CLAMP(p_color.a * 255.0, 0, 255));
} break;
case FORMAT_RGBA4444: {
- ((uint16_t *)ptr)[ofs] = color_to_rgba4444(p_color);
+ ((uint16_t *)r_ptr)[p_ofs] = color_to_rgba4444(p_color);
} break;
case FORMAT_RGB565: {
- ((uint16_t *)ptr)[ofs] = color_to_rgb565(p_color);
+ ((uint16_t *)r_ptr)[p_ofs] = color_to_rgb565(p_color);
} break;
case FORMAT_RF: {
- ((float *)ptr)[ofs] = p_color.r;
+ ((float *)r_ptr)[p_ofs] = p_color.r;
} break;
case FORMAT_RGF: {
- ((float *)ptr)[ofs * 2 + 0] = p_color.r;
- ((float *)ptr)[ofs * 2 + 1] = p_color.g;
+ ((float *)r_ptr)[p_ofs * 2 + 0] = p_color.r;
+ ((float *)r_ptr)[p_ofs * 2 + 1] = p_color.g;
} break;
case FORMAT_RGBF: {
- ((float *)ptr)[ofs * 3 + 0] = p_color.r;
- ((float *)ptr)[ofs * 3 + 1] = p_color.g;
- ((float *)ptr)[ofs * 3 + 2] = p_color.b;
+ ((float *)r_ptr)[p_ofs * 3 + 0] = p_color.r;
+ ((float *)r_ptr)[p_ofs * 3 + 1] = p_color.g;
+ ((float *)r_ptr)[p_ofs * 3 + 2] = p_color.b;
} break;
case FORMAT_RGBAF: {
- ((float *)ptr)[ofs * 4 + 0] = p_color.r;
- ((float *)ptr)[ofs * 4 + 1] = p_color.g;
- ((float *)ptr)[ofs * 4 + 2] = p_color.b;
- ((float *)ptr)[ofs * 4 + 3] = p_color.a;
+ ((float *)r_ptr)[p_ofs * 4 + 0] = p_color.r;
+ ((float *)r_ptr)[p_ofs * 4 + 1] = p_color.g;
+ ((float *)r_ptr)[p_ofs * 4 + 2] = p_color.b;
+ ((float *)r_ptr)[p_ofs * 4 + 3] = p_color.a;
} break;
case FORMAT_RH: {
- ((uint16_t *)ptr)[ofs] = Math::make_half_float(p_color.r);
+ ((uint16_t *)r_ptr)[p_ofs] = Math::make_half_float(p_color.r);
} break;
case FORMAT_RGH: {
- ((uint16_t *)ptr)[ofs * 2 + 0] = Math::make_half_float(p_color.r);
- ((uint16_t *)ptr)[ofs * 2 + 1] = Math::make_half_float(p_color.g);
+ ((uint16_t *)r_ptr)[p_ofs * 2 + 0] = Math::make_half_float(p_color.r);
+ ((uint16_t *)r_ptr)[p_ofs * 2 + 1] = Math::make_half_float(p_color.g);
} break;
case FORMAT_RGBH: {
- ((uint16_t *)ptr)[ofs * 3 + 0] = Math::make_half_float(p_color.r);
- ((uint16_t *)ptr)[ofs * 3 + 1] = Math::make_half_float(p_color.g);
- ((uint16_t *)ptr)[ofs * 3 + 2] = Math::make_half_float(p_color.b);
+ ((uint16_t *)r_ptr)[p_ofs * 3 + 0] = Math::make_half_float(p_color.r);
+ ((uint16_t *)r_ptr)[p_ofs * 3 + 1] = Math::make_half_float(p_color.g);
+ ((uint16_t *)r_ptr)[p_ofs * 3 + 2] = Math::make_half_float(p_color.b);
} break;
case FORMAT_RGBAH: {
- ((uint16_t *)ptr)[ofs * 4 + 0] = Math::make_half_float(p_color.r);
- ((uint16_t *)ptr)[ofs * 4 + 1] = Math::make_half_float(p_color.g);
- ((uint16_t *)ptr)[ofs * 4 + 2] = Math::make_half_float(p_color.b);
- ((uint16_t *)ptr)[ofs * 4 + 3] = Math::make_half_float(p_color.a);
+ ((uint16_t *)r_ptr)[p_ofs * 4 + 0] = Math::make_half_float(p_color.r);
+ ((uint16_t *)r_ptr)[p_ofs * 4 + 1] = Math::make_half_float(p_color.g);
+ ((uint16_t *)r_ptr)[p_ofs * 4 + 2] = Math::make_half_float(p_color.b);
+ ((uint16_t *)r_ptr)[p_ofs * 4 + 3] = Math::make_half_float(p_color.a);
} break;
case FORMAT_RGBE9995: {
- ((uint32_t *)ptr)[ofs] = p_color.to_rgbe9995();
+ ((uint32_t *)r_ptr)[p_ofs] = p_color.to_rgbe9995();
} break;
case FORMAT_R16: {
- ((uint16_t *)ptr)[ofs] = uint16_t(CLAMP(p_color.r * 65535.0, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs] = uint16_t(CLAMP(p_color.r * 65535.0, 0, 65535));
} break;
case FORMAT_RG16: {
- ((uint16_t *)ptr)[ofs * 2 + 0] = uint16_t(CLAMP(p_color.r * 65535.0, 0, 65535));
- ((uint16_t *)ptr)[ofs * 2 + 1] = uint16_t(CLAMP(p_color.g * 65535.0, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs * 2 + 0] = uint16_t(CLAMP(p_color.r * 65535.0, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs * 2 + 1] = uint16_t(CLAMP(p_color.g * 65535.0, 0, 65535));
} break;
case FORMAT_RGB16: {
- ((uint16_t *)ptr)[ofs * 3 + 0] = uint16_t(CLAMP(p_color.r * 65535.0, 0, 65535));
- ((uint16_t *)ptr)[ofs * 3 + 1] = uint16_t(CLAMP(p_color.g * 65535.0, 0, 65535));
- ((uint16_t *)ptr)[ofs * 3 + 2] = uint16_t(CLAMP(p_color.b * 65535.0, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs * 3 + 0] = uint16_t(CLAMP(p_color.r * 65535.0, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs * 3 + 1] = uint16_t(CLAMP(p_color.g * 65535.0, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs * 3 + 2] = uint16_t(CLAMP(p_color.b * 65535.0, 0, 65535));
} break;
case FORMAT_RGBA16: {
- ((uint16_t *)ptr)[ofs * 4 + 0] = uint16_t(CLAMP(p_color.r * 65535.0, 0, 65535));
- ((uint16_t *)ptr)[ofs * 4 + 1] = uint16_t(CLAMP(p_color.g * 65535.0, 0, 65535));
- ((uint16_t *)ptr)[ofs * 4 + 2] = uint16_t(CLAMP(p_color.b * 65535.0, 0, 65535));
- ((uint16_t *)ptr)[ofs * 4 + 3] = uint16_t(CLAMP(p_color.a * 65535.0, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs * 4 + 0] = uint16_t(CLAMP(p_color.r * 65535.0, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs * 4 + 1] = uint16_t(CLAMP(p_color.g * 65535.0, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs * 4 + 2] = uint16_t(CLAMP(p_color.b * 65535.0, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs * 4 + 3] = uint16_t(CLAMP(p_color.a * 65535.0, 0, 65535));
} break;
case FORMAT_R16I: {
- ((uint16_t *)ptr)[ofs] = uint16_t(CLAMP(p_color.r, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs] = uint16_t(CLAMP(p_color.r, 0, 65535));
} break;
case FORMAT_RG16I: {
- ((uint16_t *)ptr)[ofs * 2 + 0] = uint16_t(CLAMP(p_color.r, 0, 65535));
- ((uint16_t *)ptr)[ofs * 2 + 1] = uint16_t(CLAMP(p_color.g, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs * 2 + 0] = uint16_t(CLAMP(p_color.r, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs * 2 + 1] = uint16_t(CLAMP(p_color.g, 0, 65535));
} break;
case FORMAT_RGB16I: {
- ((uint16_t *)ptr)[ofs * 3 + 0] = uint16_t(CLAMP(p_color.r, 0, 65535));
- ((uint16_t *)ptr)[ofs * 3 + 1] = uint16_t(CLAMP(p_color.g, 0, 65535));
- ((uint16_t *)ptr)[ofs * 3 + 2] = uint16_t(CLAMP(p_color.b, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs * 3 + 0] = uint16_t(CLAMP(p_color.r, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs * 3 + 1] = uint16_t(CLAMP(p_color.g, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs * 3 + 2] = uint16_t(CLAMP(p_color.b, 0, 65535));
} break;
case FORMAT_RGBA16I: {
- ((uint16_t *)ptr)[ofs * 4 + 0] = uint16_t(CLAMP(p_color.r, 0, 65535));
- ((uint16_t *)ptr)[ofs * 4 + 1] = uint16_t(CLAMP(p_color.g, 0, 65535));
- ((uint16_t *)ptr)[ofs * 4 + 2] = uint16_t(CLAMP(p_color.b, 0, 65535));
- ((uint16_t *)ptr)[ofs * 4 + 3] = uint16_t(CLAMP(p_color.a, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs * 4 + 0] = uint16_t(CLAMP(p_color.r, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs * 4 + 1] = uint16_t(CLAMP(p_color.g, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs * 4 + 2] = uint16_t(CLAMP(p_color.b, 0, 65535));
+ ((uint16_t *)r_ptr)[p_ofs * 4 + 3] = uint16_t(CLAMP(p_color.a, 0, 65535));
} break;
default: {
@@ -4131,7 +4131,7 @@ Ref<Image> Image::get_image_from_mipmap(int p_mipmap) const {
return image;
}
-void Image::bump_map_to_normal_map(float bump_scale) {
+void Image::bump_map_to_normal_map(float p_bump_scale) {
ERR_FAIL_COND(is_compressed());
clear_mipmaps();
convert(Image::FORMAT_RF);
@@ -4162,8 +4162,8 @@ void Image::bump_map_to_normal_map(float bump_scale) {
float here = read_ptr[ty * width + tx];
float to_right = read_ptr[ty * width + px];
float above = read_ptr[py * width + tx];
- Vector3 up = Vector3(0, 1, (here - above) * bump_scale);
- Vector3 across = Vector3(1, 0, (to_right - here) * bump_scale);
+ Vector3 up = Vector3(0, 1, (here - above) * p_bump_scale);
+ Vector3 across = Vector3(1, 0, (to_right - here) * p_bump_scale);
Vector3 normal = across.cross(up);
normal.normalize();
@@ -4516,7 +4516,7 @@ Error Image::load_dds_from_buffer(const Vector<uint8_t> &p_array) {
return _load_from_buffer(p_array, _dds_mem_loader_func);
}
-Error Image::load_svg_from_buffer(const Vector<uint8_t> &p_array, float scale) {
+Error Image::load_svg_from_buffer(const Vector<uint8_t> &p_array, float p_scale) {
ERR_FAIL_NULL_V_MSG(
_svg_scalable_mem_loader_func,
ERR_UNAVAILABLE,
@@ -4526,7 +4526,7 @@ Error Image::load_svg_from_buffer(const Vector<uint8_t> &p_array, float scale) {
ERR_FAIL_COND_V(buffer_size == 0, ERR_INVALID_PARAMETER);
- Ref<Image> image = _svg_scalable_mem_loader_func(p_array.ptr(), buffer_size, scale);
+ Ref<Image> image = _svg_scalable_mem_loader_func(p_array.ptr(), buffer_size, p_scale);
ERR_FAIL_COND_V(image.is_null(), ERR_PARSE_ERROR);
copy_internals_from(image);
@@ -4534,8 +4534,8 @@ Error Image::load_svg_from_buffer(const Vector<uint8_t> &p_array, float scale) {
return OK;
}
-Error Image::load_svg_from_string(const String &p_svg_str, float scale) {
- return load_svg_from_buffer(p_svg_str.to_utf8_buffer(), scale);
+Error Image::load_svg_from_string(const String &p_svg_str, float p_scale) {
+ return load_svg_from_buffer(p_svg_str.to_utf8_buffer(), p_scale);
}
Error Image::load_ktx_from_buffer(const Vector<uint8_t> &p_array) {
diff --git a/core/io/image.h b/core/io/image.h
index e61bb2991f8..10865a92cd4 100644
--- a/core/io/image.h
+++ b/core/io/image.h
@@ -293,8 +293,8 @@ private:
void _copy_internals_from(const Image &p_image);
- _FORCE_INLINE_ Color _get_color_at_ofs(const uint8_t *ptr, uint32_t ofs) const;
- _FORCE_INLINE_ void _set_color_at_ofs(uint8_t *ptr, uint32_t ofs, const Color &p_color);
+ _FORCE_INLINE_ Color _get_color_at_ofs(const uint8_t *p_ptr, uint32_t p_ofs) const;
+ _FORCE_INLINE_ void _set_color_at_ofs(uint8_t *r_ptr, uint32_t p_ofs, const Color &p_color);
_FORCE_INLINE_ void _get_mipmap_offset_and_size(int p_mipmap, int64_t &r_offset, int &r_width, int &r_height) const; // Get where the mipmap begins in data.
@@ -342,7 +342,7 @@ public:
// Get where the mipmap begins in data.
int64_t get_mipmap_offset(int p_mipmap) const;
void get_mipmap_offset_and_size(int p_mipmap, int64_t &r_ofs, int64_t &r_size) const;
- void get_mipmap_offset_size_and_dimensions(int p_mipmap, int64_t &r_ofs, int64_t &r_size, int &w, int &h) const;
+ void get_mipmap_offset_size_and_dimensions(int p_mipmap, int64_t &r_ofs, int64_t &r_size, int &p_w, int &p_h) const;
static Image3DValidateError validate_3d_image(Format p_format, int p_width, int p_height, int p_depth, bool p_mipmaps, const Vector<Ref<Image>> &p_images);
static String get_3d_image_validation_error_text(Image3DValidateError p_error);
@@ -434,7 +434,7 @@ public:
void normal_map_to_xy();
Ref<Image> rgbe_to_srgb();
Ref<Image> get_image_from_mipmap(int p_mipmap) const;
- void bump_map_to_normal_map(float bump_scale = 1.0);
+ void bump_map_to_normal_map(float p_bump_scale = 1.0);
bool detect_signed(bool p_include_mips = true) const;
@@ -460,8 +460,8 @@ public:
Error load_dds_from_buffer(const Vector<uint8_t> &p_array);
Error load_exr_from_buffer(const Vector<uint8_t> &p_array);
- Error load_svg_from_buffer(const Vector<uint8_t> &p_array, float scale = 1.0);
- Error load_svg_from_string(const String &p_svg_str, float scale = 1.0);
+ Error load_svg_from_buffer(const Vector<uint8_t> &p_array, float p_scale = 1.0);
+ Error load_svg_from_string(const String &p_svg_str, float p_scale = 1.0);
void convert_rg_to_ra_rgba8();
void convert_ra_rgba8_to_rg();
diff --git a/core/io/ip.cpp b/core/io/ip.cpp
index ec7c72d2747..72f1d598e4f 100644
--- a/core/io/ip.cpp
+++ b/core/io/ip.cpp
@@ -107,8 +107,8 @@ struct _IP_ResolverPrivate {
}
}
- static void _thread_function(void *self) {
- _IP_ResolverPrivate *ipr = static_cast<_IP_ResolverPrivate *>(self);
+ static void _thread_function(void *p_self) {
+ _IP_ResolverPrivate *ipr = static_cast<_IP_ResolverPrivate *>(p_self);
while (!ipr->thread_abort.is_set()) {
ipr->sem.wait();
diff --git a/core/io/ip_address.cpp b/core/io/ip_address.cpp
index 03e6e355f87..22d2c759105 100644
--- a/core/io/ip_address.cpp
+++ b/core/io/ip_address.cpp
@@ -264,10 +264,10 @@ _FORCE_INLINE_ static void _32_to_buf(uint8_t *p_dst, uint32_t p_n) {
p_dst[3] = (p_n >> 0) & 0xff;
}
-IPAddress::IPAddress(uint32_t p_a, uint32_t p_b, uint32_t p_c, uint32_t p_d, bool is_v6) {
+IPAddress::IPAddress(uint32_t p_a, uint32_t p_b, uint32_t p_c, uint32_t p_d, bool p_is_v6) {
clear();
valid = true;
- if (!is_v6) {
+ if (!p_is_v6) {
// Mapped to IPv6.
field16[5] = 0xffff;
field8[12] = p_a;
diff --git a/core/io/ip_address.h b/core/io/ip_address.h
index 6f85b5cc75a..16a20a1607e 100644
--- a/core/io/ip_address.h
+++ b/core/io/ip_address.h
@@ -98,7 +98,7 @@ public:
explicit operator String() const;
IPAddress(const String &p_string);
- IPAddress(uint32_t p_a, uint32_t p_b, uint32_t p_c, uint32_t p_d, bool is_v6 = false);
+ IPAddress(uint32_t p_a, uint32_t p_b, uint32_t p_c, uint32_t p_d, bool p_is_v6 = false);
IPAddress() { clear(); }
};
diff --git a/core/io/json.cpp b/core/io/json.cpp
index e055346c43c..d018634ea4e 100644
--- a/core/io/json.cpp
+++ b/core/io/json.cpp
@@ -198,12 +198,12 @@ void JSON::_stringify(String &r_result, const Variant &p_var, const String &p_in
}
}
-Error JSON::_get_token(const char32_t *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str) {
+Error JSON::_get_token(const char32_t *p_str, int &r_index, int p_len, Token &r_token, int &r_line, String &r_err_str) {
while (p_len > 0) {
- switch (p_str[index]) {
+ switch (p_str[r_index]) {
case '\n': {
- line++;
- index++;
+ r_line++;
+ r_index++;
break;
}
case 0: {
@@ -212,48 +212,48 @@ Error JSON::_get_token(const char32_t *p_str, int &index, int p_len, Token &r_to
} break;
case '{': {
r_token.type = TK_CURLY_BRACKET_OPEN;
- index++;
+ r_index++;
return OK;
}
case '}': {
r_token.type = TK_CURLY_BRACKET_CLOSE;
- index++;
+ r_index++;
return OK;
}
case '[': {
r_token.type = TK_BRACKET_OPEN;
- index++;
+ r_index++;
return OK;
}
case ']': {
r_token.type = TK_BRACKET_CLOSE;
- index++;
+ r_index++;
return OK;
}
case ':': {
r_token.type = TK_COLON;
- index++;
+ r_index++;
return OK;
}
case ',': {
r_token.type = TK_COMMA;
- index++;
+ r_index++;
return OK;
}
case '"': {
- index++;
+ r_index++;
String str;
while (true) {
- if (p_str[index] == 0) {
+ if (p_str[r_index] == 0) {
r_err_str = "Unterminated string";
return ERR_PARSE_ERROR;
- } else if (p_str[index] == '"') {
- index++;
+ } else if (p_str[r_index] == '"') {
+ r_index++;
break;
- } else if (p_str[index] == '\\') {
+ } else if (p_str[r_index] == '\\') {
//escaped characters...
- index++;
- char32_t next = p_str[index];
+ r_index++;
+ char32_t next = p_str[r_index];
if (next == 0) {
r_err_str = "Unterminated string";
return ERR_PARSE_ERROR;
@@ -279,7 +279,7 @@ Error JSON::_get_token(const char32_t *p_str, int &index, int p_len, Token &r_to
case 'u': {
// hex number
for (int j = 0; j < 4; j++) {
- char32_t c = p_str[index + j + 1];
+ char32_t c = p_str[r_index + j + 1];
if (c == 0) {
r_err_str = "Unterminated string";
return ERR_PARSE_ERROR;
@@ -305,17 +305,17 @@ Error JSON::_get_token(const char32_t *p_str, int &index, int p_len, Token &r_to
res <<= 4;
res |= v;
}
- index += 4; //will add at the end anyway
+ r_index += 4; //will add at the end anyway
if ((res & 0xfffffc00) == 0xd800) {
- if (p_str[index + 1] != '\\' || p_str[index + 2] != 'u') {
+ if (p_str[r_index + 1] != '\\' || p_str[r_index + 2] != 'u') {
r_err_str = "Invalid UTF-16 sequence in string, unpaired lead surrogate";
return ERR_PARSE_ERROR;
}
- index += 2;
+ r_index += 2;
char32_t trail = 0;
for (int j = 0; j < 4; j++) {
- char32_t c = p_str[index + j + 1];
+ char32_t c = p_str[r_index + j + 1];
if (c == 0) {
r_err_str = "Unterminated string";
return ERR_PARSE_ERROR;
@@ -343,7 +343,7 @@ Error JSON::_get_token(const char32_t *p_str, int &index, int p_len, Token &r_to
}
if ((trail & 0xfffffc00) == 0xdc00) {
res = (res << 10UL) + trail - ((0xd800 << 10UL) + 0xdc00 - 0x10000);
- index += 4; //will add at the end anyway
+ r_index += 4; //will add at the end anyway
} else {
r_err_str = "Invalid UTF-16 sequence in string, unpaired lead surrogate";
return ERR_PARSE_ERROR;
@@ -368,12 +368,12 @@ Error JSON::_get_token(const char32_t *p_str, int &index, int p_len, Token &r_to
str += res;
} else {
- if (p_str[index] == '\n') {
- line++;
+ if (p_str[r_index] == '\n') {
+ r_line++;
}
- str += p_str[index];
+ str += p_str[r_index];
}
- index++;
+ r_index++;
}
r_token.type = TK_STRING;
@@ -382,26 +382,26 @@ Error JSON::_get_token(const char32_t *p_str, int &index, int p_len, Token &r_to
} break;
default: {
- if (p_str[index] <= 32) {
- index++;
+ if (p_str[r_index] <= 32) {
+ r_index++;
break;
}
- if (p_str[index] == '-' || is_digit(p_str[index])) {
+ if (p_str[r_index] == '-' || is_digit(p_str[r_index])) {
//a number
const char32_t *rptr;
- double number = String::to_float(&p_str[index], &rptr);
- index += (rptr - &p_str[index]);
+ double number = String::to_float(&p_str[r_index], &rptr);
+ r_index += (rptr - &p_str[r_index]);
r_token.type = TK_NUMBER;
r_token.value = number;
return OK;
- } else if (is_ascii_alphabet_char(p_str[index])) {
+ } else if (is_ascii_alphabet_char(p_str[r_index])) {
String id;
- while (is_ascii_alphabet_char(p_str[index])) {
- id += p_str[index];
- index++;
+ while (is_ascii_alphabet_char(p_str[r_index])) {
+ id += p_str[r_index];
+ r_index++;
}
r_token.type = TK_IDENTIFIER;
@@ -419,56 +419,56 @@ Error JSON::_get_token(const char32_t *p_str, int &index, int p_len, Token &r_to
return ERR_PARSE_ERROR;
}
-Error JSON::_parse_value(Variant &value, Token &token, const char32_t *p_str, int &index, int p_len, int &line, int p_depth, String &r_err_str) {
+Error JSON::_parse_value(Variant &r_value, Token &r_token, const char32_t *p_str, int &r_index, int p_len, int &r_line, int p_depth, String &r_err_str) {
if (p_depth > Variant::MAX_RECURSION_DEPTH) {
r_err_str = "JSON structure is too deep";
return ERR_OUT_OF_MEMORY;
}
- if (token.type == TK_CURLY_BRACKET_OPEN) {
+ if (r_token.type == TK_CURLY_BRACKET_OPEN) {
Dictionary d;
- Error err = _parse_object(d, p_str, index, p_len, line, p_depth + 1, r_err_str);
+ Error err = _parse_object(d, p_str, r_index, p_len, r_line, p_depth + 1, r_err_str);
if (err) {
return err;
}
- value = d;
- } else if (token.type == TK_BRACKET_OPEN) {
+ r_value = d;
+ } else if (r_token.type == TK_BRACKET_OPEN) {
Array a;
- Error err = _parse_array(a, p_str, index, p_len, line, p_depth + 1, r_err_str);
+ Error err = _parse_array(a, p_str, r_index, p_len, r_line, p_depth + 1, r_err_str);
if (err) {
return err;
}
- value = a;
- } else if (token.type == TK_IDENTIFIER) {
- String id = token.value;
+ r_value = a;
+ } else if (r_token.type == TK_IDENTIFIER) {
+ String id = r_token.value;
if (id == "true") {
- value = true;
+ r_value = true;
} else if (id == "false") {
- value = false;
+ r_value = false;
} else if (id == "null") {
- value = Variant();
+ r_value = Variant();
} else {
r_err_str = vformat("Expected 'true', 'false', or 'null', got '%s'", id);
return ERR_PARSE_ERROR;
}
- } else if (token.type == TK_NUMBER) {
- value = token.value;
- } else if (token.type == TK_STRING) {
- value = token.value;
+ } else if (r_token.type == TK_NUMBER) {
+ r_value = r_token.value;
+ } else if (r_token.type == TK_STRING) {
+ r_value = r_token.value;
} else {
- r_err_str = vformat("Expected value, got '%s'", String(tk_name[token.type]));
+ r_err_str = vformat("Expected value, got '%s'", String(tk_name[r_token.type]));
return ERR_PARSE_ERROR;
}
return OK;
}
-Error JSON::_parse_array(Array &array, const char32_t *p_str, int &index, int p_len, int &line, int p_depth, String &r_err_str) {
+Error JSON::_parse_array(Array &r_array, const char32_t *p_str, int &r_index, int p_len, int &r_line, int p_depth, String &r_err_str) {
Token token;
bool need_comma = false;
- while (index < p_len) {
- Error err = _get_token(p_str, index, p_len, token, line, r_err_str);
+ while (r_index < p_len) {
+ Error err = _get_token(p_str, r_index, p_len, token, r_line, r_err_str);
if (err != OK) {
return err;
}
@@ -488,12 +488,12 @@ Error JSON::_parse_array(Array &array, const char32_t *p_str, int &index, int p_
}
Variant v;
- err = _parse_value(v, token, p_str, index, p_len, line, p_depth, r_err_str);
+ err = _parse_value(v, token, p_str, r_index, p_len, r_line, p_depth, r_err_str);
if (err) {
return err;
}
- array.push_back(v);
+ r_array.push_back(v);
need_comma = true;
}
@@ -501,15 +501,15 @@ Error JSON::_parse_array(Array &array, const char32_t *p_str, int &index, int p_
return ERR_PARSE_ERROR;
}
-Error JSON::_parse_object(Dictionary &object, const char32_t *p_str, int &index, int p_len, int &line, int p_depth, String &r_err_str) {
+Error JSON::_parse_object(Dictionary &r_object, const char32_t *p_str, int &r_index, int p_len, int &r_line, int p_depth, String &r_err_str) {
bool at_key = true;
String key;
Token token;
bool need_comma = false;
- while (index < p_len) {
+ while (r_index < p_len) {
if (at_key) {
- Error err = _get_token(p_str, index, p_len, token, line, r_err_str);
+ Error err = _get_token(p_str, r_index, p_len, token, r_line, r_err_str);
if (err != OK) {
return err;
}
@@ -534,7 +534,7 @@ Error JSON::_parse_object(Dictionary &object, const char32_t *p_str, int &index,
}
key = token.value;
- err = _get_token(p_str, index, p_len, token, line, r_err_str);
+ err = _get_token(p_str, r_index, p_len, token, r_line, r_err_str);
if (err != OK) {
return err;
}
@@ -544,17 +544,17 @@ Error JSON::_parse_object(Dictionary &object, const char32_t *p_str, int &index,
}
at_key = false;
} else {
- Error err = _get_token(p_str, index, p_len, token, line, r_err_str);
+ Error err = _get_token(p_str, r_index, p_len, token, r_line, r_err_str);
if (err != OK) {
return err;
}
Variant v;
- err = _parse_value(v, token, p_str, index, p_len, line, p_depth, r_err_str);
+ err = _parse_value(v, token, p_str, r_index, p_len, r_line, p_depth, r_err_str);
if (err) {
return err;
}
- object[key] = v;
+ r_object[key] = v;
need_comma = true;
at_key = true;
}
diff --git a/core/io/json.h b/core/io/json.h
index 9346a75bd30..b4216524d44 100644
--- a/core/io/json.h
+++ b/core/io/json.h
@@ -71,10 +71,10 @@ class JSON : public Resource {
static void _add_indent(String &r_result, const String &p_indent, int p_size);
static void _stringify(String &r_result, const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys, HashSet<const void *> &p_markers, bool p_full_precision);
- static Error _get_token(const char32_t *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str);
- static Error _parse_value(Variant &value, Token &token, const char32_t *p_str, int &index, int p_len, int &line, int p_depth, String &r_err_str);
- static Error _parse_array(Array &array, const char32_t *p_str, int &index, int p_len, int &line, int p_depth, String &r_err_str);
- static Error _parse_object(Dictionary &object, const char32_t *p_str, int &index, int p_len, int &line, int p_depth, String &r_err_str);
+ static Error _get_token(const char32_t *p_str, int &r_index, int p_len, Token &r_token, int &r_line, String &r_err_str);
+ static Error _parse_value(Variant &r_value, Token &r_token, const char32_t *p_str, int &r_index, int p_len, int &r_line, int p_depth, String &r_err_str);
+ static Error _parse_array(Array &r_array, const char32_t *p_str, int &r_index, int p_len, int &r_line, int p_depth, String &r_err_str);
+ static Error _parse_object(Dictionary &r_object, const char32_t *p_str, int &r_index, int p_len, int &r_line, int p_depth, String &r_err_str);
static Error _parse_string(const String &p_json, Variant &r_ret, String &r_err_str, int &r_err_line);
static Variant _from_native(const Variant &p_variant, bool p_full_objects, int p_depth);
diff --git a/core/io/logger.cpp b/core/io/logger.cpp
index feab968add7..a830b66cb80 100644
--- a/core/io/logger.cpp
+++ b/core/io/logger.cpp
@@ -53,8 +53,8 @@ bool Logger::should_log(bool p_err) {
return (!p_err || CoreGlobals::print_error_enabled) && (p_err || CoreGlobals::print_line_enabled);
}
-void Logger::set_flush_stdout_on_print(bool value) {
- _flush_stdout_on_print = value;
+void Logger::set_flush_stdout_on_print(bool p_value) {
+ _flush_stdout_on_print = p_value;
}
void Logger::log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, bool p_editor_notify, ErrorType p_type, const Vector<Ref<ScriptBacktrace>> &p_script_backtraces) {
diff --git a/core/io/logger.h b/core/io/logger.h
index 6fa0cc24860..79ef5c2967a 100644
--- a/core/io/logger.h
+++ b/core/io/logger.h
@@ -82,7 +82,7 @@ public:
return " ";
}
- static void set_flush_stdout_on_print(bool value);
+ static void set_flush_stdout_on_print(bool p_value);
virtual void logv(const char *p_format, va_list p_list, bool p_err) _PRINTF_FORMAT_ATTRIBUTE_2_0 = 0;
virtual void log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, bool p_editor_notify = false, ErrorType p_type = ERR_ERROR, const Vector<Ref<ScriptBacktrace>> &p_script_backtraces = {});
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 4579fb93939..2d44aee2e56 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -89,10 +89,10 @@ enum ContainerTypeKind {
#define GET_CONTAINER_TYPE_KIND(m_header, m_field) \
((ContainerTypeKind)(((m_header) & HEADER_DATA_FIELD_##m_field##_MASK) >> HEADER_DATA_FIELD_##m_field##_SHIFT))
-static Error _decode_string(const uint8_t *&buf, int &len, int *r_len, String &r_string) {
- ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
+static Error _decode_string(const uint8_t *&p_buffer, int &r_left, int *r_len, String &r_string) {
+ ERR_FAIL_COND_V(r_left < 4, ERR_INVALID_DATA);
- int32_t strlen = decode_uint32(buf);
+ int32_t strlen = decode_uint32(p_buffer);
int32_t pad = 0;
// Handle padding.
@@ -100,23 +100,23 @@ static Error _decode_string(const uint8_t *&buf, int &len, int *r_len, String &r
pad = 4 - strlen % 4;
}
- buf += 4;
- len -= 4;
+ p_buffer += 4;
+ r_left -= 4;
// Ensure buffer is big enough.
ERR_FAIL_ADD_OF(strlen, pad, ERR_FILE_EOF);
- ERR_FAIL_COND_V(strlen < 0 || strlen + pad > len, ERR_FILE_EOF);
+ ERR_FAIL_COND_V(strlen < 0 || strlen + pad > r_left, ERR_FILE_EOF);
String str;
- ERR_FAIL_COND_V(str.append_utf8((const char *)buf, strlen) != OK, ERR_INVALID_DATA);
+ ERR_FAIL_COND_V(str.append_utf8((const char *)p_buffer, strlen) != OK, ERR_INVALID_DATA);
r_string = str;
// Add padding.
strlen += pad;
// Update buffer pos, left data count, and return size.
- buf += strlen;
- len -= strlen;
+ p_buffer += strlen;
+ r_left -= strlen;
if (r_len) {
(*r_len) += 4 + strlen;
}
@@ -124,17 +124,17 @@ static Error _decode_string(const uint8_t *&buf, int &len, int *r_len, String &r
return OK;
}
-static Error _decode_container_type(const uint8_t *&buf, int &len, int *r_len, bool p_allow_objects, ContainerTypeKind p_type_kind, ContainerType &r_type) {
+static Error _decode_container_type(const uint8_t *&p_buffer, int &r_left, int *r_len, bool p_allow_objects, ContainerTypeKind p_type_kind, ContainerType &r_type) {
switch (p_type_kind) {
case CONTAINER_TYPE_KIND_NONE: {
return OK;
} break;
case CONTAINER_TYPE_KIND_BUILTIN: {
- ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
+ ERR_FAIL_COND_V(r_left < 4, ERR_INVALID_DATA);
- int32_t bt = decode_uint32(buf);
- buf += 4;
- len -= 4;
+ int32_t bt = decode_uint32(p_buffer);
+ p_buffer += 4;
+ r_left -= 4;
if (r_len) {
(*r_len) += 4;
}
@@ -148,7 +148,7 @@ static Error _decode_container_type(const uint8_t *&buf, int &len, int *r_len, b
} break;
case CONTAINER_TYPE_KIND_CLASS_NAME: {
String str;
- Error err = _decode_string(buf, len, r_len, str);
+ Error err = _decode_string(p_buffer, r_left, r_len, str);
if (err) {
return err;
}
@@ -163,7 +163,7 @@ static Error _decode_container_type(const uint8_t *&buf, int &len, int *r_len, b
} break;
case CONTAINER_TYPE_KIND_SCRIPT: {
String path;
- Error err = _decode_string(buf, len, r_len, path);
+ Error err = _decode_string(p_buffer, r_left, r_len, path);
if (err) {
return err;
}
@@ -1303,55 +1303,55 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
return OK;
}
-static void _encode_string(const String &p_string, uint8_t *&buf, int &r_len) {
+static void _encode_string(const String &p_string, uint8_t *&p_buffer, int &r_len) {
CharString utf8 = p_string.utf8();
- if (buf) {
- encode_uint32(utf8.length(), buf);
- buf += 4;
- memcpy(buf, utf8.get_data(), utf8.length());
- buf += utf8.length();
+ if (p_buffer) {
+ encode_uint32(utf8.length(), p_buffer);
+ p_buffer += 4;
+ memcpy(p_buffer, utf8.get_data(), utf8.length());
+ p_buffer += utf8.length();
}
r_len += 4 + utf8.length();
while (r_len % 4) {
r_len++; // Pad.
- if (buf) {
- *(buf++) = 0;
+ if (p_buffer) {
+ *(p_buffer++) = 0;
}
}
}
-static void _encode_container_type_header(const ContainerType &p_type, uint32_t &header, uint32_t p_shift, bool p_full_objects) {
+static void _encode_container_type_header(const ContainerType &p_type, uint32_t &r_header, uint32_t p_shift, bool p_full_objects) {
if (p_type.builtin_type != Variant::NIL) {
if (p_type.script.is_valid()) {
- header |= (p_full_objects ? CONTAINER_TYPE_KIND_SCRIPT : CONTAINER_TYPE_KIND_CLASS_NAME) << p_shift;
+ r_header |= (p_full_objects ? CONTAINER_TYPE_KIND_SCRIPT : CONTAINER_TYPE_KIND_CLASS_NAME) << p_shift;
} else if (p_type.class_name != StringName()) {
- header |= CONTAINER_TYPE_KIND_CLASS_NAME << p_shift;
+ r_header |= CONTAINER_TYPE_KIND_CLASS_NAME << p_shift;
} else {
// No need to check `p_full_objects` since `class_name` should be non-empty for `builtin_type == Variant::OBJECT`.
- header |= CONTAINER_TYPE_KIND_BUILTIN << p_shift;
+ r_header |= CONTAINER_TYPE_KIND_BUILTIN << p_shift;
}
}
}
-static Error _encode_container_type(const ContainerType &p_type, uint8_t *&buf, int &r_len, bool p_full_objects) {
+static Error _encode_container_type(const ContainerType &p_type, uint8_t *&p_buffer, int &r_len, bool p_full_objects) {
if (p_type.builtin_type != Variant::NIL) {
if (p_type.script.is_valid()) {
if (p_full_objects) {
String path = p_type.script->get_path();
ERR_FAIL_COND_V_MSG(path.is_empty() || !path.begins_with("res://"), ERR_UNAVAILABLE, "Failed to encode a path to a custom script for a container type.");
- _encode_string(path, buf, r_len);
+ _encode_string(path, p_buffer, r_len);
} else {
- _encode_string(EncodedObjectAsID::get_class_static(), buf, r_len);
+ _encode_string(EncodedObjectAsID::get_class_static(), p_buffer, r_len);
}
} else if (p_type.class_name != StringName()) {
- _encode_string(p_full_objects ? p_type.class_name : EncodedObjectAsID::get_class_static(), buf, r_len);
+ _encode_string(p_full_objects ? p_type.class_name : EncodedObjectAsID::get_class_static(), p_buffer, r_len);
} else {
// No need to check `p_full_objects` since `class_name` should be non-empty for `builtin_type == Variant::OBJECT`.
- if (buf) {
- encode_uint32(p_type.builtin_type, buf);
- buf += 4;
+ if (p_buffer) {
+ encode_uint32(p_type.builtin_type, p_buffer);
+ p_buffer += 4;
}
r_len += 4;
}
@@ -1359,9 +1359,9 @@ static Error _encode_container_type(const ContainerType &p_type, uint8_t *&buf,
return OK;
}
-Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_full_objects, int p_depth) {
+Error encode_variant(const Variant &p_variant, uint8_t *p_buffer, int &r_len, bool p_full_objects, int p_depth) {
ERR_FAIL_COND_V_MSG(p_depth > Variant::MAX_RECURSION_DEPTH, ERR_OUT_OF_MEMORY, "Potential infinite recursion detected. Bailing.");
- uint8_t *buf = r_buffer;
+ uint8_t *buf = p_buffer;
r_len = 0;
@@ -2133,19 +2133,19 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
return OK;
}
-Vector<float> vector3_to_float32_array(const Vector3 *vecs, size_t count) {
+Vector<float> vector3_to_float32_array(const Vector3 *p_vecs, size_t p_count) {
// We always allocate a new array, and we don't `memcpy()`.
// We also don't consider returning a pointer to the passed vectors when `sizeof(real_t) == 4`.
// One reason is that we could decide to put a 4th component in `Vector3` for SIMD/mobile performance,
// which would cause trouble with these optimizations.
Vector<float> floats;
- if (count == 0) {
+ if (p_count == 0) {
return floats;
}
- floats.resize(count * 3);
+ floats.resize(p_count * 3);
float *floats_w = floats.ptrw();
- for (size_t i = 0; i < count; ++i) {
- const Vector3 v = vecs[i];
+ for (size_t i = 0; i < p_count; ++i) {
+ const Vector3 v = p_vecs[i];
floats_w[0] = v.x;
floats_w[1] = v.y;
floats_w[2] = v.z;
diff --git a/core/io/marshalls.h b/core/io/marshalls.h
index f6e79a4f310..6c6efca78a5 100644
--- a/core/io/marshalls.h
+++ b/core/io/marshalls.h
@@ -222,4 +222,4 @@ public:
Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = nullptr, bool p_allow_objects = false, int p_depth = 0);
Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_full_objects = false, int p_depth = 0);
-Vector<float> vector3_to_float32_array(const Vector3 *vecs, size_t count);
+Vector<float> vector3_to_float32_array(const Vector3 *p_vecs, size_t p_count);
diff --git a/core/io/net_socket.h b/core/io/net_socket.h
index 40a28169278..4d7b67467e2 100644
--- a/core/io/net_socket.h
+++ b/core/io/net_socket.h
@@ -99,7 +99,7 @@ public:
virtual Error bind(Address p_addr) = 0;
virtual Error listen(int p_max_pending) = 0;
virtual Error connect_to_host(Address p_addr) = 0;
- virtual Error poll(PollType p_type, int timeout) const = 0;
+ virtual Error poll(PollType p_type, int p_timeout) const = 0;
virtual Error recv(uint8_t *p_buffer, int p_len, int &r_read) = 0;
virtual Error recvfrom(uint8_t *p_buffer, int p_len, int &r_read, IPAddress &r_ip, uint16_t &r_port, bool p_peek = false) = 0;
virtual Error send(const uint8_t *p_buffer, int p_len, int &r_sent) = 0;
diff --git a/core/io/packed_data_container.cpp b/core/io/packed_data_container.cpp
index 701bb9c10ed..dca730abf94 100644
--- a/core/io/packed_data_container.cpp
+++ b/core/io/packed_data_container.cpp
@@ -99,7 +99,7 @@ Variant PackedDataContainer::_iter_get_ofs(const Variant &p_iter, uint32_t p_off
}
}
-Variant PackedDataContainer::_get_at_ofs(uint32_t p_ofs, const uint8_t *p_buf, bool &err) const {
+Variant PackedDataContainer::_get_at_ofs(uint32_t p_ofs, const uint8_t *p_buf, bool &r_err) const {
ERR_FAIL_COND_V(p_ofs + 4 > (uint32_t)data.size(), Variant());
uint32_t type = decode_uint32(p_buf + p_ofs);
@@ -115,8 +115,8 @@ Variant PackedDataContainer::_get_at_ofs(uint32_t p_ofs, const uint8_t *p_buf, b
Error rerr = decode_variant(v, p_buf + p_ofs, datalen - p_ofs, nullptr, false);
if (rerr != OK) {
- err = true;
- ERR_FAIL_COND_V_MSG(err != OK, Variant(), "Error when trying to decode Variant.");
+ r_err = true;
+ ERR_FAIL_COND_V_MSG(r_err != OK, Variant(), "Error when trying to decode Variant.");
}
return v;
}
@@ -151,11 +151,11 @@ int PackedDataContainer::_size(uint32_t p_ofs) const {
return -1;
}
-Variant PackedDataContainer::_key_at_ofs(uint32_t p_ofs, const Variant &p_key, bool &err) const {
+Variant PackedDataContainer::_key_at_ofs(uint32_t p_ofs, const Variant &p_key, bool &r_err) const {
ERR_FAIL_COND_V(p_ofs + 4 > (uint32_t)data.size(), Variant());
const uint8_t *rd = data.ptr();
if (!rd) {
- err = true;
+ r_err = true;
ERR_FAIL_NULL_V(rd, Variant());
}
const uint8_t *r = &rd[p_ofs];
@@ -166,14 +166,14 @@ Variant PackedDataContainer::_key_at_ofs(uint32_t p_ofs, const Variant &p_key, b
int idx = p_key;
int len = decode_uint32(r + 4);
if (idx < 0 || idx >= len) {
- err = true;
+ r_err = true;
return Variant();
}
uint32_t ofs = decode_uint32(r + 8 + 4 * idx);
- return _get_at_ofs(ofs, rd, err);
+ return _get_at_ofs(ofs, rd, r_err);
} else {
- err = true;
+ r_err = true;
return Variant();
}
@@ -185,13 +185,13 @@ Variant PackedDataContainer::_key_at_ofs(uint32_t p_ofs, const Variant &p_key, b
for (uint32_t i = 0; i < len; i++) {
uint32_t khash = decode_uint32(r + 8 + i * 12 + 0);
if (khash == hash) {
- Variant key = _get_at_ofs(decode_uint32(r + 8 + i * 12 + 4), rd, err);
- if (err) {
+ Variant key = _get_at_ofs(decode_uint32(r + 8 + i * 12 + 4), rd, r_err);
+ if (r_err) {
return Variant();
}
if (key == p_key) {
//key matches, return value
- return _get_at_ofs(decode_uint32(r + 8 + i * 12 + 8), rd, err);
+ return _get_at_ofs(decode_uint32(r + 8 + i * 12 + 8), rd, r_err);
}
found = true;
} else {
@@ -201,24 +201,24 @@ Variant PackedDataContainer::_key_at_ofs(uint32_t p_ofs, const Variant &p_key, b
}
}
- err = true;
+ r_err = true;
return Variant();
} else {
- err = true;
+ r_err = true;
return Variant();
}
}
-uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpdata, HashMap<String, uint32_t> &string_cache) {
+uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &r_tmpdata, HashMap<String, uint32_t> &r_string_cache) {
switch (p_data.get_type()) {
case Variant::STRING: {
String s = p_data;
- if (string_cache.has(s)) {
- return string_cache[s];
+ if (r_string_cache.has(s)) {
+ return r_string_cache[s];
}
- string_cache[s] = tmpdata.size();
+ r_string_cache[s] = r_tmpdata.size();
[[fallthrough]];
}
@@ -247,27 +247,27 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd
case Variant::PACKED_VECTOR4_ARRAY:
case Variant::STRING_NAME:
case Variant::NODE_PATH: {
- uint32_t pos = tmpdata.size();
+ uint32_t pos = r_tmpdata.size();
int len;
encode_variant(p_data, nullptr, len, false);
- tmpdata.resize(tmpdata.size() + len);
- encode_variant(p_data, &tmpdata.write[pos], len, false);
+ r_tmpdata.resize(r_tmpdata.size() + len);
+ encode_variant(p_data, &r_tmpdata.write[pos], len, false);
return pos;
} break;
// misc types
case Variant::RID:
case Variant::OBJECT: {
- return _pack(Variant(), tmpdata, string_cache);
+ return _pack(Variant(), r_tmpdata, r_string_cache);
} break;
case Variant::DICTIONARY: {
Dictionary d = p_data;
//size is known, use sort
- uint32_t pos = tmpdata.size();
+ uint32_t pos = r_tmpdata.size();
int len = d.size();
- tmpdata.resize(tmpdata.size() + len * 12 + 8);
- encode_uint32(TYPE_DICT, &tmpdata.write[pos + 0]);
- encode_uint32(len, &tmpdata.write[pos + 4]);
+ r_tmpdata.resize(r_tmpdata.size() + len * 12 + 8);
+ encode_uint32(TYPE_DICT, &r_tmpdata.write[pos + 0]);
+ encode_uint32(len, &r_tmpdata.write[pos + 4]);
List<DictKey> sortk;
@@ -282,11 +282,11 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd
int idx = 0;
for (const DictKey &E : sortk) {
- encode_uint32(E.hash, &tmpdata.write[pos + 8 + idx * 12 + 0]);
- uint32_t ofs = _pack(E.key, tmpdata, string_cache);
- encode_uint32(ofs, &tmpdata.write[pos + 8 + idx * 12 + 4]);
- ofs = _pack(d[E.key], tmpdata, string_cache);
- encode_uint32(ofs, &tmpdata.write[pos + 8 + idx * 12 + 8]);
+ encode_uint32(E.hash, &r_tmpdata.write[pos + 8 + idx * 12 + 0]);
+ uint32_t ofs = _pack(E.key, r_tmpdata, r_string_cache);
+ encode_uint32(ofs, &r_tmpdata.write[pos + 8 + idx * 12 + 4]);
+ ofs = _pack(d[E.key], r_tmpdata, r_string_cache);
+ encode_uint32(ofs, &r_tmpdata.write[pos + 8 + idx * 12 + 8]);
idx++;
}
@@ -296,15 +296,15 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd
case Variant::ARRAY: {
Array a = p_data;
//size is known, use sort
- uint32_t pos = tmpdata.size();
+ uint32_t pos = r_tmpdata.size();
int len = a.size();
- tmpdata.resize(tmpdata.size() + len * 4 + 8);
- encode_uint32(TYPE_ARRAY, &tmpdata.write[pos + 0]);
- encode_uint32(len, &tmpdata.write[pos + 4]);
+ r_tmpdata.resize(r_tmpdata.size() + len * 4 + 8);
+ encode_uint32(TYPE_ARRAY, &r_tmpdata.write[pos + 0]);
+ encode_uint32(len, &r_tmpdata.write[pos + 4]);
for (int i = 0; i < len; i++) {
- uint32_t ofs = _pack(a[i], tmpdata, string_cache);
- encode_uint32(ofs, &tmpdata.write[pos + 8 + i * 4]);
+ uint32_t ofs = _pack(a[i], r_tmpdata, r_string_cache);
+ encode_uint32(ofs, &r_tmpdata.write[pos + 8 + i * 4]);
}
return pos;
diff --git a/core/io/packed_data_container.h b/core/io/packed_data_container.h
index e0dbd10ad87..c8abe2c6415 100644
--- a/core/io/packed_data_container.h
+++ b/core/io/packed_data_container.h
@@ -49,7 +49,7 @@ class PackedDataContainer : public Resource {
Vector<uint8_t> data;
int datalen = 0;
- uint32_t _pack(const Variant &p_data, Vector<uint8_t> &tmpdata, HashMap<String, uint32_t> &string_cache);
+ uint32_t _pack(const Variant &p_data, Vector<uint8_t> &r_tmpdata, HashMap<String, uint32_t> &r_string_cache);
Variant _iter_init_ofs(const Array &p_iter, uint32_t p_offset);
Variant _iter_next_ofs(const Array &p_iter, uint32_t p_offset);
@@ -60,8 +60,8 @@ class PackedDataContainer : public Resource {
Variant _iter_get(const Variant &p_iter);
friend class PackedDataContainerRef;
- Variant _key_at_ofs(uint32_t p_ofs, const Variant &p_key, bool &err) const;
- Variant _get_at_ofs(uint32_t p_ofs, const uint8_t *p_buf, bool &err) const;
+ Variant _key_at_ofs(uint32_t p_ofs, const Variant &p_key, bool &r_err) const;
+ Variant _get_at_ofs(uint32_t p_ofs, const uint8_t *p_buf, bool &r_err) const;
uint32_t _type_at_ofs(uint32_t p_ofs) const;
int _size(uint32_t p_ofs) const;
diff --git a/core/io/packet_peer_udp.h b/core/io/packet_peer_udp.h
index ef005b0854c..c72940d4b67 100644
--- a/core/io/packet_peer_udp.h
+++ b/core/io/packet_peer_udp.h
@@ -74,7 +74,7 @@ public:
Error wait();
bool is_bound() const;
- Error connect_shared_socket(Ref<NetSocket> p_sock, IPAddress p_ip, uint16_t p_port, UDPServer *ref); // Used by UDPServer
+ Error connect_shared_socket(Ref<NetSocket> p_sock, IPAddress p_ip, uint16_t p_port, UDPServer *p_server); // Used by UDPServer
void disconnect_shared_socket(); // Used by UDPServer
Error store_packet(IPAddress p_ip, uint32_t p_port, uint8_t *p_buf, int p_buf_size); // Used internally and by UDPServer
Error connect_to_host(const IPAddress &p_host, int p_port);
diff --git a/core/io/remote_filesystem_client.cpp b/core/io/remote_filesystem_client.cpp
index f637fb67250..ad5da9d4d4a 100644
--- a/core/io/remote_filesystem_client.cpp
+++ b/core/io/remote_filesystem_client.cpp
@@ -85,8 +85,8 @@ Vector<RemoteFilesystemClient::FileCache> RemoteFilesystemClient::_load_cache_fi
return file_cache;
}
-Error RemoteFilesystemClient::_store_file(const String &p_path, const LocalVector<uint8_t> &p_file, uint64_t &modified_time) {
- modified_time = 0;
+Error RemoteFilesystemClient::_store_file(const String &p_path, const LocalVector<uint8_t> &p_file, uint64_t &r_modified_time) {
+ r_modified_time = 0;
String full_path = cache_path.path_join(FILES_SUBFOLDER).path_join(p_path);
String base_file_dir = full_path.get_base_dir();
@@ -105,7 +105,7 @@ Error RemoteFilesystemClient::_store_file(const String &p_path, const LocalVecto
}
f.unref(); // Unref to ensure file is not locked and modified time can be obtained.
- modified_time = FileAccess::get_modified_time(full_path);
+ r_modified_time = FileAccess::get_modified_time(full_path);
return OK;
}
diff --git a/core/io/remote_filesystem_client.h b/core/io/remote_filesystem_client.h
index 6b4db9b56dc..a08888683e9 100644
--- a/core/io/remote_filesystem_client.h
+++ b/core/io/remote_filesystem_client.h
@@ -48,7 +48,7 @@ protected:
virtual bool _is_configured() { return !cache_path.is_empty(); }
// Can be re-implemented per platform. If so, feel free to ignore get_cache_path()
virtual Vector<FileCache> _load_cache_file();
- virtual Error _store_file(const String &p_path, const LocalVector<uint8_t> &p_file, uint64_t &modified_time);
+ virtual Error _store_file(const String &p_path, const LocalVector<uint8_t> &p_file, uint64_t &r_modified_time);
virtual Error _remove_file(const String &p_path);
virtual Error _store_cache_file(const Vector<FileCache> &p_cache);
virtual Error _synchronize_with_server(const String &p_host, int p_port, const String &p_password, String &r_cache_path);
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 2b251dabf9b..ea17f39e1e5 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -110,15 +110,15 @@ void ResourceLoaderBinary::_advance_padding(uint32_t p_len) {
}
}
-static Error read_reals(real_t *dst, Ref<FileAccess> &f, size_t count) {
- if (f->real_is_double) {
+static Error read_reals(real_t *r_dst, Ref<FileAccess> &r_file, size_t p_count) {
+ if (r_file->real_is_double) {
if constexpr (sizeof(real_t) == 8) {
// Ideal case with double-precision
- f->get_buffer((uint8_t *)dst, count * sizeof(double));
+ r_file->get_buffer((uint8_t *)r_dst, p_count * sizeof(double));
} else if constexpr (sizeof(real_t) == 4) {
// May be slower, but this is for compatibility. Eventually the data should be converted.
- for (size_t i = 0; i < count; ++i) {
- dst[i] = f->get_double();
+ for (size_t i = 0; i < p_count; ++i) {
+ r_dst[i] = r_file->get_double();
}
} else {
ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "real_t size is neither 4 nor 8!");
@@ -126,10 +126,10 @@ static Error read_reals(real_t *dst, Ref<FileAccess> &f, size_t count) {
} else {
if constexpr (sizeof(real_t) == 4) {
// Ideal case with float-precision
- f->get_buffer((uint8_t *)dst, count * sizeof(float));
+ r_file->get_buffer((uint8_t *)r_dst, p_count * sizeof(float));
} else if constexpr (sizeof(real_t) == 8) {
- for (size_t i = 0; i < count; ++i) {
- dst[i] = f->get_float();
+ for (size_t i = 0; i < p_count; ++i) {
+ r_dst[i] = r_file->get_float();
}
} else {
ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "real_t size is neither 4 nor 8!");
@@ -847,17 +847,17 @@ void ResourceLoaderBinary::set_translation_remapped(bool p_remapped) {
translation_remapped = p_remapped;
}
-static void save_ustring(Ref<FileAccess> f, const String &p_string) {
+static void save_ustring(Ref<FileAccess> r_file, const String &p_string) {
CharString utf8 = p_string.utf8();
- f->store_32(uint32_t(utf8.length() + 1));
- f->store_buffer((const uint8_t *)utf8.get_data(), utf8.length() + 1);
+ r_file->store_32(uint32_t(utf8.length() + 1));
+ r_file->store_buffer((const uint8_t *)utf8.get_data(), utf8.length() + 1);
}
-static String get_ustring(Ref<FileAccess> f) {
- int len = f->get_32();
+static String get_ustring(Ref<FileAccess> r_file) {
+ int len = r_file->get_32();
Vector<char> str_buf;
str_buf.resize(len);
- f->get_buffer((uint8_t *)&str_buf[0], len);
+ r_file->get_buffer((uint8_t *)&str_buf[0], len);
return String::utf8(&str_buf[0], len);
}
@@ -873,23 +873,23 @@ String ResourceLoaderBinary::get_unicode_string() {
return String::utf8(&str_buf[0], len);
}
-void ResourceLoaderBinary::get_classes_used(Ref<FileAccess> p_f, HashSet<StringName> *p_classes) {
- open(p_f, false, true);
+void ResourceLoaderBinary::get_classes_used(Ref<FileAccess> p_file, HashSet<StringName> *p_classes) {
+ open(p_file, false, true);
if (error) {
return;
}
for (const IntResource &res : internal_resources) {
- p_f->seek(res.offset);
+ p_file->seek(res.offset);
String t = get_unicode_string();
- if (!p_f->get_error() && t != String() && ClassDB::class_exists(t)) {
+ if (!p_file->get_error() && t != String() && ClassDB::class_exists(t)) {
p_classes->insert(t);
}
}
}
-void ResourceLoaderBinary::get_dependencies(Ref<FileAccess> p_f, List<String> *p_dependencies, bool p_add_types) {
- open(p_f, false, true);
+void ResourceLoaderBinary::get_dependencies(Ref<FileAccess> p_file, List<String> *p_dependencies, bool p_add_types) {
+ open(p_file, false, true);
if (error) {
return;
}
@@ -919,10 +919,10 @@ void ResourceLoaderBinary::get_dependencies(Ref<FileAccess> p_f, List<String> *p
}
}
-void ResourceLoaderBinary::open(Ref<FileAccess> p_f, bool p_no_resources, bool p_keep_uuid_paths) {
+void ResourceLoaderBinary::open(Ref<FileAccess> p_file, bool p_no_resources, bool p_keep_uuid_paths) {
error = OK;
- f = p_f;
+ f = p_file;
uint8_t header[4];
f->get_buffer(header, 4);
if (header[0] == 'R' && header[1] == 'S' && header[2] == 'C' && header[3] == 'C') {
@@ -1053,10 +1053,10 @@ void ResourceLoaderBinary::open(Ref<FileAccess> p_f, bool p_no_resources, bool p
}
}
-String ResourceLoaderBinary::recognize(Ref<FileAccess> p_f) {
+String ResourceLoaderBinary::recognize(Ref<FileAccess> p_file) {
error = OK;
- f = p_f;
+ f = p_file;
uint8_t header[4];
f->get_buffer(header, 4);
if (header[0] == 'R' && header[1] == 'S' && header[2] == 'C' && header[3] == 'C') {
@@ -1094,10 +1094,10 @@ String ResourceLoaderBinary::recognize(Ref<FileAccess> p_f) {
return get_unicode_string();
}
-String ResourceLoaderBinary::recognize_script_class(Ref<FileAccess> p_f) {
+String ResourceLoaderBinary::recognize_script_class(Ref<FileAccess> p_file) {
error = OK;
- f = p_f;
+ f = p_file;
uint8_t header[4];
f->get_buffer(header, 4);
if (header[0] == 'R' && header[1] == 'S' && header[2] == 'C' && header[3] == 'C') {
@@ -1548,35 +1548,35 @@ bool ResourceFormatLoaderBinary::has_custom_uid_support() const {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-void ResourceFormatSaverBinaryInstance::_pad_buffer(Ref<FileAccess> f, int p_bytes) {
+void ResourceFormatSaverBinaryInstance::_pad_buffer(Ref<FileAccess> r_file, int p_bytes) {
int extra = 4 - (p_bytes % 4);
if (extra < 4) {
for (int i = 0; i < extra; i++) {
- f->store_8(0); //pad to 32
+ r_file->store_8(0); //pad to 32
}
}
}
-void ResourceFormatSaverBinaryInstance::write_variant(Ref<FileAccess> f, const Variant &p_property, HashMap<Ref<Resource>, int> &resource_map, HashMap<Ref<Resource>, int> &external_resources, HashMap<StringName, int> &string_map, const PropertyInfo &p_hint) {
+void ResourceFormatSaverBinaryInstance::write_variant(Ref<FileAccess> r_file, const Variant &p_property, HashMap<Ref<Resource>, int> &r_resource_map, HashMap<Ref<Resource>, int> &r_external_resources, HashMap<StringName, int> &r_string_map, const PropertyInfo &p_hint) {
switch (p_property.get_type()) {
case Variant::NIL: {
- f->store_32(VARIANT_NIL);
+ r_file->store_32(VARIANT_NIL);
// don't store anything
} break;
case Variant::BOOL: {
- f->store_32(VARIANT_BOOL);
+ r_file->store_32(VARIANT_BOOL);
bool val = p_property;
- f->store_32(val);
+ r_file->store_32(val);
} break;
case Variant::INT: {
int64_t val = p_property;
if (val > 0x7FFFFFFF || val < -(int64_t)0x80000000) {
- f->store_32(VARIANT_INT64);
- f->store_64(uint64_t(val));
+ r_file->store_32(VARIANT_INT64);
+ r_file->store_64(uint64_t(val));
} else {
- f->store_32(VARIANT_INT);
- f->store_32(uint32_t(p_property));
+ r_file->store_32(VARIANT_INT);
+ r_file->store_32(uint32_t(p_property));
}
} break;
@@ -1584,393 +1584,393 @@ void ResourceFormatSaverBinaryInstance::write_variant(Ref<FileAccess> f, const V
double d = p_property;
float fl = d;
if (double(fl) != d) {
- f->store_32(VARIANT_DOUBLE);
- f->store_double(d);
+ r_file->store_32(VARIANT_DOUBLE);
+ r_file->store_double(d);
} else {
- f->store_32(VARIANT_FLOAT);
- f->store_real(fl);
+ r_file->store_32(VARIANT_FLOAT);
+ r_file->store_real(fl);
}
} break;
case Variant::STRING: {
- f->store_32(VARIANT_STRING);
+ r_file->store_32(VARIANT_STRING);
String val = p_property;
- save_unicode_string(f, val);
+ save_unicode_string(r_file, val);
} break;
case Variant::VECTOR2: {
- f->store_32(VARIANT_VECTOR2);
+ r_file->store_32(VARIANT_VECTOR2);
Vector2 val = p_property;
- f->store_real(val.x);
- f->store_real(val.y);
+ r_file->store_real(val.x);
+ r_file->store_real(val.y);
} break;
case Variant::VECTOR2I: {
- f->store_32(VARIANT_VECTOR2I);
+ r_file->store_32(VARIANT_VECTOR2I);
Vector2i val = p_property;
- f->store_32(uint32_t(val.x));
- f->store_32(uint32_t(val.y));
+ r_file->store_32(uint32_t(val.x));
+ r_file->store_32(uint32_t(val.y));
} break;
case Variant::RECT2: {
- f->store_32(VARIANT_RECT2);
+ r_file->store_32(VARIANT_RECT2);
Rect2 val = p_property;
- f->store_real(val.position.x);
- f->store_real(val.position.y);
- f->store_real(val.size.x);
- f->store_real(val.size.y);
+ r_file->store_real(val.position.x);
+ r_file->store_real(val.position.y);
+ r_file->store_real(val.size.x);
+ r_file->store_real(val.size.y);
} break;
case Variant::RECT2I: {
- f->store_32(VARIANT_RECT2I);
+ r_file->store_32(VARIANT_RECT2I);
Rect2i val = p_property;
- f->store_32(uint32_t(val.position.x));
- f->store_32(uint32_t(val.position.y));
- f->store_32(uint32_t(val.size.x));
- f->store_32(uint32_t(val.size.y));
+ r_file->store_32(uint32_t(val.position.x));
+ r_file->store_32(uint32_t(val.position.y));
+ r_file->store_32(uint32_t(val.size.x));
+ r_file->store_32(uint32_t(val.size.y));
} break;
case Variant::VECTOR3: {
- f->store_32(VARIANT_VECTOR3);
+ r_file->store_32(VARIANT_VECTOR3);
Vector3 val = p_property;
- f->store_real(val.x);
- f->store_real(val.y);
- f->store_real(val.z);
+ r_file->store_real(val.x);
+ r_file->store_real(val.y);
+ r_file->store_real(val.z);
} break;
case Variant::VECTOR3I: {
- f->store_32(VARIANT_VECTOR3I);
+ r_file->store_32(VARIANT_VECTOR3I);
Vector3i val = p_property;
- f->store_32(uint32_t(val.x));
- f->store_32(uint32_t(val.y));
- f->store_32(uint32_t(val.z));
+ r_file->store_32(uint32_t(val.x));
+ r_file->store_32(uint32_t(val.y));
+ r_file->store_32(uint32_t(val.z));
} break;
case Variant::VECTOR4: {
- f->store_32(VARIANT_VECTOR4);
+ r_file->store_32(VARIANT_VECTOR4);
Vector4 val = p_property;
- f->store_real(val.x);
- f->store_real(val.y);
- f->store_real(val.z);
- f->store_real(val.w);
+ r_file->store_real(val.x);
+ r_file->store_real(val.y);
+ r_file->store_real(val.z);
+ r_file->store_real(val.w);
} break;
case Variant::VECTOR4I: {
- f->store_32(VARIANT_VECTOR4I);
+ r_file->store_32(VARIANT_VECTOR4I);
Vector4i val = p_property;
- f->store_32(uint32_t(val.x));
- f->store_32(uint32_t(val.y));
- f->store_32(uint32_t(val.z));
- f->store_32(uint32_t(val.w));
+ r_file->store_32(uint32_t(val.x));
+ r_file->store_32(uint32_t(val.y));
+ r_file->store_32(uint32_t(val.z));
+ r_file->store_32(uint32_t(val.w));
} break;
case Variant::PLANE: {
- f->store_32(VARIANT_PLANE);
+ r_file->store_32(VARIANT_PLANE);
Plane val = p_property;
- f->store_real(val.normal.x);
- f->store_real(val.normal.y);
- f->store_real(val.normal.z);
- f->store_real(val.d);
+ r_file->store_real(val.normal.x);
+ r_file->store_real(val.normal.y);
+ r_file->store_real(val.normal.z);
+ r_file->store_real(val.d);
} break;
case Variant::QUATERNION: {
- f->store_32(VARIANT_QUATERNION);
+ r_file->store_32(VARIANT_QUATERNION);
Quaternion val = p_property;
- f->store_real(val.x);
- f->store_real(val.y);
- f->store_real(val.z);
- f->store_real(val.w);
+ r_file->store_real(val.x);
+ r_file->store_real(val.y);
+ r_file->store_real(val.z);
+ r_file->store_real(val.w);
} break;
case Variant::AABB: {
- f->store_32(VARIANT_AABB);
+ r_file->store_32(VARIANT_AABB);
AABB val = p_property;
- f->store_real(val.position.x);
- f->store_real(val.position.y);
- f->store_real(val.position.z);
- f->store_real(val.size.x);
- f->store_real(val.size.y);
- f->store_real(val.size.z);
+ r_file->store_real(val.position.x);
+ r_file->store_real(val.position.y);
+ r_file->store_real(val.position.z);
+ r_file->store_real(val.size.x);
+ r_file->store_real(val.size.y);
+ r_file->store_real(val.size.z);
} break;
case Variant::TRANSFORM2D: {
- f->store_32(VARIANT_TRANSFORM2D);
+ r_file->store_32(VARIANT_TRANSFORM2D);
Transform2D val = p_property;
- f->store_real(val.columns[0].x);
- f->store_real(val.columns[0].y);
- f->store_real(val.columns[1].x);
- f->store_real(val.columns[1].y);
- f->store_real(val.columns[2].x);
- f->store_real(val.columns[2].y);
+ r_file->store_real(val.columns[0].x);
+ r_file->store_real(val.columns[0].y);
+ r_file->store_real(val.columns[1].x);
+ r_file->store_real(val.columns[1].y);
+ r_file->store_real(val.columns[2].x);
+ r_file->store_real(val.columns[2].y);
} break;
case Variant::BASIS: {
- f->store_32(VARIANT_BASIS);
+ r_file->store_32(VARIANT_BASIS);
Basis val = p_property;
- f->store_real(val.rows[0].x);
- f->store_real(val.rows[0].y);
- f->store_real(val.rows[0].z);
- f->store_real(val.rows[1].x);
- f->store_real(val.rows[1].y);
- f->store_real(val.rows[1].z);
- f->store_real(val.rows[2].x);
- f->store_real(val.rows[2].y);
- f->store_real(val.rows[2].z);
+ r_file->store_real(val.rows[0].x);
+ r_file->store_real(val.rows[0].y);
+ r_file->store_real(val.rows[0].z);
+ r_file->store_real(val.rows[1].x);
+ r_file->store_real(val.rows[1].y);
+ r_file->store_real(val.rows[1].z);
+ r_file->store_real(val.rows[2].x);
+ r_file->store_real(val.rows[2].y);
+ r_file->store_real(val.rows[2].z);
} break;
case Variant::TRANSFORM3D: {
- f->store_32(VARIANT_TRANSFORM3D);
+ r_file->store_32(VARIANT_TRANSFORM3D);
Transform3D val = p_property;
- f->store_real(val.basis.rows[0].x);
- f->store_real(val.basis.rows[0].y);
- f->store_real(val.basis.rows[0].z);
- f->store_real(val.basis.rows[1].x);
- f->store_real(val.basis.rows[1].y);
- f->store_real(val.basis.rows[1].z);
- f->store_real(val.basis.rows[2].x);
- f->store_real(val.basis.rows[2].y);
- f->store_real(val.basis.rows[2].z);
- f->store_real(val.origin.x);
- f->store_real(val.origin.y);
- f->store_real(val.origin.z);
+ r_file->store_real(val.basis.rows[0].x);
+ r_file->store_real(val.basis.rows[0].y);
+ r_file->store_real(val.basis.rows[0].z);
+ r_file->store_real(val.basis.rows[1].x);
+ r_file->store_real(val.basis.rows[1].y);
+ r_file->store_real(val.basis.rows[1].z);
+ r_file->store_real(val.basis.rows[2].x);
+ r_file->store_real(val.basis.rows[2].y);
+ r_file->store_real(val.basis.rows[2].z);
+ r_file->store_real(val.origin.x);
+ r_file->store_real(val.origin.y);
+ r_file->store_real(val.origin.z);
} break;
case Variant::PROJECTION: {
- f->store_32(VARIANT_PROJECTION);
+ r_file->store_32(VARIANT_PROJECTION);
Projection val = p_property;
- f->store_real(val.columns[0].x);
- f->store_real(val.columns[0].y);
- f->store_real(val.columns[0].z);
- f->store_real(val.columns[0].w);
- f->store_real(val.columns[1].x);
- f->store_real(val.columns[1].y);
- f->store_real(val.columns[1].z);
- f->store_real(val.columns[1].w);
- f->store_real(val.columns[2].x);
- f->store_real(val.columns[2].y);
- f->store_real(val.columns[2].z);
- f->store_real(val.columns[2].w);
- f->store_real(val.columns[3].x);
- f->store_real(val.columns[3].y);
- f->store_real(val.columns[3].z);
- f->store_real(val.columns[3].w);
+ r_file->store_real(val.columns[0].x);
+ r_file->store_real(val.columns[0].y);
+ r_file->store_real(val.columns[0].z);
+ r_file->store_real(val.columns[0].w);
+ r_file->store_real(val.columns[1].x);
+ r_file->store_real(val.columns[1].y);
+ r_file->store_real(val.columns[1].z);
+ r_file->store_real(val.columns[1].w);
+ r_file->store_real(val.columns[2].x);
+ r_file->store_real(val.columns[2].y);
+ r_file->store_real(val.columns[2].z);
+ r_file->store_real(val.columns[2].w);
+ r_file->store_real(val.columns[3].x);
+ r_file->store_real(val.columns[3].y);
+ r_file->store_real(val.columns[3].z);
+ r_file->store_real(val.columns[3].w);
} break;
case Variant::COLOR: {
- f->store_32(VARIANT_COLOR);
+ r_file->store_32(VARIANT_COLOR);
Color val = p_property;
// Color are always floats
- f->store_float(val.r);
- f->store_float(val.g);
- f->store_float(val.b);
- f->store_float(val.a);
+ r_file->store_float(val.r);
+ r_file->store_float(val.g);
+ r_file->store_float(val.b);
+ r_file->store_float(val.a);
} break;
case Variant::STRING_NAME: {
- f->store_32(VARIANT_STRING_NAME);
+ r_file->store_32(VARIANT_STRING_NAME);
String val = p_property;
- save_unicode_string(f, val);
+ save_unicode_string(r_file, val);
} break;
case Variant::NODE_PATH: {
- f->store_32(VARIANT_NODE_PATH);
+ r_file->store_32(VARIANT_NODE_PATH);
NodePath np = p_property;
- f->store_16(np.get_name_count());
+ r_file->store_16(np.get_name_count());
uint16_t snc = np.get_subname_count();
if (np.is_absolute()) {
snc |= 0x8000;
}
- f->store_16(snc);
+ r_file->store_16(snc);
for (int i = 0; i < np.get_name_count(); i++) {
- if (string_map.has(np.get_name(i))) {
- f->store_32(uint32_t(string_map[np.get_name(i)]));
+ if (r_string_map.has(np.get_name(i))) {
+ r_file->store_32(uint32_t(r_string_map[np.get_name(i)]));
} else {
- save_unicode_string(f, np.get_name(i), true);
+ save_unicode_string(r_file, np.get_name(i), true);
}
}
for (int i = 0; i < np.get_subname_count(); i++) {
- if (string_map.has(np.get_subname(i))) {
- f->store_32(uint32_t(string_map[np.get_subname(i)]));
+ if (r_string_map.has(np.get_subname(i))) {
+ r_file->store_32(uint32_t(r_string_map[np.get_subname(i)]));
} else {
- save_unicode_string(f, np.get_subname(i), true);
+ save_unicode_string(r_file, np.get_subname(i), true);
}
}
} break;
case Variant::RID: {
- f->store_32(VARIANT_RID);
+ r_file->store_32(VARIANT_RID);
WARN_PRINT("Can't save RIDs.");
RID val = p_property;
- f->store_32(uint32_t(val.get_id()));
+ r_file->store_32(uint32_t(val.get_id()));
} break;
case Variant::OBJECT: {
- f->store_32(VARIANT_OBJECT);
+ r_file->store_32(VARIANT_OBJECT);
Ref<Resource> res = p_property;
if (res.is_null() || res->get_meta(SNAME("_skip_save_"), false)) {
- f->store_32(OBJECT_EMPTY);
+ r_file->store_32(OBJECT_EMPTY);
return; // Don't save it.
}
if (!res->is_built_in()) {
- f->store_32(OBJECT_EXTERNAL_RESOURCE_INDEX);
- f->store_32(uint32_t(external_resources[res]));
+ r_file->store_32(OBJECT_EXTERNAL_RESOURCE_INDEX);
+ r_file->store_32(uint32_t(r_external_resources[res]));
} else {
- if (!resource_map.has(res)) {
- f->store_32(OBJECT_EMPTY);
+ if (!r_resource_map.has(res)) {
+ r_file->store_32(OBJECT_EMPTY);
ERR_FAIL_MSG("Resource was not pre cached for the resource section, most likely due to circular reference.");
}
- f->store_32(OBJECT_INTERNAL_RESOURCE);
- f->store_32(uint32_t(resource_map[res]));
+ r_file->store_32(OBJECT_INTERNAL_RESOURCE);
+ r_file->store_32(uint32_t(r_resource_map[res]));
//internal resource
}
} break;
case Variant::CALLABLE: {
- f->store_32(VARIANT_CALLABLE);
+ r_file->store_32(VARIANT_CALLABLE);
WARN_PRINT("Can't save Callables.");
} break;
case Variant::SIGNAL: {
- f->store_32(VARIANT_SIGNAL);
+ r_file->store_32(VARIANT_SIGNAL);
WARN_PRINT("Can't save Signals.");
} break;
case Variant::DICTIONARY: {
- f->store_32(VARIANT_DICTIONARY);
+ r_file->store_32(VARIANT_DICTIONARY);
Dictionary d = p_property;
- f->store_32(uint32_t(d.size()));
+ r_file->store_32(uint32_t(d.size()));
for (const KeyValue<Variant, Variant> &kv : d) {
- write_variant(f, kv.key, resource_map, external_resources, string_map);
- write_variant(f, kv.value, resource_map, external_resources, string_map);
+ write_variant(r_file, kv.key, r_resource_map, r_external_resources, r_string_map);
+ write_variant(r_file, kv.value, r_resource_map, r_external_resources, r_string_map);
}
} break;
case Variant::ARRAY: {
- f->store_32(VARIANT_ARRAY);
+ r_file->store_32(VARIANT_ARRAY);
Array a = p_property;
- f->store_32(uint32_t(a.size()));
+ r_file->store_32(uint32_t(a.size()));
for (const Variant &var : a) {
- write_variant(f, var, resource_map, external_resources, string_map);
+ write_variant(r_file, var, r_resource_map, r_external_resources, r_string_map);
}
} break;
case Variant::PACKED_BYTE_ARRAY: {
- f->store_32(VARIANT_PACKED_BYTE_ARRAY);
+ r_file->store_32(VARIANT_PACKED_BYTE_ARRAY);
Vector<uint8_t> arr = p_property;
int len = arr.size();
- f->store_32(uint32_t(len));
+ r_file->store_32(uint32_t(len));
const uint8_t *r = arr.ptr();
- f->store_buffer(r, len);
- _pad_buffer(f, len);
+ r_file->store_buffer(r, len);
+ _pad_buffer(r_file, len);
} break;
case Variant::PACKED_INT32_ARRAY: {
- f->store_32(VARIANT_PACKED_INT32_ARRAY);
+ r_file->store_32(VARIANT_PACKED_INT32_ARRAY);
Vector<int32_t> arr = p_property;
int len = arr.size();
- f->store_32(uint32_t(len));
+ r_file->store_32(uint32_t(len));
const int32_t *r = arr.ptr();
for (int i = 0; i < len; i++) {
- f->store_32(uint32_t(r[i]));
+ r_file->store_32(uint32_t(r[i]));
}
} break;
case Variant::PACKED_INT64_ARRAY: {
- f->store_32(VARIANT_PACKED_INT64_ARRAY);
+ r_file->store_32(VARIANT_PACKED_INT64_ARRAY);
Vector<int64_t> arr = p_property;
int len = arr.size();
- f->store_32(uint32_t(len));
+ r_file->store_32(uint32_t(len));
const int64_t *r = arr.ptr();
for (int i = 0; i < len; i++) {
- f->store_64(uint64_t(r[i]));
+ r_file->store_64(uint64_t(r[i]));
}
} break;
case Variant::PACKED_FLOAT32_ARRAY: {
- f->store_32(VARIANT_PACKED_FLOAT32_ARRAY);
+ r_file->store_32(VARIANT_PACKED_FLOAT32_ARRAY);
Vector<float> arr = p_property;
int len = arr.size();
- f->store_32(uint32_t(len));
+ r_file->store_32(uint32_t(len));
const float *r = arr.ptr();
for (int i = 0; i < len; i++) {
- f->store_float(r[i]);
+ r_file->store_float(r[i]);
}
} break;
case Variant::PACKED_FLOAT64_ARRAY: {
- f->store_32(VARIANT_PACKED_FLOAT64_ARRAY);
+ r_file->store_32(VARIANT_PACKED_FLOAT64_ARRAY);
Vector<double> arr = p_property;
int len = arr.size();
- f->store_32(uint32_t(len));
+ r_file->store_32(uint32_t(len));
const double *r = arr.ptr();
for (int i = 0; i < len; i++) {
- f->store_double(r[i]);
+ r_file->store_double(r[i]);
}
} break;
case Variant::PACKED_STRING_ARRAY: {
- f->store_32(VARIANT_PACKED_STRING_ARRAY);
+ r_file->store_32(VARIANT_PACKED_STRING_ARRAY);
Vector<String> arr = p_property;
int len = arr.size();
- f->store_32(uint32_t(len));
+ r_file->store_32(uint32_t(len));
const String *r = arr.ptr();
for (int i = 0; i < len; i++) {
- save_unicode_string(f, r[i]);
+ save_unicode_string(r_file, r[i]);
}
} break;
case Variant::PACKED_VECTOR2_ARRAY: {
- f->store_32(VARIANT_PACKED_VECTOR2_ARRAY);
+ r_file->store_32(VARIANT_PACKED_VECTOR2_ARRAY);
Vector<Vector2> arr = p_property;
int len = arr.size();
- f->store_32(uint32_t(len));
+ r_file->store_32(uint32_t(len));
const Vector2 *r = arr.ptr();
for (int i = 0; i < len; i++) {
- f->store_real(r[i].x);
- f->store_real(r[i].y);
+ r_file->store_real(r[i].x);
+ r_file->store_real(r[i].y);
}
} break;
case Variant::PACKED_VECTOR3_ARRAY: {
- f->store_32(VARIANT_PACKED_VECTOR3_ARRAY);
+ r_file->store_32(VARIANT_PACKED_VECTOR3_ARRAY);
Vector<Vector3> arr = p_property;
int len = arr.size();
- f->store_32(uint32_t(len));
+ r_file->store_32(uint32_t(len));
const Vector3 *r = arr.ptr();
for (int i = 0; i < len; i++) {
- f->store_real(r[i].x);
- f->store_real(r[i].y);
- f->store_real(r[i].z);
+ r_file->store_real(r[i].x);
+ r_file->store_real(r[i].y);
+ r_file->store_real(r[i].z);
}
} break;
case Variant::PACKED_COLOR_ARRAY: {
- f->store_32(VARIANT_PACKED_COLOR_ARRAY);
+ r_file->store_32(VARIANT_PACKED_COLOR_ARRAY);
Vector<Color> arr = p_property;
int len = arr.size();
- f->store_32(uint32_t(len));
+ r_file->store_32(uint32_t(len));
const Color *r = arr.ptr();
for (int i = 0; i < len; i++) {
- f->store_float(r[i].r);
- f->store_float(r[i].g);
- f->store_float(r[i].b);
- f->store_float(r[i].a);
+ r_file->store_float(r[i].r);
+ r_file->store_float(r[i].g);
+ r_file->store_float(r[i].b);
+ r_file->store_float(r[i].a);
}
} break;
case Variant::PACKED_VECTOR4_ARRAY: {
- f->store_32(VARIANT_PACKED_VECTOR4_ARRAY);
+ r_file->store_32(VARIANT_PACKED_VECTOR4_ARRAY);
Vector<Vector4> arr = p_property;
int len = arr.size();
- f->store_32(uint32_t(len));
+ r_file->store_32(uint32_t(len));
const Vector4 *r = arr.ptr();
for (int i = 0; i < len; i++) {
- f->store_real(r[i].x);
- f->store_real(r[i].y);
- f->store_real(r[i].z);
- f->store_real(r[i].w);
+ r_file->store_real(r[i].x);
+ r_file->store_real(r[i].y);
+ r_file->store_real(r[i].z);
+ r_file->store_real(r[i].w);
}
} break;
@@ -2069,14 +2069,14 @@ void ResourceFormatSaverBinaryInstance::_find_resources(const Variant &p_variant
}
}
-void ResourceFormatSaverBinaryInstance::save_unicode_string(Ref<FileAccess> p_f, const String &p_string, bool p_bit_on_len) {
+void ResourceFormatSaverBinaryInstance::save_unicode_string(Ref<FileAccess> r_file, const String &p_string, bool p_bit_on_len) {
CharString utf8 = p_string.utf8();
if (p_bit_on_len) {
- p_f->store_32(uint32_t((utf8.length() + 1) | 0x80000000));
+ r_file->store_32(uint32_t((utf8.length() + 1) | 0x80000000));
} else {
- p_f->store_32(uint32_t(utf8.length() + 1));
+ r_file->store_32(uint32_t(utf8.length() + 1));
}
- p_f->store_buffer((const uint8_t *)utf8.get_data(), utf8.length() + 1);
+ r_file->store_buffer((const uint8_t *)utf8.get_data(), utf8.length() + 1);
}
int ResourceFormatSaverBinaryInstance::get_string_index(const String &p_string) {
diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h
index 35e66e73e69..c2890770894 100644
--- a/core/io/resource_format_binary.h
+++ b/core/io/resource_format_binary.h
@@ -99,11 +99,11 @@ public:
void set_translation_remapped(bool p_remapped);
void set_remaps(const HashMap<String, String> &p_remaps) { remaps = p_remaps; }
- void open(Ref<FileAccess> p_f, bool p_no_resources = false, bool p_keep_uuid_paths = false);
- String recognize(Ref<FileAccess> p_f);
- String recognize_script_class(Ref<FileAccess> p_f);
- void get_dependencies(Ref<FileAccess> p_f, List<String> *p_dependencies, bool p_add_types);
- void get_classes_used(Ref<FileAccess> p_f, HashSet<StringName> *p_classes);
+ void open(Ref<FileAccess> p_file, bool p_no_resources = false, bool p_keep_uuid_paths = false);
+ String recognize(Ref<FileAccess> p_file);
+ String recognize_script_class(Ref<FileAccess> p_file);
+ void get_dependencies(Ref<FileAccess> p_file, List<String> *p_dependencies, bool p_add_types);
+ void get_classes_used(Ref<FileAccess> p_file, HashSet<StringName> *p_classes);
};
class ResourceFormatLoaderBinary : public ResourceFormatLoader {
@@ -159,9 +159,9 @@ class ResourceFormatSaverBinaryInstance {
List<Property> properties;
};
- static void _pad_buffer(Ref<FileAccess> f, int p_bytes);
+ static void _pad_buffer(Ref<FileAccess> r_file, int p_bytes);
void _find_resources(const Variant &p_variant, bool p_main = false);
- static void save_unicode_string(Ref<FileAccess> f, const String &p_string, bool p_bit_on_len = false);
+ static void save_unicode_string(Ref<FileAccess> r_file, const String &p_string, bool p_bit_on_len = false);
int get_string_index(const String &p_string);
public:
@@ -176,7 +176,7 @@ public:
};
Error save(const String &p_path, const Ref<Resource> &p_resource, uint32_t p_flags = 0);
Error set_uid(const String &p_path, ResourceUID::ID p_uid);
- static void write_variant(Ref<FileAccess> f, const Variant &p_property, HashMap<Ref<Resource>, int> &resource_map, HashMap<Ref<Resource>, int> &external_resources, HashMap<StringName, int> &string_map, const PropertyInfo &p_hint = PropertyInfo());
+ static void write_variant(Ref<FileAccess> r_file, const Variant &p_property, HashMap<Ref<Resource>, int> &r_resource_map, HashMap<Ref<Resource>, int> &r_external_resources, HashMap<StringName, int> &r_string_map, const PropertyInfo &p_hint = PropertyInfo());
};
class ResourceFormatSaverBinary : public ResourceFormatSaver {
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index e7cf8b8a3fc..bcb653c4413 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -1644,28 +1644,28 @@ void ResourceLoader::set_load_callback(ResourceLoadedCallback p_callback) {
ResourceLoadedCallback ResourceLoader::_loaded_callback = nullptr;
-Ref<ResourceFormatLoader> ResourceLoader::_find_custom_resource_format_loader(const String &path) {
+Ref<ResourceFormatLoader> ResourceLoader::_find_custom_resource_format_loader(const String &p_path) {
for (int i = 0; i < loader_count; ++i) {
- if (loader[i]->get_script_instance() && loader[i]->get_script_instance()->get_script()->get_path() == path) {
+ if (loader[i]->get_script_instance() && loader[i]->get_script_instance()->get_script()->get_path() == p_path) {
return loader[i];
}
}
return Ref<ResourceFormatLoader>();
}
-bool ResourceLoader::add_custom_resource_format_loader(const String &script_path) {
- if (_find_custom_resource_format_loader(script_path).is_valid()) {
+bool ResourceLoader::add_custom_resource_format_loader(const String &p_script_path) {
+ if (_find_custom_resource_format_loader(p_script_path).is_valid()) {
return false;
}
- Ref<Resource> res = ResourceLoader::load(script_path);
+ Ref<Resource> res = ResourceLoader::load(p_script_path);
ERR_FAIL_COND_V(res.is_null(), false);
ERR_FAIL_COND_V(!res->is_class("Script"), false);
Ref<Script> s = res;
StringName ibt = s->get_instance_base_type();
bool valid_type = ClassDB::is_parent_class(ibt, "ResourceFormatLoader");
- ERR_FAIL_COND_V_MSG(!valid_type, false, vformat("Failed to add a custom resource loader, script '%s' does not inherit 'ResourceFormatLoader'.", script_path));
+ ERR_FAIL_COND_V_MSG(!valid_type, false, vformat("Failed to add a custom resource loader, script '%s' does not inherit 'ResourceFormatLoader'.", p_script_path));
Object *obj = ClassDB::instantiate(ibt);
ERR_FAIL_NULL_V_MSG(obj, false, vformat("Failed to add a custom resource loader, cannot instantiate '%s'.", ibt));
diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h
index d1af3a05f44..b708c5a4bfa 100644
--- a/core/io/resource_loader.h
+++ b/core/io/resource_loader.h
@@ -176,7 +176,7 @@ private:
static ResourceLoadedCallback _loaded_callback;
- static Ref<ResourceFormatLoader> _find_custom_resource_format_loader(const String &path);
+ static Ref<ResourceFormatLoader> _find_custom_resource_format_loader(const String &p_path);
struct ThreadLoadTask {
WorkerThreadPool::TaskID task_id = 0; // Used if run on a worker thread from the pool.
@@ -307,7 +307,7 @@ public:
static void set_load_callback(ResourceLoadedCallback p_callback);
static ResourceLoaderImport import;
- static bool add_custom_resource_format_loader(const String &script_path);
+ static bool add_custom_resource_format_loader(const String &p_script_path);
static void add_custom_loaders();
static void remove_custom_loaders();
diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp
index 3cc7fc2ac87..8af1ba6845a 100644
--- a/core/io/resource_saver.cpp
+++ b/core/io/resource_saver.cpp
@@ -218,28 +218,28 @@ void ResourceSaver::remove_resource_format_saver(Ref<ResourceFormatSaver> p_form
--saver_count;
}
-Ref<ResourceFormatSaver> ResourceSaver::_find_custom_resource_format_saver(const String &path) {
+Ref<ResourceFormatSaver> ResourceSaver::_find_custom_resource_format_saver(const String &p_path) {
for (int i = 0; i < saver_count; ++i) {
- if (saver[i]->get_script_instance() && saver[i]->get_script_instance()->get_script()->get_path() == path) {
+ if (saver[i]->get_script_instance() && saver[i]->get_script_instance()->get_script()->get_path() == p_path) {
return saver[i];
}
}
return Ref<ResourceFormatSaver>();
}
-bool ResourceSaver::add_custom_resource_format_saver(const String &script_path) {
- if (_find_custom_resource_format_saver(script_path).is_valid()) {
+bool ResourceSaver::add_custom_resource_format_saver(const String &p_script_path) {
+ if (_find_custom_resource_format_saver(p_script_path).is_valid()) {
return false;
}
- Ref<Resource> res = ResourceLoader::load(script_path);
+ Ref<Resource> res = ResourceLoader::load(p_script_path);
ERR_FAIL_COND_V(res.is_null(), false);
ERR_FAIL_COND_V(!res->is_class("Script"), false);
Ref<Script> s = res;
StringName ibt = s->get_instance_base_type();
bool valid_type = ClassDB::is_parent_class(ibt, "ResourceFormatSaver");
- ERR_FAIL_COND_V_MSG(!valid_type, false, vformat("Failed to add a custom resource saver, script '%s' does not inherit 'ResourceFormatSaver'.", script_path));
+ ERR_FAIL_COND_V_MSG(!valid_type, false, vformat("Failed to add a custom resource saver, script '%s' does not inherit 'ResourceFormatSaver'.", p_script_path));
Object *obj = ClassDB::instantiate(ibt);
ERR_FAIL_NULL_V_MSG(obj, false, vformat("Failed to add a custom resource saver, cannot instantiate '%s'.", ibt));
diff --git a/core/io/resource_saver.h b/core/io/resource_saver.h
index 9a4a35873ef..61e69d8759d 100644
--- a/core/io/resource_saver.h
+++ b/core/io/resource_saver.h
@@ -69,7 +69,7 @@ class ResourceSaver {
static ResourceSavedCallback save_callback;
static ResourceSaverGetResourceIDForPath save_get_id_for_path;
- static Ref<ResourceFormatSaver> _find_custom_resource_format_saver(const String &path);
+ static Ref<ResourceFormatSaver> _find_custom_resource_format_saver(const String &p_path);
public:
enum SaverFlags {
@@ -98,7 +98,7 @@ public:
static void set_save_callback(ResourceSavedCallback p_callback);
static void set_get_resource_id_for_path(ResourceSaverGetResourceIDForPath p_callback);
- static bool add_custom_resource_format_saver(const String &script_path);
+ static bool add_custom_resource_format_saver(const String &p_script_path);
static void add_custom_savers();
static void remove_custom_savers();
};
diff --git a/core/io/stream_peer_gzip.cpp b/core/io/stream_peer_gzip.cpp
index 52c920dad49..a24faffd0d5 100644
--- a/core/io/stream_peer_gzip.cpp
+++ b/core/io/stream_peer_gzip.cpp
@@ -65,20 +65,20 @@ void StreamPeerGZIP::clear() {
buffer.clear();
}
-Error StreamPeerGZIP::start_compression(bool p_is_deflate, int buffer_size) {
- return _start(true, p_is_deflate, buffer_size);
+Error StreamPeerGZIP::start_compression(bool p_is_deflate, int p_buffer_size) {
+ return _start(true, p_is_deflate, p_buffer_size);
}
-Error StreamPeerGZIP::start_decompression(bool p_is_deflate, int buffer_size) {
- return _start(false, p_is_deflate, buffer_size);
+Error StreamPeerGZIP::start_decompression(bool p_is_deflate, int p_buffer_size) {
+ return _start(false, p_is_deflate, p_buffer_size);
}
-Error StreamPeerGZIP::_start(bool p_compress, bool p_is_deflate, int buffer_size) {
+Error StreamPeerGZIP::_start(bool p_compress, bool p_is_deflate, int p_buffer_size) {
ERR_FAIL_COND_V(ctx != nullptr, ERR_ALREADY_IN_USE);
- ERR_FAIL_COND_V_MSG(buffer_size <= 0, ERR_INVALID_PARAMETER, "Invalid buffer size. It should be a positive integer.");
+ ERR_FAIL_COND_V_MSG(p_buffer_size <= 0, ERR_INVALID_PARAMETER, "Invalid buffer size. It should be a positive integer.");
clear();
compressing = p_compress;
- rb.resize(Math::nearest_shift(uint32_t(buffer_size - 1)));
+ rb.resize(Math::nearest_shift(uint32_t(p_buffer_size - 1)));
buffer.resize(1024);
// Create ctx.
diff --git a/core/io/stream_peer_gzip.h b/core/io/stream_peer_gzip.h
index b9186bc9fef..02ba7cb65ae 100644
--- a/core/io/stream_peer_gzip.h
+++ b/core/io/stream_peer_gzip.h
@@ -45,14 +45,14 @@ private:
Error _process(uint8_t *p_dst, int p_dst_size, const uint8_t *p_src, int p_src_size, int &r_consumed, int &r_out, bool p_close = false);
void _close();
- Error _start(bool p_compress, bool p_is_deflate, int buffer_size = 65535);
+ Error _start(bool p_compress, bool p_is_deflate, int p_buffer_size = 65535);
protected:
static void _bind_methods();
public:
- Error start_compression(bool p_is_deflate, int buffer_size = 65535);
- Error start_decompression(bool p_is_deflate, int buffer_size = 65535);
+ Error start_compression(bool p_is_deflate, int p_buffer_size = 65535);
+ Error start_decompression(bool p_is_deflate, int p_buffer_size = 65535);
Error finish();
void clear();
diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp
index a5d94b7c281..70508400d28 100644
--- a/core/io/translation_loader_po.cpp
+++ b/core/io/translation_loader_po.cpp
@@ -33,27 +33,27 @@
#include "core/io/file_access.h"
#include "core/string/translation.h"
-Ref<Resource> TranslationLoaderPO::load_translation(Ref<FileAccess> f, Error *r_error) {
+Ref<Resource> TranslationLoaderPO::load_translation(Ref<FileAccess> r_file, Error *r_error) {
if (r_error) {
*r_error = ERR_FILE_CORRUPT;
}
- const String path = f->get_path();
+ const String path = r_file->get_path();
Ref<Translation> translation;
translation.instantiate();
String config;
- uint32_t magic = f->get_32();
+ uint32_t magic = r_file->get_32();
if (magic == 0x950412de) {
// Load binary MO file.
- uint16_t version_maj = f->get_16();
- uint16_t version_min = f->get_16();
+ uint16_t version_maj = r_file->get_16();
+ uint16_t version_min = r_file->get_16();
ERR_FAIL_COND_V_MSG(version_maj > 1, Ref<Resource>(), vformat("Unsupported MO file %s, version %d.%d.", path, version_maj, version_min));
- uint32_t num_strings = f->get_32();
- uint32_t id_table_offset = f->get_32();
- uint32_t trans_table_offset = f->get_32();
+ uint32_t num_strings = r_file->get_32();
+ uint32_t id_table_offset = r_file->get_32();
+ uint32_t trans_table_offset = r_file->get_32();
// Read string tables.
for (uint32_t i = 0; i < num_strings; i++) {
@@ -64,14 +64,14 @@ Ref<Resource> TranslationLoaderPO::load_translation(Ref<FileAccess> f, Error *r_
// Read id strings and context.
{
Vector<uint8_t> data;
- f->seek(id_table_offset + i * 8);
+ r_file->seek(id_table_offset + i * 8);
uint32_t str_start = 0;
- uint32_t str_len = f->get_32();
- uint32_t str_offset = f->get_32();
+ uint32_t str_len = r_file->get_32();
+ uint32_t str_offset = r_file->get_32();
data.resize(str_len + 1);
- f->seek(str_offset);
- f->get_buffer(data.ptrw(), str_len);
+ r_file->seek(str_offset);
+ r_file->get_buffer(data.ptrw(), str_len);
data.write[str_len] = 0;
bool is_plural = false;
@@ -98,13 +98,13 @@ Ref<Resource> TranslationLoaderPO::load_translation(Ref<FileAccess> f, Error *r_
// Read translated strings.
{
Vector<uint8_t> data;
- f->seek(trans_table_offset + i * 8);
- uint32_t str_len = f->get_32();
- uint32_t str_offset = f->get_32();
+ r_file->seek(trans_table_offset + i * 8);
+ uint32_t str_len = r_file->get_32();
+ uint32_t str_offset = r_file->get_32();
data.resize(str_len + 1);
- f->seek(str_offset);
- f->get_buffer(data.ptrw(), str_len);
+ r_file->seek(str_offset);
+ r_file->get_buffer(data.ptrw(), str_len);
data.write[str_len] = 0;
if (msg_id.is_empty()) {
@@ -137,7 +137,7 @@ Ref<Resource> TranslationLoaderPO::load_translation(Ref<FileAccess> f, Error *r_
} else {
// Try to load as text PO file.
- f->seek(0);
+ r_file->seek(0);
enum Status {
STATUS_NONE,
@@ -167,8 +167,8 @@ Ref<Resource> TranslationLoaderPO::load_translation(Ref<FileAccess> f, Error *r_
bool is_eof = false;
while (!is_eof) {
- String l = f->get_line().strip_edges();
- is_eof = f->eof_reached();
+ String l = r_file->get_line().strip_edges();
+ is_eof = r_file->eof_reached();
// If we reached last line and it's not a content line, break, otherwise let processing that last loop
if (is_eof && l.is_empty()) {
diff --git a/core/io/translation_loader_po.h b/core/io/translation_loader_po.h
index 87d70736f35..bf1191b8f5b 100644
--- a/core/io/translation_loader_po.h
+++ b/core/io/translation_loader_po.h
@@ -37,7 +37,7 @@ class TranslationLoaderPO : public ResourceFormatLoader {
GDSOFTCLASS(TranslationLoaderPO, ResourceFormatLoader);
public:
- static Ref<Resource> load_translation(Ref<FileAccess> f, Error *r_error = nullptr);
+ static Ref<Resource> load_translation(Ref<FileAccess> r_file, Error *r_error = nullptr);
virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
virtual void get_recognized_extensions(List<String> *p_extensions) const override;
virtual bool handles_type(const String &p_type) const override;
diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp
index 40f0e48ef86..93a1b86e20f 100644
--- a/core/io/xml_parser.cpp
+++ b/core/io/xml_parser.cpp
@@ -35,29 +35,29 @@
//#define DEBUG_XML
-static inline bool _is_white_space(char c) {
- return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
+static inline bool _is_white_space(char p_char) {
+ return (p_char == ' ' || p_char == '\t' || p_char == '\n' || p_char == '\r');
}
//! sets the state that text was found. Returns true if set should be set
-bool XMLParser::_set_text(const char *start, const char *end) {
+bool XMLParser::_set_text(const char *p_start, const char *p_end) {
// check if text is more than 2 characters, and if not, check if there is
// only white space, so that this text won't be reported
- if (end - start < 3) {
- const char *p = start;
- for (; p != end; ++p) {
+ if (p_end - p_start < 3) {
+ const char *p = p_start;
+ for (; p != p_end; ++p) {
if (!_is_white_space(*p)) {
break;
}
}
- if (p == end) {
+ if (p == p_end) {
return false;
}
}
// set current text to the parsed text, and replace xml special characters
- String s = String::utf8(start, (int)(end - start));
+ String s = String::utf8(p_start, (int)(p_end - p_start));
node_name = s.xml_unescape();
// current XML node type is text
diff --git a/core/io/xml_parser.h b/core/io/xml_parser.h
index 01d763cda71..42ef06d2a5a 100644
--- a/core/io/xml_parser.h
+++ b/core/io/xml_parser.h
@@ -81,7 +81,7 @@ private:
Vector<Attribute> attributes;
- bool _set_text(const char *start, const char *end);
+ bool _set_text(const char *p_start, const char *p_end);
void _parse_closing_xml_element();
void _ignore_definition();
bool _parse_cdata();
diff --git a/core/io/zip_io.cpp b/core/io/zip_io.cpp
index 4ecda88e35f..82f2431e562 100644
--- a/core/io/zip_io.cpp
+++ b/core/io/zip_io.cpp
@@ -72,20 +72,20 @@ int godot_unzip_locate_file(unzFile p_zip_file, const String &p_filepath, bool p
//
-void *zipio_open(voidpf opaque, const char *p_fname, int mode) {
- Ref<FileAccess> *fa = reinterpret_cast<Ref<FileAccess> *>(opaque);
+void *zipio_open(voidpf p_opaque, const char *p_fname, int p_mode) {
+ Ref<FileAccess> *fa = reinterpret_cast<Ref<FileAccess> *>(p_opaque);
ERR_FAIL_NULL_V(fa, nullptr);
String fname = String::utf8(p_fname);
int file_access_mode = 0;
- if (mode & ZLIB_FILEFUNC_MODE_READ) {
+ if (p_mode & ZLIB_FILEFUNC_MODE_READ) {
file_access_mode |= FileAccess::READ;
}
- if (mode & ZLIB_FILEFUNC_MODE_WRITE) {
+ if (p_mode & ZLIB_FILEFUNC_MODE_WRITE) {
file_access_mode |= FileAccess::WRITE;
}
- if (mode & ZLIB_FILEFUNC_MODE_CREATE) {
+ if (p_mode & ZLIB_FILEFUNC_MODE_CREATE) {
file_access_mode |= FileAccess::WRITE_READ;
}
@@ -94,51 +94,51 @@ void *zipio_open(voidpf opaque, const char *p_fname, int mode) {
return nullptr;
}
- return opaque;
+ return p_opaque;
}
-uLong zipio_read(voidpf opaque, voidpf stream, void *buf, uLong size) {
- Ref<FileAccess> *fa = reinterpret_cast<Ref<FileAccess> *>(opaque);
+uLong zipio_read(voidpf p_opaque, voidpf p_stream, void *p_buf, uLong p_size) {
+ Ref<FileAccess> *fa = reinterpret_cast<Ref<FileAccess> *>(p_opaque);
ERR_FAIL_NULL_V(fa, 0);
ERR_FAIL_COND_V(fa->is_null(), 0);
- return (*fa)->get_buffer((uint8_t *)buf, size);
+ return (*fa)->get_buffer((uint8_t *)p_buf, p_size);
}
-uLong zipio_write(voidpf opaque, voidpf stream, const void *buf, uLong size) {
- Ref<FileAccess> *fa = reinterpret_cast<Ref<FileAccess> *>(opaque);
+uLong zipio_write(voidpf p_opaque, voidpf p_stream, const void *p_buf, uLong p_size) {
+ Ref<FileAccess> *fa = reinterpret_cast<Ref<FileAccess> *>(p_opaque);
ERR_FAIL_NULL_V(fa, 0);
ERR_FAIL_COND_V(fa->is_null(), 0);
- bool fa_success = (*fa)->store_buffer((uint8_t *)buf, size);
+ bool fa_success = (*fa)->store_buffer((uint8_t *)p_buf, p_size);
if (fa_success) {
- return size;
+ return p_size;
}
return 0;
}
-long zipio_tell(voidpf opaque, voidpf stream) {
- Ref<FileAccess> *fa = reinterpret_cast<Ref<FileAccess> *>(opaque);
+long zipio_tell(voidpf p_opaque, voidpf p_stream) {
+ Ref<FileAccess> *fa = reinterpret_cast<Ref<FileAccess> *>(p_opaque);
ERR_FAIL_NULL_V(fa, 0);
ERR_FAIL_COND_V(fa->is_null(), 0);
return (*fa)->get_position();
}
-long zipio_seek(voidpf opaque, voidpf stream, uLong offset, int origin) {
- Ref<FileAccess> *fa = reinterpret_cast<Ref<FileAccess> *>(opaque);
+long zipio_seek(voidpf p_opaque, voidpf p_stream, uLong p_offset, int p_origin) {
+ Ref<FileAccess> *fa = reinterpret_cast<Ref<FileAccess> *>(p_opaque);
ERR_FAIL_NULL_V(fa, 0);
ERR_FAIL_COND_V(fa->is_null(), 0);
- uint64_t pos = offset;
- switch (origin) {
+ uint64_t pos = p_offset;
+ switch (p_origin) {
case ZLIB_FILEFUNC_SEEK_CUR:
- pos = (*fa)->get_position() + offset;
+ pos = (*fa)->get_position() + p_offset;
break;
case ZLIB_FILEFUNC_SEEK_END:
- pos = (*fa)->get_length() + offset;
+ pos = (*fa)->get_length() + p_offset;
break;
default:
break;
@@ -148,8 +148,8 @@ long zipio_seek(voidpf opaque, voidpf stream, uLong offset, int origin) {
return 0;
}
-int zipio_close(voidpf opaque, voidpf stream) {
- Ref<FileAccess> *fa = reinterpret_cast<Ref<FileAccess> *>(opaque);
+int zipio_close(voidpf p_opaque, voidpf p_stream) {
+ Ref<FileAccess> *fa = reinterpret_cast<Ref<FileAccess> *>(p_opaque);
ERR_FAIL_NULL_V(fa, 0);
ERR_FAIL_COND_V(fa->is_null(), 0);
@@ -157,21 +157,21 @@ int zipio_close(voidpf opaque, voidpf stream) {
return 0;
}
-int zipio_testerror(voidpf opaque, voidpf stream) {
- Ref<FileAccess> *fa = reinterpret_cast<Ref<FileAccess> *>(opaque);
+int zipio_testerror(voidpf p_opaque, voidpf p_stream) {
+ Ref<FileAccess> *fa = reinterpret_cast<Ref<FileAccess> *>(p_opaque);
ERR_FAIL_NULL_V(fa, 1);
ERR_FAIL_COND_V(fa->is_null(), 0);
return (fa->is_valid() && (*fa)->get_error() != OK) ? 1 : 0;
}
-voidpf zipio_alloc(voidpf opaque, uInt items, uInt size) {
- voidpf ptr = memalloc_zeroed((size_t)items * size);
+voidpf zipio_alloc(voidpf p_opaque, uInt p_items, uInt p_size) {
+ voidpf ptr = memalloc_zeroed((size_t)p_items * p_size);
return ptr;
}
-void zipio_free(voidpf opaque, voidpf address) {
- memfree(address);
+void zipio_free(voidpf p_opaque, voidpf r_address) {
+ memfree(r_address);
}
zlib_filefunc_def zipio_create_io(Ref<FileAccess> *p_data) {
diff --git a/core/io/zip_io.h b/core/io/zip_io.h
index f925a1f5e9c..907a1ba05a0 100644
--- a/core/io/zip_io.h
+++ b/core/io/zip_io.h
@@ -43,18 +43,18 @@ int godot_unzip_locate_file(unzFile p_zip_file, const String &p_filepath, bool p
//
-void *zipio_open(voidpf opaque, const char *p_fname, int mode);
-uLong zipio_read(voidpf opaque, voidpf stream, void *buf, uLong size);
-uLong zipio_write(voidpf opaque, voidpf stream, const void *buf, uLong size);
+void *zipio_open(voidpf p_opaque, const char *p_fname, int p_mode);
+uLong zipio_read(voidpf p_opaque, voidpf p_stream, void *p_buf, uLong p_size);
+uLong zipio_write(voidpf p_opaque, voidpf p_stream, const void *p_buf, uLong p_size);
-long zipio_tell(voidpf opaque, voidpf stream);
-long zipio_seek(voidpf opaque, voidpf stream, uLong offset, int origin);
+long zipio_tell(voidpf p_opaque, voidpf p_stream);
+long zipio_seek(voidpf p_opaque, voidpf p_stream, uLong p_offset, int p_origin);
-int zipio_close(voidpf opaque, voidpf stream);
+int zipio_close(voidpf p_opaque, voidpf p_stream);
-int zipio_testerror(voidpf opaque, voidpf stream);
+int zipio_testerror(voidpf p_opaque, voidpf p_stream);
-voidpf zipio_alloc(voidpf opaque, uInt items, uInt size);
-void zipio_free(voidpf opaque, voidpf address);
+voidpf zipio_alloc(voidpf p_opaque, uInt p_items, uInt p_size);
+void zipio_free(voidpf p_opaque, voidpf p_address);
zlib_filefunc_def zipio_create_io(Ref<FileAccess> *p_data);
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index bbd5be86942..7e3731268a0 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -124,7 +124,7 @@ void AStar3D::remove_point(int64_t p_id) {
last_free_id = p_id;
}
-void AStar3D::connect_points(int64_t p_id, int64_t p_with_id, bool bidirectional) {
+void AStar3D::connect_points(int64_t p_id, int64_t p_with_id, bool p_bidirectional) {
ERR_FAIL_COND_MSG(p_id == p_with_id, vformat("Can't connect point with id: %d to itself.", p_id));
Point **a_entry = points.getptr(p_id);
@@ -137,14 +137,14 @@ void AStar3D::connect_points(int64_t p_id, int64_t p_with_id, bool bidirectional
a->neighbors.insert(b->id, b);
- if (bidirectional) {
+ if (p_bidirectional) {
b->neighbors.insert(a->id, a);
} else {
b->unlinked_neighbours.insert(a->id, a);
}
Segment s(p_id, p_with_id);
- if (bidirectional) {
+ if (p_bidirectional) {
s.direction = Segment::BIDIRECTIONAL;
}
@@ -162,7 +162,7 @@ void AStar3D::connect_points(int64_t p_id, int64_t p_with_id, bool bidirectional
segments.insert(s);
}
-void AStar3D::disconnect_points(int64_t p_id, int64_t p_with_id, bool bidirectional) {
+void AStar3D::disconnect_points(int64_t p_id, int64_t p_with_id, bool p_bidirectional) {
Point **a_entry = points.getptr(p_id);
ERR_FAIL_COND_MSG(!a_entry, vformat("Can't disconnect points. Point with id: %d doesn't exist.", p_id));
Point *a = *a_entry;
@@ -172,7 +172,7 @@ void AStar3D::disconnect_points(int64_t p_id, int64_t p_with_id, bool bidirectio
Point *b = *b_entry;
Segment s(p_id, p_with_id);
- int remove_direction = bidirectional ? (int)Segment::BIDIRECTIONAL : (int)s.direction;
+ int remove_direction = p_bidirectional ? (int)Segment::BIDIRECTIONAL : (int)s.direction;
HashSet<Segment, Segment>::Iterator element = segments.find(s);
if (element) {
@@ -181,7 +181,7 @@ void AStar3D::disconnect_points(int64_t p_id, int64_t p_with_id, bool bidirectio
s.direction = (element->direction & ~remove_direction);
a->neighbors.erase(b->id);
- if (bidirectional) {
+ if (p_bidirectional) {
b->neighbors.erase(a->id);
if (element->direction != Segment::BIDIRECTIONAL) {
a->unlinked_neighbours.erase(b->id);
@@ -229,12 +229,12 @@ Vector<int64_t> AStar3D::get_point_connections(int64_t p_id) {
return point_list;
}
-bool AStar3D::are_points_connected(int64_t p_id, int64_t p_with_id, bool bidirectional) const {
+bool AStar3D::are_points_connected(int64_t p_id, int64_t p_with_id, bool p_bidirectional) const {
Segment s(p_id, p_with_id);
const HashSet<Segment, Segment>::Iterator element = segments.find(s);
return element &&
- (bidirectional || (element->direction & s.direction) == s.direction);
+ (p_bidirectional || (element->direction & s.direction) == s.direction);
}
void AStar3D::clear() {
diff --git a/core/math/a_star.h b/core/math/a_star.h
index 8e643f4555a..c3f2468610e 100644
--- a/core/math/a_star.h
+++ b/core/math/a_star.h
@@ -64,13 +64,13 @@ class AStar3D : public RefCounted {
};
struct SortPoints {
- _FORCE_INLINE_ bool operator()(const Point *A, const Point *B) const { // Returns true when the Point A is worse than Point B.
- if (A->f_score > B->f_score) {
+ _FORCE_INLINE_ bool operator()(const Point *p_left, const Point *p_right) const { // Returns true when the Point A is worse than Point B.
+ if (p_left->f_score > p_right->f_score) {
return true;
- } else if (A->f_score < B->f_score) {
+ } else if (p_left->f_score < p_right->f_score) {
return false;
} else {
- return A->g_score < B->g_score; // If the f_costs are the same then prioritize the points that are further away from the start.
+ return p_left->g_score < p_right->g_score; // If the f_costs are the same then prioritize the points that are further away from the start.
}
}
};
@@ -150,9 +150,9 @@ public:
void set_point_disabled(int64_t p_id, bool p_disabled = true);
bool is_point_disabled(int64_t p_id) const;
- void connect_points(int64_t p_id, int64_t p_with_id, bool bidirectional = true);
- void disconnect_points(int64_t p_id, int64_t p_with_id, bool bidirectional = true);
- bool are_points_connected(int64_t p_id, int64_t p_with_id, bool bidirectional = true) const;
+ void connect_points(int64_t p_id, int64_t p_with_id, bool p_bidirectional = true);
+ void disconnect_points(int64_t p_id, int64_t p_with_id, bool p_bidirectional = true);
+ bool are_points_connected(int64_t p_id, int64_t p_with_id, bool p_bidirectional = true) const;
int64_t get_point_count() const;
int64_t get_point_capacity() const;
diff --git a/core/math/a_star_grid_2d.h b/core/math/a_star_grid_2d.h
index 14f8ccc8b9c..3b96ebe5e74 100644
--- a/core/math/a_star_grid_2d.h
+++ b/core/math/a_star_grid_2d.h
@@ -97,13 +97,13 @@ private:
};
struct SortPoints {
- _FORCE_INLINE_ bool operator()(const Point *A, const Point *B) const { // Returns true when the Point A is worse than Point B.
- if (A->f_score > B->f_score) {
+ _FORCE_INLINE_ bool operator()(const Point *p_left, const Point *p_right) const { // Returns true when the Point A is worse than Point B.
+ if (p_left->f_score > p_right->f_score) {
return true;
- } else if (A->f_score < B->f_score) {
+ } else if (p_left->f_score < p_right->f_score) {
return false;
} else {
- return A->g_score < B->g_score; // If the f_costs are the same then prioritize the points that are further away from the start.
+ return p_left->g_score < p_right->g_score; // If the f_costs are the same then prioritize the points that are further away from the start.
}
}
};
diff --git a/core/math/audio_frame.h b/core/math/audio_frame.h
index 6b86085f068..4626887364f 100644
--- a/core/math/audio_frame.h
+++ b/core/math/audio_frame.h
@@ -33,17 +33,17 @@
#include "core/math/vector2.h"
#include "core/typedefs.h"
-static _FORCE_INLINE_ float undenormalize(float f) {
+static _FORCE_INLINE_ float undenormalize(float p_value) {
union {
uint32_t i;
float f;
} v;
- v.f = f;
+ v.f = p_value;
// original: return (v.i & 0x7f800000) == 0 ? 0.0f : f;
// version from Tim Blechmann:
- return (v.i & 0x7f800000) < 0x08000000 ? 0.0f : f;
+ return (v.i & 0x7f800000) < 0x08000000 ? 0.0f : p_value;
}
static const float AUDIO_PEAK_OFFSET = 0.0000000001f;
diff --git a/core/math/basis.cpp b/core/math/basis.cpp
index fe2984b27ac..4c6834a1128 100644
--- a/core/math/basis.cpp
+++ b/core/math/basis.cpp
@@ -326,7 +326,7 @@ Vector3 Basis::get_scale() const {
// Decomposes a Basis into a rotation-reflection matrix (an element of the group O(3)) and a positive scaling matrix as B = O.S.
// Returns the rotation-reflection matrix via reference argument, and scaling information is returned as a Vector3.
// This (internal) function is too specific and named too ugly to expose to users, and probably there's no need to do so.
-Vector3 Basis::rotref_posscale_decomposition(Basis &rotref) const {
+Vector3 Basis::rotref_posscale_decomposition(Basis &r_rotref) const {
#ifdef MATH_CHECKS
ERR_FAIL_COND_V(determinant() == 0, Vector3());
@@ -335,10 +335,10 @@ Vector3 Basis::rotref_posscale_decomposition(Basis &rotref) const {
#endif
Vector3 scale = get_scale();
Basis inv_scale = Basis().scaled(scale.inverse()); // this will also absorb the sign of scale
- rotref = (*this) * inv_scale;
+ r_rotref = (*this) * inv_scale;
#ifdef MATH_CHECKS
- ERR_FAIL_COND_V(!rotref.is_orthogonal(), Vector3());
+ ERR_FAIL_COND_V(!r_rotref.is_orthogonal(), Vector3());
#endif
return scale.abs();
}
diff --git a/core/math/basis.h b/core/math/basis.h
index 4271b94e509..1c555aba7d2 100644
--- a/core/math/basis.h
+++ b/core/math/basis.h
@@ -78,7 +78,7 @@ struct [[nodiscard]] Basis {
void rotate_to_align(Vector3 p_start_direction, Vector3 p_end_direction);
- Vector3 rotref_posscale_decomposition(Basis &rotref) const;
+ Vector3 rotref_posscale_decomposition(Basis &r_rotref) const;
Vector3 get_euler(EulerOrder p_order = EulerOrder::YXZ) const;
void set_euler(const Vector3 &p_euler, EulerOrder p_order = EulerOrder::YXZ);
diff --git a/core/math/bvh.h b/core/math/bvh.h
index 3208c552736..8b24ba1a6e5 100644
--- a/core/math/bvh.h
+++ b/core/math/bvh.h
@@ -574,10 +574,10 @@ private:
// find all the existing paired aabbs that are no longer
// paired, and send callbacks
- void _find_leavers(BVHHandle p_handle, const BVHABB_CLASS &expanded_abb_from, bool p_full_check) {
+ void _find_leavers(BVHHandle p_handle, const BVHABB_CLASS &p_expanded_abb_from, bool p_full_check) {
typename BVHTREE_CLASS::ItemPairs &p_from = tree._pairs[p_handle.id()];
- BVHABB_CLASS abb_from = expanded_abb_from;
+ BVHABB_CLASS abb_from = p_expanded_abb_from;
// remove from pairing list for every partner
for (unsigned int n = 0; n < p_from.extended_pairs.size(); n++) {
@@ -692,7 +692,7 @@ private:
_tick++;
}
- void _add_changed_item(BVHHandle p_handle, const BOUNDS &aabb, bool p_check_aabb = true) {
+ void _add_changed_item(BVHHandle p_handle, const BOUNDS &p_aabb, bool p_check_aabb = true) {
// Note that non pairable items can pair with pairable,
// so all types must be added to the list
@@ -709,13 +709,13 @@ private:
// passing p_check_aabb false disables the optimization which prevents collision checks if
// the aabb hasn't changed. This is needed where set_pairable has been called, but the position
// has not changed.
- if (p_check_aabb && tree.expanded_aabb_encloses_not_shrink(expanded_aabb, aabb)) {
+ if (p_check_aabb && tree.expanded_aabb_encloses_not_shrink(expanded_aabb, p_aabb)) {
return;
}
// ALWAYS update the new expanded aabb, even if already changed once
// this tick, because it is vital that the AABB is kept up to date
- expanded_aabb = aabb;
+ expanded_aabb = p_aabb;
expanded_aabb.grow_by(tree._pairing_expansion);
#endif
diff --git a/core/math/bvh_abb.h b/core/math/bvh_abb.h
index cfb5ebd43ef..e936a433f77 100644
--- a/core/math/bvh_abb.h
+++ b/core/math/bvh_abb.h
@@ -60,12 +60,12 @@ struct BVH_ABB {
POINT min;
POINT neg_max;
- bool operator==(const BVH_ABB &o) const { return (min == o.min) && (neg_max == o.neg_max); }
- bool operator!=(const BVH_ABB &o) const { return (*this == o) == false; }
+ bool operator==(const BVH_ABB &p_other) const { return (min == p_other.min) && (neg_max == p_other.neg_max); }
+ bool operator!=(const BVH_ABB &p_other) const { return (*this == p_other) == false; }
- void set(const POINT &_min, const POINT &_max) {
- min = _min;
- neg_max = -_max;
+ void set(const POINT &p_min, const POINT &p_max) {
+ min = p_min;
+ neg_max = -p_max;
}
// to and from standard AABB
diff --git a/core/math/bvh_cull.inc b/core/math/bvh_cull.inc
index 11f50e41e6f..be284bfd353 100644
--- a/core/math/bvh_cull.inc
+++ b/core/math/bvh_cull.inc
@@ -28,31 +28,31 @@ struct CullParams {
};
private:
-void _cull_translate_hits(CullParams &p) {
+void _cull_translate_hits(CullParams &r_params) {
int num_hits = _cull_hits.size();
- int left = p.result_max - p.result_count_overall;
+ int left = r_params.result_max - r_params.result_count_overall;
if (num_hits > left) {
num_hits = left;
}
- int out_n = p.result_count_overall;
+ int out_n = r_params.result_count_overall;
for (int n = 0; n < num_hits; n++) {
uint32_t ref_id = _cull_hits[n];
const ItemExtra &ex = _extra[ref_id];
- p.result_array[out_n] = ex.userdata;
+ r_params.result_array[out_n] = ex.userdata;
- if (p.subindex_array) {
- p.subindex_array[out_n] = ex.subindex;
+ if (r_params.subindex_array) {
+ r_params.subindex_array[out_n] = ex.subindex;
}
out_n++;
}
- p.result_count = num_hits;
- p.result_count_overall += num_hits;
+ r_params.result_count = num_hits;
+ r_params.result_count_overall += num_hits;
}
public:
@@ -177,15 +177,15 @@ int cull_aabb(CullParams &r_params, bool p_translate_hits = true) {
return r_params.result_count;
}
-bool _cull_hits_full(const CullParams &p) {
+bool _cull_hits_full(const CullParams &p_params) {
// instead of checking every hit, we can do a lazy check for this condition.
// it isn't a problem if we write too much _cull_hits because they only the
// result_max amount will be translated and outputted. But we might as
// well stop our cull checks after the maximum has been reached.
- return (int)_cull_hits.size() >= p.result_max;
+ return (int)_cull_hits.size() >= p_params.result_max;
}
-void _cull_hit(uint32_t p_ref_id, CullParams &p) {
+void _cull_hit(uint32_t p_ref_id, CullParams &r_params) {
// take into account masks etc
// this would be more efficient to do before plane checks,
// but done here for ease to get started
@@ -193,7 +193,7 @@ void _cull_hit(uint32_t p_ref_id, CullParams &p) {
const ItemExtra &ex = _extra[p_ref_id];
// user supplied function (for e.g. pairable types and pairable masks in the render tree)
- if (!USER_CULL_TEST_FUNCTION::user_cull_check(p.tester, ex.userdata)) {
+ if (!USER_CULL_TEST_FUNCTION::user_cull_check(r_params.tester, ex.userdata)) {
return;
}
}
diff --git a/core/math/bvh_debug.inc b/core/math/bvh_debug.inc
index a1fdf78c98d..0394d8f535d 100644
--- a/core/math/bvh_debug.inc
+++ b/core/math/bvh_debug.inc
@@ -6,17 +6,17 @@ void _debug_recursive_print_tree(int p_tree_id) const {
}
}
-String _debug_aabb_to_string(const BVHABB_CLASS &aabb) const {
- POINT size = aabb.calculate_size();
+String _debug_aabb_to_string(const BVHABB_CLASS &p_aabb) const {
+ POINT size = p_aabb.calculate_size();
String sz;
real_t vol = 0.0;
for (int i = 0; i < POINT::AXIS_COUNT; ++i) {
sz += "(";
- sz += itos(aabb.min[i]);
+ sz += itos(p_aabb.min[i]);
sz += " ~ ";
- sz += itos(-aabb.neg_max[i]);
+ sz += itos(-p_aabb.neg_max[i]);
sz += ") ";
vol += size[i];
diff --git a/core/math/bvh_logic.inc b/core/math/bvh_logic.inc
index aaa91bc9d30..ed3edc7d476 100644
--- a/core/math/bvh_logic.inc
+++ b/core/math/bvh_logic.inc
@@ -33,10 +33,10 @@ void _logic_item_remove_and_reinsert(uint32_t p_ref_id) {
}
// from randy gaul balance function
-BVHABB_CLASS _logic_abb_merge(const BVHABB_CLASS &a, const BVHABB_CLASS &b) {
- BVHABB_CLASS c = a;
- c.merge(b);
- return c;
+BVHABB_CLASS _logic_abb_merge(const BVHABB_CLASS &p_left, const BVHABB_CLASS &p_right) {
+ BVHABB_CLASS tmp = p_left;
+ tmp.merge(p_right);
+ return tmp;
}
//--------------------------------------------------------------------------------------------------
@@ -65,7 +65,7 @@ BVHABB_CLASS _logic_abb_merge(const BVHABB_CLASS &a, const BVHABB_CLASS &b) {
// https://github.com/RandyGaul/qu3e
// It is MODIFIED from qu3e version.
// This is the only function used (and _logic_abb_merge helper function).
-int32_t _logic_balance(int32_t iA, uint32_t p_tree_id) {
+int32_t _logic_balance(int32_t iA, uint32_t p_tree_id) { // NOLINT(readability-identifier-naming)
//return iA; // uncomment this to bypass balance
TNode *A = &_nodes[iA];
diff --git a/core/math/bvh_misc.inc b/core/math/bvh_misc.inc
index ef1261a7597..c34c170bd4a 100644
--- a/core/math/bvh_misc.inc
+++ b/core/math/bvh_misc.inc
@@ -31,20 +31,20 @@ void create_root_node(int p_tree) {
}
}
-bool node_is_leaf_full(TNode &tnode) const {
- const TLeaf &leaf = _node_get_leaf(tnode);
+bool node_is_leaf_full(TNode &r_tnode) const {
+ const TLeaf &leaf = _node_get_leaf(r_tnode);
return leaf.is_full();
}
public:
-TLeaf &_node_get_leaf(TNode &tnode) {
- BVH_ASSERT(tnode.is_leaf());
- return _leaves[tnode.get_leaf_id()];
+TLeaf &_node_get_leaf(TNode &r_tnode) {
+ BVH_ASSERT(r_tnode.is_leaf());
+ return _leaves[r_tnode.get_leaf_id()];
}
-const TLeaf &_node_get_leaf(const TNode &tnode) const {
- BVH_ASSERT(tnode.is_leaf());
- return _leaves[tnode.get_leaf_id()];
+const TLeaf &_node_get_leaf(const TNode &p_tnode) const {
+ BVH_ASSERT(p_tnode.is_leaf());
+ return _leaves[p_tnode.get_leaf_id()];
}
private:
diff --git a/core/math/bvh_pair.inc b/core/math/bvh_pair.inc
index 0e48b23a318..6876daf2dcb 100644
--- a/core/math/bvh_pair.inc
+++ b/core/math/bvh_pair.inc
@@ -3,9 +3,9 @@ public:
// depends which works best for cache.
struct ItemPairs {
struct Link {
- void set(BVHHandle h, void *ud) {
- handle = h;
- userdata = ud;
+ void set(BVHHandle p_handle, void *p_userdata) {
+ handle = p_handle;
+ userdata = p_userdata;
}
BVHHandle handle;
void *userdata;
@@ -23,33 +23,33 @@ struct ItemPairs {
int32_t num_pairs;
LocalVector<Link> extended_pairs;
- void add_pair_to(BVHHandle h, void *p_userdata) {
+ void add_pair_to(BVHHandle p_handle, void *p_userdata) {
Link temp;
- temp.set(h, p_userdata);
+ temp.set(p_handle, p_userdata);
extended_pairs.push_back(temp);
num_pairs++;
}
- uint32_t find_pair_to(BVHHandle h) const {
+ uint32_t find_pair_to(BVHHandle p_handle) const {
for (int n = 0; n < num_pairs; n++) {
- if (extended_pairs[n].handle == h) {
+ if (extended_pairs[n].handle == p_handle) {
return n;
}
}
return uint32_t(-1);
}
- bool contains_pair_to(BVHHandle h) const {
- return find_pair_to(h) != BVHCommon::INVALID;
+ bool contains_pair_to(BVHHandle p_handle) const {
+ return find_pair_to(p_handle) != BVHCommon::INVALID;
}
// return success
- void *remove_pair_to(BVHHandle h) {
+ void *remove_pair_to(BVHHandle p_handle) {
void *userdata = nullptr;
for (int n = 0; n < num_pairs; n++) {
- if (extended_pairs[n].handle == h) {
+ if (extended_pairs[n].handle == p_handle) {
userdata = extended_pairs[n].userdata;
extended_pairs.remove_at_unordered(n);
num_pairs--;
diff --git a/core/math/bvh_split.inc b/core/math/bvh_split.inc
index 6da89bd027f..4a177675abe 100644
--- a/core/math/bvh_split.inc
+++ b/core/math/bvh_split.inc
@@ -11,22 +11,22 @@ void _split_inform_references(uint32_t p_node_id) {
}
}
-void _split_leaf_sort_groups_simple(int &num_a, int &num_b, uint16_t *group_a, uint16_t *group_b, const BVHABB_CLASS *temp_bounds, const BVHABB_CLASS full_bound) {
+void _split_leaf_sort_groups_simple(int &p_num_a, int &p_num_b, uint16_t *r_group_a, uint16_t *r_group_b, const BVHABB_CLASS *r_temp_bounds, const BVHABB_CLASS p_full_bound) {
// special case for low leaf sizes .. should static compile out
if constexpr (MAX_ITEMS < 4) {
- uint32_t ind = group_a[0];
+ uint32_t ind = r_group_a[0];
// add to b
- group_b[num_b++] = ind;
+ r_group_b[p_num_b++] = ind;
// remove from a
- num_a--;
- group_a[0] = group_a[num_a];
+ p_num_a--;
+ r_group_a[0] = r_group_a[p_num_a];
return;
}
- POINT center = full_bound.calculate_center();
- POINT size = full_bound.calculate_size();
+ POINT center = p_full_bound.calculate_center();
+ POINT size = p_full_bound.calculate_size();
int order[POINT::AXIS_COUNT];
@@ -40,16 +40,16 @@ void _split_leaf_sort_groups_simple(int &num_a, int &num_b, uint16_t *group_a, u
// Simplest case, split on the longest axis.
int split_axis = order[0];
- for (int a = 0; a < num_a; a++) {
- uint32_t ind = group_a[a];
+ for (int a = 0; a < p_num_a; a++) {
+ uint32_t ind = r_group_a[a];
- if (temp_bounds[ind].min.coord[split_axis] > center.coord[split_axis]) {
+ if (r_temp_bounds[ind].min.coord[split_axis] > center.coord[split_axis]) {
// add to b
- group_b[num_b++] = ind;
+ r_group_b[p_num_b++] = ind;
// remove from a
- num_a--;
- group_a[a] = group_a[num_a];
+ p_num_a--;
+ r_group_a[a] = r_group_a[p_num_a];
// do this one again, as it has been replaced
a--;
@@ -59,28 +59,28 @@ void _split_leaf_sort_groups_simple(int &num_a, int &num_b, uint16_t *group_a, u
// detect when split on longest axis failed
int min_threshold = MAX_ITEMS / 4;
int min_group_size[POINT::AXIS_COUNT];
- min_group_size[0] = MIN(num_a, num_b);
+ min_group_size[0] = MIN(p_num_a, p_num_b);
if (min_group_size[0] < min_threshold) {
// slow but sure .. first move everything back into a
- for (int b = 0; b < num_b; b++) {
- group_a[num_a++] = group_b[b];
+ for (int b = 0; b < p_num_b; b++) {
+ r_group_a[p_num_a++] = r_group_b[b];
}
- num_b = 0;
+ p_num_b = 0;
// Now calculate the best split.
for (int axis = 1; axis < POINT::AXIS_COUNT; axis++) {
split_axis = order[axis];
int count = 0;
- for (int a = 0; a < num_a; a++) {
- uint32_t ind = group_a[a];
+ for (int a = 0; a < p_num_a; a++) {
+ uint32_t ind = r_group_a[a];
- if (temp_bounds[ind].min.coord[split_axis] > center.coord[split_axis]) {
+ if (r_temp_bounds[ind].min.coord[split_axis] > center.coord[split_axis]) {
count++;
}
}
- min_group_size[axis] = MIN(count, num_a - count);
+ min_group_size[axis] = MIN(count, p_num_a - count);
} // for axis
// best axis
@@ -97,16 +97,16 @@ void _split_leaf_sort_groups_simple(int &num_a, int &num_b, uint16_t *group_a, u
if (best_min > 0) {
split_axis = order[best_axis];
- for (int a = 0; a < num_a; a++) {
- uint32_t ind = group_a[a];
+ for (int a = 0; a < p_num_a; a++) {
+ uint32_t ind = r_group_a[a];
- if (temp_bounds[ind].min.coord[split_axis] > center.coord[split_axis]) {
+ if (r_temp_bounds[ind].min.coord[split_axis] > center.coord[split_axis]) {
// add to b
- group_b[num_b++] = ind;
+ r_group_b[p_num_b++] = ind;
// remove from a
- num_a--;
- group_a[a] = group_a[num_a];
+ p_num_a--;
+ r_group_a[a] = r_group_a[p_num_a];
// do this one again, as it has been replaced
a--;
@@ -116,35 +116,35 @@ void _split_leaf_sort_groups_simple(int &num_a, int &num_b, uint16_t *group_a, u
} // if the longest axis wasn't a good split
// special case, none crossed threshold
- if (!num_b) {
- uint32_t ind = group_a[0];
+ if (!p_num_b) {
+ uint32_t ind = r_group_a[0];
// add to b
- group_b[num_b++] = ind;
+ r_group_b[p_num_b++] = ind;
// remove from a
- num_a--;
- group_a[0] = group_a[num_a];
+ p_num_a--;
+ r_group_a[0] = r_group_a[p_num_a];
}
// opposite problem! :)
- if (!num_a) {
- uint32_t ind = group_b[0];
+ if (!p_num_a) {
+ uint32_t ind = r_group_b[0];
// add to a
- group_a[num_a++] = ind;
+ r_group_a[p_num_a++] = ind;
// remove from b
- num_b--;
- group_b[0] = group_b[num_b];
+ p_num_b--;
+ r_group_b[0] = r_group_b[p_num_b];
}
}
-void _split_leaf_sort_groups(int &num_a, int &num_b, uint16_t *group_a, uint16_t *group_b, const BVHABB_CLASS *temp_bounds) {
+void _split_leaf_sort_groups(int &p_num_a, int &p_num_b, uint16_t *r_group_a, uint16_t *r_group_b, const BVHABB_CLASS *r_temp_bounds) {
BVHABB_CLASS groupb_aabb;
groupb_aabb.set_to_max_opposite_extents();
- for (int n = 0; n < num_b; n++) {
- int which = group_b[n];
- groupb_aabb.merge(temp_bounds[which]);
+ for (int n = 0; n < p_num_b; n++) {
+ int which = r_group_b[n];
+ groupb_aabb.merge(r_temp_bounds[which]);
}
BVHABB_CLASS groupb_aabb_new;
@@ -154,21 +154,21 @@ void _split_leaf_sort_groups(int &num_a, int &num_b, uint16_t *group_a, uint16_t
int best_candidate = -1;
// find most likely from a to move into b
- for (int check = 0; check < num_a; check++) {
+ for (int check = 0; check < p_num_a; check++) {
rest_aabb.set_to_max_opposite_extents();
groupb_aabb_new = groupb_aabb;
// find aabb of all the rest
- for (int rest = 0; rest < num_a; rest++) {
+ for (int rest = 0; rest < p_num_a; rest++) {
if (rest == check) {
continue;
}
- int which = group_a[rest];
- rest_aabb.merge(temp_bounds[which]);
+ int which = r_group_a[rest];
+ rest_aabb.merge(r_temp_bounds[which]);
}
- groupb_aabb_new.merge(temp_bounds[group_a[check]]);
+ groupb_aabb_new.merge(r_temp_bounds[r_group_a[check]]);
// now compare the sizes
real_t size = groupb_aabb_new.get_area() + rest_aabb.get_area();
@@ -179,11 +179,11 @@ void _split_leaf_sort_groups(int &num_a, int &num_b, uint16_t *group_a, uint16_t
}
// we should now have the best, move it from group a to group b
- group_b[num_b++] = group_a[best_candidate];
+ r_group_b[p_num_b++] = r_group_a[best_candidate];
// remove best candidate from group a
- num_a--;
- group_a[best_candidate] = group_a[num_a];
+ p_num_a--;
+ r_group_a[best_candidate] = r_group_a[p_num_a];
}
uint32_t split_leaf(uint32_t p_node_id, const BVHABB_CLASS &p_added_item_aabb) {
diff --git a/core/math/bvh_structs.inc b/core/math/bvh_structs.inc
index 771fc13835d..98dd7dd861d 100644
--- a/core/math/bvh_structs.inc
+++ b/core/math/bvh_structs.inc
@@ -78,7 +78,7 @@ public:
}
bool is_dirty() const { return dirty; }
- void set_dirty(bool p) { dirty = p; }
+ void set_dirty(bool p_dirty) { dirty = p_dirty; }
void clear() {
num_items = 0;
@@ -140,8 +140,8 @@ struct TNode {
bool is_full_of_children() const { return num_children >= MAX_CHILDREN; }
- void remove_child_internal(uint32_t child_num) {
- children[child_num] = children[num_children - 1];
+ void remove_child_internal(uint32_t p_child_num) {
+ children[p_child_num] = children[num_children - 1];
num_children--;
}
diff --git a/core/math/color.cpp b/core/math/color.cpp
index ca82489b931..f16f573cd09 100644
--- a/core/math/color.cpp
+++ b/core/math/color.cpp
@@ -109,12 +109,12 @@ uint64_t Color::to_rgba64() const {
return c;
}
-void _append_hex(float p_val, char32_t *string) {
+void _append_hex(float p_val, char32_t *r_string) {
int v = Math::round(p_val * 255.0f);
v = CLAMP(v, 0, 255);
- string[0] = hex_char_table_lower[(v >> 4) & 0xF];
- string[1] = hex_char_table_lower[v & 0xF];
+ r_string[0] = hex_char_table_lower[(v >> 4) & 0xF];
+ r_string[1] = hex_char_table_lower[v & 0xF];
}
String Color::to_html(bool p_alpha) const {
diff --git a/core/math/color.h b/core/math/color.h
index 5b5fd495752..421a9f77ace 100644
--- a/core/math/color.h
+++ b/core/math/color.h
@@ -224,13 +224,13 @@ struct [[nodiscard]] Color {
explicit operator String() const;
// For the binder.
- _FORCE_INLINE_ void set_r8(int32_t r8) { r = (CLAMP(r8, 0, 255) / 255.0f); }
+ _FORCE_INLINE_ void set_r8(int32_t p_r8) { r = (CLAMP(p_r8, 0, 255) / 255.0f); }
_FORCE_INLINE_ int32_t get_r8() const { return int32_t(CLAMP(Math::round(r * 255.0f), 0.0f, 255.0f)); }
- _FORCE_INLINE_ void set_g8(int32_t g8) { g = (CLAMP(g8, 0, 255) / 255.0f); }
+ _FORCE_INLINE_ void set_g8(int32_t p_g8) { g = (CLAMP(p_g8, 0, 255) / 255.0f); }
_FORCE_INLINE_ int32_t get_g8() const { return int32_t(CLAMP(Math::round(g * 255.0f), 0.0f, 255.0f)); }
- _FORCE_INLINE_ void set_b8(int32_t b8) { b = (CLAMP(b8, 0, 255) / 255.0f); }
+ _FORCE_INLINE_ void set_b8(int32_t p_b8) { b = (CLAMP(p_b8, 0, 255) / 255.0f); }
_FORCE_INLINE_ int32_t get_b8() const { return int32_t(CLAMP(Math::round(b * 255.0f), 0.0f, 255.0f)); }
- _FORCE_INLINE_ void set_a8(int32_t a8) { a = (CLAMP(a8, 0, 255) / 255.0f); }
+ _FORCE_INLINE_ void set_a8(int32_t p_a8) { a = (CLAMP(p_a8, 0, 255) / 255.0f); }
_FORCE_INLINE_ int32_t get_a8() const { return int32_t(CLAMP(Math::round(a * 255.0f), 0.0f, 255.0f)); }
_FORCE_INLINE_ void set_h(float p_h) { set_hsv(p_h, get_s(), get_v(), a); }
diff --git a/core/math/convex_hull.cpp b/core/math/convex_hull.cpp
index e72515c99c6..6beef3d1a8e 100644
--- a/core/math/convex_hull.cpp
+++ b/core/math/convex_hull.cpp
@@ -113,8 +113,8 @@ public:
return (x == 0) && (y == 0) && (z == 0);
}
- int64_t dot(const Point64 &b) const {
- return x * b.x + y * b.y + z * b.z;
+ int64_t dot(const Point64 &p_other) const {
+ return x * p_other.x + y * p_other.y + z * p_other.z;
}
};
@@ -134,40 +134,40 @@ public:
z = p_z;
}
- bool operator==(const Point32 &b) const {
- return (x == b.x) && (y == b.y) && (z == b.z);
+ bool operator==(const Point32 &p_other) const {
+ return (x == p_other.x) && (y == p_other.y) && (z == p_other.z);
}
- bool operator!=(const Point32 &b) const {
- return (x != b.x) || (y != b.y) || (z != b.z);
+ bool operator!=(const Point32 &p_other) const {
+ return (x != p_other.x) || (y != p_other.y) || (z != p_other.z);
}
bool is_zero() {
return (x == 0) && (y == 0) && (z == 0);
}
- Point64 cross(const Point32 &b) const {
- return Point64((int64_t)y * b.z - (int64_t)z * b.y, (int64_t)z * b.x - (int64_t)x * b.z, (int64_t)x * b.y - (int64_t)y * b.x);
+ Point64 cross(const Point32 &p_other) const {
+ return Point64((int64_t)y * p_other.z - (int64_t)z * p_other.y, (int64_t)z * p_other.x - (int64_t)x * p_other.z, (int64_t)x * p_other.y - (int64_t)y * p_other.x);
}
- Point64 cross(const Point64 &b) const {
- return Point64(y * b.z - z * b.y, z * b.x - x * b.z, x * b.y - y * b.x);
+ Point64 cross(const Point64 &p_other) const {
+ return Point64(y * p_other.z - z * p_other.y, z * p_other.x - x * p_other.z, x * p_other.y - y * p_other.x);
}
- int64_t dot(const Point32 &b) const {
- return (int64_t)x * b.x + (int64_t)y * b.y + (int64_t)z * b.z;
+ int64_t dot(const Point32 &p_other) const {
+ return (int64_t)x * p_other.x + (int64_t)y * p_other.y + (int64_t)z * p_other.z;
}
- int64_t dot(const Point64 &b) const {
- return x * b.x + y * b.y + z * b.z;
+ int64_t dot(const Point64 &p_other) const {
+ return x * p_other.x + y * p_other.y + z * p_other.z;
}
- Point32 operator+(const Point32 &b) const {
- return Point32(x + b.x, y + b.y, z + b.z);
+ Point32 operator+(const Point32 &p_other) const {
+ return Point32(x + p_other.x, y + p_other.y, z + p_other.z);
}
- Point32 operator-(const Point32 &b) const {
- return Point32(x - b.x, y - b.y, z - b.z);
+ Point32 operator-(const Point32 &p_other) const {
+ return Point32(x - p_other.x, y - p_other.y, z - p_other.z);
}
};
@@ -198,57 +198,57 @@ public:
}
}
- static Int128 mul(int64_t a, int64_t b);
+ static Int128 mul(int64_t p_left, int64_t p_right);
- static Int128 mul(uint64_t a, uint64_t b);
+ static Int128 mul(uint64_t p_left, uint64_t p_right);
Int128 operator-() const {
return Int128(uint64_t(-int64_t(low)), ~high + (low == 0));
}
- Int128 operator+(const Int128 &b) const {
+ Int128 operator+(const Int128 &p_other) const {
#ifdef USE_X86_64_ASM
Int128 result;
__asm__("addq %[bl], %[rl]\n\t"
"adcq %[bh], %[rh]\n\t"
: [rl] "=r"(result.low), [rh] "=r"(result.high)
- : "0"(low), "1"(high), [bl] "g"(b.low), [bh] "g"(b.high)
+ : "0"(low), "1"(high), [bl] "g"(p_other.low), [bh] "g"(p_other.high)
: "cc");
return result;
#else
- uint64_t lo = low + b.low;
- return Int128(lo, high + b.high + (lo < low));
+ uint64_t lo = low + p_other.low;
+ return Int128(lo, high + p_other.high + (lo < low));
#endif
}
- Int128 operator-(const Int128 &b) const {
+ Int128 operator-(const Int128 &p_other) const {
#ifdef USE_X86_64_ASM
Int128 result;
__asm__("subq %[bl], %[rl]\n\t"
"sbbq %[bh], %[rh]\n\t"
: [rl] "=r"(result.low), [rh] "=r"(result.high)
- : "0"(low), "1"(high), [bl] "g"(b.low), [bh] "g"(b.high)
+ : "0"(low), "1"(high), [bl] "g"(p_other.low), [bh] "g"(p_other.high)
: "cc");
return result;
#else
- return *this + -b;
+ return *this + -p_other;
#endif
}
- Int128 &operator+=(const Int128 &b) {
+ Int128 &operator+=(const Int128 &p_other) {
#ifdef USE_X86_64_ASM
__asm__("addq %[bl], %[rl]\n\t"
"adcq %[bh], %[rh]\n\t"
: [rl] "=r"(low), [rh] "=r"(high)
- : "0"(low), "1"(high), [bl] "g"(b.low), [bh] "g"(b.high)
+ : "0"(low), "1"(high), [bl] "g"(p_other.low), [bh] "g"(p_other.high)
: "cc");
#else
- uint64_t lo = low + b.low;
+ uint64_t lo = low + p_other.low;
if (lo < low) {
++high;
}
low = lo;
- high += b.high;
+ high += p_other.high;
#endif
return *this;
}
@@ -260,7 +260,7 @@ public:
return *this;
}
- Int128 operator*(int64_t b) const;
+ Int128 operator*(int64_t p_other) const;
real_t to_scalar() const {
return ((int64_t)high >= 0) ? real_t(high) * (real_t(0x100000000LL) * real_t(0x100000000LL)) + real_t(low) : -(-*this).to_scalar();
@@ -270,21 +270,21 @@ public:
return ((int64_t)high < 0) ? -1 : ((high || low) ? 1 : 0);
}
- bool operator<(const Int128 &b) const {
- return (high < b.high) || ((high == b.high) && (low < b.low));
+ bool operator<(const Int128 &p_other) const {
+ return (high < p_other.high) || ((high == p_other.high) && (low < p_other.low));
}
- int32_t ucmp(const Int128 &b) const {
- if (high < b.high) {
+ int32_t ucmp(const Int128 &p_other) const {
+ if (high < p_other.high) {
return -1;
}
- if (high > b.high) {
+ if (high > p_other.high) {
return 1;
}
- if (low < b.low) {
+ if (low < p_other.low) {
return -1;
}
- if (low > b.low) {
+ if (low > p_other.low) {
return 1;
}
return 0;
@@ -327,7 +327,7 @@ public:
return (sign == 0) && (denominator == 0);
}
- int32_t compare(const Rational64 &b) const;
+ int32_t compare(const Rational64 &p_other) const;
real_t to_scalar() const {
return sign * ((denominator == 0) ? FLT_MAX : (real_t)numerator / denominator);
@@ -374,9 +374,9 @@ public:
is_int_64 = false;
}
- int32_t compare(const Rational128 &b) const;
+ int32_t compare(const Rational128 &p_other) const;
- int32_t compare(int64_t b) const;
+ int32_t compare(int64_t p_int64) const;
real_t to_scalar() const {
return sign * ((denominator.get_sign() == 0) ? FLT_MAX : numerator.to_scalar() / denominator.to_scalar());
@@ -438,12 +438,12 @@ public:
void print_graph();
#endif
- Point32 operator-(const Vertex &b) const {
- return point - b.point;
+ Point32 operator-(const Vertex &p_other) const {
+ return point - p_other.point;
}
- Rational128 dot(const Point64 &b) const {
- return (point.index >= 0) ? Rational128(point.dot(b)) : Rational128(point128.x * b.x + point128.y * b.y + point128.z * b.z, point128.denominator);
+ Rational128 dot(const Point64 &p_other) const {
+ return (point.index >= 0) ? Rational128(point.dot(p_other)) : Rational128(point128.x * p_other.x + point128.y * p_other.y + point128.z * p_other.z, point128.denominator);
}
real_t xvalue() const {
@@ -485,10 +485,10 @@ public:
Face *face = nullptr;
int32_t copy = -1;
- void link(Edge *n) {
- CHULL_ASSERT(reverse->target == n->reverse->target);
- next = n;
- n->prev = this;
+ void link(Edge *p_edge) {
+ CHULL_ASSERT(reverse->target == p_edge->reverse->target);
+ next = p_edge;
+ p_edge->prev = this;
}
#ifdef DEBUG_CONVEX_HULL
@@ -540,8 +540,8 @@ public:
return (uint32_t)p_value;
}
- static uint64_t mul(uint32_t a, uint32_t b) {
- return (uint64_t)a * (uint64_t)b;
+ static uint64_t mul(uint32_t p_left, uint32_t p_right) {
+ return (uint64_t)p_left * (uint64_t)p_right;
}
static void shl_half(uint64_t &p_value) {
@@ -556,8 +556,8 @@ public:
return p_value.low;
}
- static Int128 mul(uint64_t a, uint64_t b) {
- return Int128::mul(a, b);
+ static Int128 mul(uint64_t p_left, uint64_t p_right) {
+ return Int128::mul(p_left, p_right);
}
static void shl_half(Int128 &p_value) {
@@ -674,64 +674,64 @@ public:
Vector3 get_coordinates(const Vertex *p_v);
- real_t shrink(real_t amount, real_t p_clamp_amount);
+ real_t shrink(real_t p_amount, real_t p_clamp_amount);
};
-ConvexHullInternal::Int128 ConvexHullInternal::Int128::operator*(int64_t b) const {
+ConvexHullInternal::Int128 ConvexHullInternal::Int128::operator*(int64_t p_other) const {
bool negative = (int64_t)high < 0;
Int128 a = negative ? -*this : *this;
- if (b < 0) {
+ if (p_other < 0) {
negative = !negative;
- b = -b;
+ p_other = -p_other;
}
- Int128 result = mul(a.low, (uint64_t)b);
- result.high += a.high * (uint64_t)b;
+ Int128 result = mul(a.low, (uint64_t)p_other);
+ result.high += a.high * (uint64_t)p_other;
return negative ? -result : result;
}
-ConvexHullInternal::Int128 ConvexHullInternal::Int128::mul(int64_t a, int64_t b) {
+ConvexHullInternal::Int128 ConvexHullInternal::Int128::mul(int64_t p_left, int64_t p_right) {
Int128 result;
#ifdef USE_X86_64_ASM
__asm__("imulq %[b]"
: "=a"(result.low), "=d"(result.high)
- : "0"(a), [b] "r"(b)
+ : "0"(p_left), [p_right] "r"(p_right)
: "cc");
return result;
#else
- bool negative = a < 0;
+ bool negative = p_left < 0;
if (negative) {
- a = -a;
+ p_left = -p_left;
}
- if (b < 0) {
+ if (p_right < 0) {
negative = !negative;
- b = -b;
+ p_right = -p_right;
}
- DMul<uint64_t, uint32_t>::mul((uint64_t)a, (uint64_t)b, result.low, result.high);
+ DMul<uint64_t, uint32_t>::mul((uint64_t)p_left, (uint64_t)p_right, result.low, result.high);
return negative ? -result : result;
#endif
}
-ConvexHullInternal::Int128 ConvexHullInternal::Int128::mul(uint64_t a, uint64_t b) {
+ConvexHullInternal::Int128 ConvexHullInternal::Int128::mul(uint64_t p_left, uint64_t p_right) {
Int128 result;
#ifdef USE_X86_64_ASM
__asm__("mulq %[b]"
: "=a"(result.low), "=d"(result.high)
- : "0"(a), [b] "r"(b)
+ : "0"(p_left), [p_right] "r"(p_right)
: "cc");
#else
- DMul<uint64_t, uint32_t>::mul(a, b, result.low, result.high);
+ DMul<uint64_t, uint32_t>::mul(p_left, p_right, result.low, result.high);
#endif
return result;
}
-int32_t ConvexHullInternal::Rational64::compare(const Rational64 &b) const {
- if (sign != b.sign) {
- return sign - b.sign;
+int32_t ConvexHullInternal::Rational64::compare(const Rational64 &p_other) const {
+ if (sign != p_other.sign) {
+ return sign - p_other.sign;
} else if (sign == 0) {
return 0;
}
@@ -754,7 +754,7 @@ int32_t ConvexHullInternal::Rational64::compare(const Rational64 &b) const {
"decb %%bh\n\t" // now bx=0x0000 if difference is zero, 0xff01 if it is negative, 0x0001 if it is positive (i.e., same sign as difference)
"shll $16, %%ebx\n\t" // ebx has same sign as difference
: "=&b"(result), [tmp] "=&r"(tmp), "=a"(dummy)
- : "a"(denominator), [bn] "g"(b.numerator), [tn] "g"(numerator), [bd] "g"(b.denominator)
+ : "a"(denominator), [bn] "g"(p_other.numerator), [tn] "g"(numerator), [bd] "g"(p_other.denominator)
: "%rdx", "cc");
// if sign is +1, only bit 0 of result is inverted, which does not change the sign of result (and cannot result in zero)
// if sign is -1, all bits of result are inverted, which changes the sign of result (and again cannot result in zero)
@@ -762,24 +762,24 @@ int32_t ConvexHullInternal::Rational64::compare(const Rational64 &b) const {
#else
- return sign * Int128::mul(numerator, b.denominator).ucmp(Int128::mul(denominator, b.numerator));
+ return sign * Int128::mul(numerator, p_other.denominator).ucmp(Int128::mul(denominator, p_other.numerator));
#endif
}
-int32_t ConvexHullInternal::Rational128::compare(const Rational128 &b) const {
- if (sign != b.sign) {
- return sign - b.sign;
+int32_t ConvexHullInternal::Rational128::compare(const Rational128 &p_other) const {
+ if (sign != p_other.sign) {
+ return sign - p_other.sign;
} else if (sign == 0) {
return 0;
}
if (is_int_64) {
- return -b.compare(sign * (int64_t)numerator.low);
+ return -p_other.compare(sign * (int64_t)numerator.low);
}
Int128 nbd_low, nbd_high, dbn_low, dbn_high;
- DMul<Int128, uint64_t>::mul(numerator, b.denominator, nbd_low, nbd_high);
- DMul<Int128, uint64_t>::mul(denominator, b.numerator, dbn_low, dbn_high);
+ DMul<Int128, uint64_t>::mul(numerator, p_other.denominator, nbd_low, nbd_high);
+ DMul<Int128, uint64_t>::mul(denominator, p_other.numerator, dbn_low, dbn_high);
int32_t cmp = nbd_high.ucmp(dbn_high);
if (cmp) {
@@ -788,25 +788,25 @@ int32_t ConvexHullInternal::Rational128::compare(const Rational128 &b) const {
return nbd_low.ucmp(dbn_low) * sign;
}
-int32_t ConvexHullInternal::Rational128::compare(int64_t b) const {
+int32_t ConvexHullInternal::Rational128::compare(int64_t p_int64) const {
if (is_int_64) {
int64_t a = sign * (int64_t)numerator.low;
- return (a > b) ? 1 : ((a < b) ? -1 : 0);
+ return (a > p_int64) ? 1 : ((a < p_int64) ? -1 : 0);
}
- if (b > 0) {
+ if (p_int64 > 0) {
if (sign <= 0) {
return -1;
}
- } else if (b < 0) {
+ } else if (p_int64 < 0) {
if (sign >= 0) {
return 1;
}
- b = -b;
+ p_int64 = -p_int64;
} else {
return sign;
}
- return numerator.ucmp(denominator * b) * sign;
+ return numerator.ucmp(denominator * p_int64) * sign;
}
ConvexHullInternal::Edge *ConvexHullInternal::new_edge_pair(Vertex *p_from, Vertex *p_to) {
@@ -1570,8 +1570,8 @@ void ConvexHullInternal::merge(IntermediateHull &p_h0, IntermediateHull &p_h1) {
}
struct PointComparator {
- _FORCE_INLINE_ bool operator()(const ConvexHullInternal::Point32 &p, const ConvexHullInternal::Point32 &q) const {
- return (p.y < q.y) || ((p.y == q.y) && ((p.x < q.x) || ((p.x == q.x) && (p.z < q.z))));
+ _FORCE_INLINE_ bool operator()(const ConvexHullInternal::Point32 &p_left, const ConvexHullInternal::Point32 &p_right) const {
+ return (p_left.y < p_right.y) || ((p_left.y == p_right.y) && ((p_left.x < p_right.x) || ((p_left.x == p_right.x) && (p_left.z < p_right.z))));
}
};
diff --git a/core/math/disjoint_set.h b/core/math/disjoint_set.h
index 9345375f0c7..6a95c0bd616 100644
--- a/core/math/disjoint_set.h
+++ b/core/math/disjoint_set.h
@@ -46,20 +46,20 @@ class DisjointSet {
MapT elements;
- Element *get_parent(Element *element);
+ Element *get_parent(Element *r_element);
- _FORCE_INLINE_ Element *insert_or_get(T object);
+ _FORCE_INLINE_ Element *insert_or_get(T p_object);
public:
~DisjointSet();
- _FORCE_INLINE_ void insert(T object) { (void)insert_or_get(object); }
+ _FORCE_INLINE_ void insert(T p_object) { (void)insert_or_get(p_object); }
- void create_union(T a, T b);
+ void create_union(T p_left, T p_right);
- void get_representatives(Vector<T> &out_roots);
+ void get_representatives(Vector<T> &r_out_roots);
- void get_members(Vector<T> &out_members, T representative);
+ void get_members(Vector<T> &r_out_members, T p_representative);
};
/* FUNCTIONS */
@@ -72,33 +72,33 @@ DisjointSet<T, H, C, AL>::~DisjointSet() {
}
template <typename T, typename H, typename C, typename AL>
-typename DisjointSet<T, H, C, AL>::Element *DisjointSet<T, H, C, AL>::get_parent(Element *element) {
- if (element->parent != element) {
- element->parent = get_parent(element->parent);
+typename DisjointSet<T, H, C, AL>::Element *DisjointSet<T, H, C, AL>::get_parent(Element *r_element) {
+ if (r_element->parent != r_element) {
+ r_element->parent = get_parent(r_element->parent);
}
- return element->parent;
+ return r_element->parent;
}
template <typename T, typename H, typename C, typename AL>
-typename DisjointSet<T, H, C, AL>::Element *DisjointSet<T, H, C, AL>::insert_or_get(T object) {
- typename MapT::Iterator itr = elements.find(object);
+typename DisjointSet<T, H, C, AL>::Element *DisjointSet<T, H, C, AL>::insert_or_get(T p_object) {
+ typename MapT::Iterator itr = elements.find(p_object);
if (itr != nullptr) {
return itr->value;
}
Element *new_element = memnew_allocator(Element, AL);
- new_element->object = object;
+ new_element->object = p_object;
new_element->parent = new_element;
- elements.insert(object, new_element);
+ elements.insert(p_object, new_element);
return new_element;
}
template <typename T, typename H, typename C, typename AL>
-void DisjointSet<T, H, C, AL>::create_union(T a, T b) {
- Element *x = insert_or_get(a);
- Element *y = insert_or_get(b);
+void DisjointSet<T, H, C, AL>::create_union(T p_left, T p_right) {
+ Element *x = insert_or_get(p_left);
+ Element *y = insert_or_get(p_right);
Element *x_root = get_parent(x);
Element *y_root = get_parent(y);
@@ -121,18 +121,18 @@ void DisjointSet<T, H, C, AL>::create_union(T a, T b) {
}
template <typename T, typename H, typename C, typename AL>
-void DisjointSet<T, H, C, AL>::get_representatives(Vector<T> &out_representatives) {
+void DisjointSet<T, H, C, AL>::get_representatives(Vector<T> &r_out_representatives) {
for (KeyValue<T, Element *> &E : elements) {
Element *element = E.value;
if (element->parent == element) {
- out_representatives.push_back(element->object);
+ r_out_representatives.push_back(element->object);
}
}
}
template <typename T, typename H, typename C, typename AL>
-void DisjointSet<T, H, C, AL>::get_members(Vector<T> &out_members, T representative) {
- typename MapT::Iterator rep_itr = elements.find(representative);
+void DisjointSet<T, H, C, AL>::get_members(Vector<T> &r_out_members, T p_representative) {
+ typename MapT::Iterator rep_itr = elements.find(p_representative);
ERR_FAIL_NULL(rep_itr);
Element *rep_element = rep_itr->value;
@@ -141,7 +141,7 @@ void DisjointSet<T, H, C, AL>::get_members(Vector<T> &out_members, T representat
for (KeyValue<T, Element *> &E : elements) {
Element *parent = get_parent(E.value);
if (parent == rep_element) {
- out_members.push_back(E.key);
+ r_out_members.push_back(E.key);
}
}
}
diff --git a/core/math/dynamic_bvh.cpp b/core/math/dynamic_bvh.cpp
index 1195072a298..a49f8ddb375 100644
--- a/core/math/dynamic_bvh.cpp
+++ b/core/math/dynamic_bvh.cpp
@@ -96,14 +96,14 @@ void DynamicBVH::_insert_leaf(Node *p_root, Node *p_leaf) {
}
}
-DynamicBVH::Node *DynamicBVH::_remove_leaf(Node *leaf) {
- if (leaf == bvh_root) {
+DynamicBVH::Node *DynamicBVH::_remove_leaf(Node *r_leaf) {
+ if (r_leaf == bvh_root) {
bvh_root = nullptr;
return (nullptr);
} else {
- Node *parent = leaf->parent;
+ Node *parent = r_leaf->parent;
Node *prev = parent->parent;
- Node *sibling = parent->children[1 - leaf->get_index_in_parent()];
+ Node *sibling = parent->children[1 - r_leaf->get_index_in_parent()];
if (prev) {
prev->children[parent->get_index_in_parent()] = sibling;
sibling->parent = prev;
@@ -140,11 +140,11 @@ void DynamicBVH::_fetch_leaves(Node *p_root, LocalVector<Node *> &r_leaves, int
// Partitions leaves such that leaves[0, n) are on the
// left of axis, and leaves[n, count) are on the right
// of axis. returns N.
-int DynamicBVH::_split(Node **leaves, int p_count, const Vector3 &p_org, const Vector3 &p_axis) {
+int DynamicBVH::_split(Node **r_leaves, int p_count, const Vector3 &p_org, const Vector3 &p_axis) {
int begin = 0;
int end = p_count;
for (;;) {
- while (begin != end && leaves[begin]->is_left_of_axis(p_org, p_axis)) {
+ while (begin != end && r_leaves[begin]->is_left_of_axis(p_org, p_axis)) {
++begin;
}
@@ -152,7 +152,7 @@ int DynamicBVH::_split(Node **leaves, int p_count, const Vector3 &p_org, const V
break;
}
- while (begin != end && !leaves[end - 1]->is_left_of_axis(p_org, p_axis)) {
+ while (begin != end && !r_leaves[end - 1]->is_left_of_axis(p_org, p_axis)) {
--end;
}
@@ -162,30 +162,30 @@ int DynamicBVH::_split(Node **leaves, int p_count, const Vector3 &p_org, const V
// swap out of place nodes
--end;
- Node *temp = leaves[begin];
- leaves[begin] = leaves[end];
- leaves[end] = temp;
+ Node *temp = r_leaves[begin];
+ r_leaves[begin] = r_leaves[end];
+ r_leaves[end] = temp;
++begin;
}
return begin;
}
-DynamicBVH::Volume DynamicBVH::_bounds(Node **leaves, int p_count) {
- Volume volume = leaves[0]->volume;
+DynamicBVH::Volume DynamicBVH::_bounds(Node **r_leaves, int p_count) {
+ Volume volume = r_leaves[0]->volume;
for (int i = 1, ni = p_count; i < ni; ++i) {
- volume = volume.merge(leaves[i]->volume);
+ volume = volume.merge(r_leaves[i]->volume);
}
return (volume);
}
-void DynamicBVH::_bottom_up(Node **leaves, int p_count) {
+void DynamicBVH::_bottom_up(Node **r_leaves, int p_count) {
while (p_count > 1) {
real_t minsize = Math::INF;
int minidx[2] = { -1, -1 };
for (int i = 0; i < p_count; ++i) {
for (int j = i + 1; j < p_count; ++j) {
- const real_t sz = leaves[i]->volume.merge(leaves[j]->volume).get_size();
+ const real_t sz = r_leaves[i]->volume.merge(r_leaves[j]->volume).get_size();
if (sz < minsize) {
minsize = sz;
minidx[0] = i;
@@ -193,25 +193,25 @@ void DynamicBVH::_bottom_up(Node **leaves, int p_count) {
}
}
}
- Node *n[] = { leaves[minidx[0]], leaves[minidx[1]] };
+ Node *n[] = { r_leaves[minidx[0]], r_leaves[minidx[1]] };
Node *p = _create_node_with_volume(nullptr, n[0]->volume.merge(n[1]->volume), nullptr);
p->children[0] = n[0];
p->children[1] = n[1];
n[0]->parent = p;
n[1]->parent = p;
- leaves[minidx[0]] = p;
- leaves[minidx[1]] = leaves[p_count - 1];
+ r_leaves[minidx[0]] = p;
+ r_leaves[minidx[1]] = r_leaves[p_count - 1];
--p_count;
}
}
-DynamicBVH::Node *DynamicBVH::_top_down(Node **leaves, int p_count, int p_bu_threshold) {
+DynamicBVH::Node *DynamicBVH::_top_down(Node **r_leaves, int p_count, int p_bu_threshold) {
static const Vector3 axis[] = { Vector3(1, 0, 0), Vector3(0, 1, 0), Vector3(0, 0, 1) };
ERR_FAIL_COND_V(p_bu_threshold <= 1, nullptr);
if (p_count > 1) {
if (p_count > p_bu_threshold) {
- const Volume vol = _bounds(leaves, p_count);
+ const Volume vol = _bounds(r_leaves, p_count);
const Vector3 org = vol.get_center();
int partition;
int bestaxis = -1;
@@ -219,7 +219,7 @@ DynamicBVH::Node *DynamicBVH::_top_down(Node **leaves, int p_count, int p_bu_thr
int splitcount[3][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 } };
int i;
for (i = 0; i < p_count; ++i) {
- const Vector3 x = leaves[i]->volume.get_center() - org;
+ const Vector3 x = r_leaves[i]->volume.get_center() - org;
for (int j = 0; j < 3; ++j) {
++splitcount[j][x.dot(axis[j]) > 0 ? 1 : 0];
}
@@ -234,53 +234,53 @@ DynamicBVH::Node *DynamicBVH::_top_down(Node **leaves, int p_count, int p_bu_thr
}
}
if (bestaxis >= 0) {
- partition = _split(leaves, p_count, org, axis[bestaxis]);
+ partition = _split(r_leaves, p_count, org, axis[bestaxis]);
ERR_FAIL_COND_V(partition == 0 || partition == p_count, nullptr);
} else {
partition = p_count / 2 + 1;
}
Node *node = _create_node_with_volume(nullptr, vol, nullptr);
- node->children[0] = _top_down(&leaves[0], partition, p_bu_threshold);
- node->children[1] = _top_down(&leaves[partition], p_count - partition, p_bu_threshold);
+ node->children[0] = _top_down(&r_leaves[0], partition, p_bu_threshold);
+ node->children[1] = _top_down(&r_leaves[partition], p_count - partition, p_bu_threshold);
node->children[0]->parent = node;
node->children[1]->parent = node;
return (node);
} else {
- _bottom_up(leaves, p_count);
- return (leaves[0]);
+ _bottom_up(r_leaves, p_count);
+ return (r_leaves[0]);
}
}
- return (leaves[0]);
+ return (r_leaves[0]);
}
-DynamicBVH::Node *DynamicBVH::_node_sort(Node *n, Node *&r) {
- Node *p = n->parent;
- ERR_FAIL_COND_V(!n->is_internal(), nullptr);
- if (p > n) {
- const int i = n->get_index_in_parent();
+DynamicBVH::Node *DynamicBVH::_node_sort(Node *r_node, Node *&r_root) {
+ Node *p = r_node->parent;
+ ERR_FAIL_COND_V(!r_node->is_internal(), nullptr);
+ if (p > r_node) {
+ const int i = r_node->get_index_in_parent();
const int j = 1 - i;
Node *s = p->children[j];
Node *q = p->parent;
- ERR_FAIL_COND_V(n != p->children[i], nullptr);
+ ERR_FAIL_COND_V(r_node != p->children[i], nullptr);
if (q) {
- q->children[p->get_index_in_parent()] = n;
+ q->children[p->get_index_in_parent()] = r_node;
} else {
- r = n;
+ r_root = r_node;
}
- s->parent = n;
- p->parent = n;
- n->parent = q;
- p->children[0] = n->children[0];
- p->children[1] = n->children[1];
- n->children[0]->parent = p;
- n->children[1]->parent = p;
- n->children[i] = p;
- n->children[j] = s;
- SWAP(p->volume, n->volume);
+ s->parent = r_node;
+ p->parent = r_node;
+ r_node->parent = q;
+ p->children[0] = r_node->children[0];
+ p->children[1] = r_node->children[1];
+ r_node->children[0]->parent = p;
+ r_node->children[1]->parent = p;
+ r_node->children[i] = p;
+ r_node->children[j] = s;
+ SWAP(p->volume, r_node->volume);
return (p);
}
- return (n);
+ return (r_node);
}
void DynamicBVH::clear() {
@@ -300,19 +300,19 @@ void DynamicBVH::optimize_bottom_up() {
}
}
-void DynamicBVH::optimize_top_down(int bu_threshold) {
+void DynamicBVH::optimize_top_down(int p_bu_threshold) {
if (bvh_root) {
LocalVector<Node *> leaves;
_fetch_leaves(bvh_root, leaves);
- bvh_root = _top_down(&leaves[0], leaves.size(), bu_threshold);
+ bvh_root = _top_down(&leaves[0], leaves.size(), p_bu_threshold);
}
}
-void DynamicBVH::optimize_incremental(int passes) {
- if (passes < 0) {
- passes = total_leaves;
+void DynamicBVH::optimize_incremental(int p_passes) {
+ if (p_passes < 0) {
+ p_passes = total_leaves;
}
- if (passes > 0) {
+ if (p_passes > 0) {
do {
if (!bvh_root) {
break;
@@ -325,7 +325,7 @@ void DynamicBVH::optimize_incremental(int passes) {
}
_update(node);
++opath;
- } while (--passes);
+ } while (--p_passes);
}
}
@@ -344,18 +344,18 @@ DynamicBVH::ID DynamicBVH::insert(const AABB &p_box, void *p_userdata) {
return id;
}
-void DynamicBVH::_update(Node *leaf, int lookahead) {
- Node *root = _remove_leaf(leaf);
+void DynamicBVH::_update(Node *r_leaf, int p_lookahead) {
+ Node *root = _remove_leaf(r_leaf);
if (root) {
- if (lookahead >= 0) {
- for (int i = 0; (i < lookahead) && root->parent; ++i) {
+ if (p_lookahead >= 0) {
+ for (int i = 0; (i < p_lookahead) && root->parent; ++i) {
root = root->parent;
}
} else {
root = bvh_root;
}
}
- _insert_leaf(root, leaf);
+ _insert_leaf(root, r_leaf);
}
bool DynamicBVH::update(const ID &p_id, const AABB &p_box) {
diff --git a/core/math/dynamic_bvh.h b/core/math/dynamic_bvh.h
index 10e4e0637a4..a0325580c54 100644
--- a/core/math/dynamic_bvh.h
+++ b/core/math/dynamic_bvh.h
@@ -74,27 +74,27 @@ private:
_FORCE_INLINE_ Vector3 get_center() const { return ((min + max) / 2); }
_FORCE_INLINE_ Vector3 get_length() const { return (max - min); }
- _FORCE_INLINE_ bool contains(const Volume &a) const {
- return ((min.x <= a.min.x) &&
- (min.y <= a.min.y) &&
- (min.z <= a.min.z) &&
- (max.x >= a.max.x) &&
- (max.y >= a.max.y) &&
- (max.z >= a.max.z));
+ _FORCE_INLINE_ bool contains(const Volume &p_a) const {
+ return ((min.x <= p_a.min.x) &&
+ (min.y <= p_a.min.y) &&
+ (min.z <= p_a.min.z) &&
+ (max.x >= p_a.max.x) &&
+ (max.y >= p_a.max.y) &&
+ (max.z >= p_a.max.z));
}
- _FORCE_INLINE_ Volume merge(const Volume &b) const {
+ _FORCE_INLINE_ Volume merge(const Volume &p_b) const {
Volume r;
for (int i = 0; i < 3; ++i) {
- if (min[i] < b.min[i]) {
+ if (min[i] < p_b.min[i]) {
r.min[i] = min[i];
} else {
- r.min[i] = b.min[i];
+ r.min[i] = p_b.min[i];
}
- if (max[i] > b.max[i]) {
+ if (max[i] > p_b.max[i]) {
r.max[i] = max[i];
} else {
- r.max[i] = b.max[i];
+ r.max[i] = p_b.max[i];
}
}
return r;
@@ -106,32 +106,32 @@ private:
edges.x + edges.y + edges.z);
}
- _FORCE_INLINE_ bool is_not_equal_to(const Volume &b) const {
- return ((min.x != b.min.x) ||
- (min.y != b.min.y) ||
- (min.z != b.min.z) ||
- (max.x != b.max.x) ||
- (max.y != b.max.y) ||
- (max.z != b.max.z));
+ _FORCE_INLINE_ bool is_not_equal_to(const Volume &p_b) const {
+ return ((min.x != p_b.min.x) ||
+ (min.y != p_b.min.y) ||
+ (min.z != p_b.min.z) ||
+ (max.x != p_b.max.x) ||
+ (max.y != p_b.max.y) ||
+ (max.z != p_b.max.z));
}
- _FORCE_INLINE_ real_t get_proximity_to(const Volume &b) const {
- const Vector3 d = (min + max) - (b.min + b.max);
+ _FORCE_INLINE_ real_t get_proximity_to(const Volume &p_b) const {
+ const Vector3 d = (min + max) - (p_b.min + p_b.max);
return (Math::abs(d.x) + Math::abs(d.y) + Math::abs(d.z));
}
- _FORCE_INLINE_ int select_by_proximity(const Volume &a, const Volume &b) const {
- return (get_proximity_to(a) < get_proximity_to(b) ? 0 : 1);
+ _FORCE_INLINE_ int select_by_proximity(const Volume &p_a, const Volume &p_b) const {
+ return (get_proximity_to(p_a) < get_proximity_to(p_b) ? 0 : 1);
}
//
- _FORCE_INLINE_ bool intersects(const Volume &b) const {
- return ((min.x <= b.max.x) &&
- (max.x >= b.min.x) &&
- (min.y <= b.max.y) &&
- (max.y >= b.min.y) &&
- (min.z <= b.max.z) &&
- (max.z >= b.min.z));
+ _FORCE_INLINE_ bool intersects(const Volume &p_b) const {
+ return ((min.x <= p_b.max.x) &&
+ (max.x >= p_b.min.x) &&
+ (min.y <= p_b.max.y) &&
+ (max.y >= p_b.min.y) &&
+ (min.z <= p_b.max.z) &&
+ (max.z >= p_b.min.z));
}
_FORCE_INLINE_ bool intersects_convex(const Plane *p_planes, int p_plane_count, const Vector3 *p_points, int p_point_count) const {
@@ -192,12 +192,12 @@ private:
ERR_FAIL_NULL_V(parent, 0);
return (parent->children[1] == this) ? 1 : 0;
}
- void get_max_depth(int depth, int &maxdepth) {
+ void get_max_depth(int p_depth, int &r_maxdepth) {
if (is_internal()) {
- children[0]->get_max_depth(depth + 1, maxdepth);
- children[1]->get_max_depth(depth + 1, maxdepth);
+ children[0]->get_max_depth(p_depth + 1, r_maxdepth);
+ children[1]->get_max_depth(p_depth + 1, r_maxdepth);
} else {
- maxdepth = MAX(maxdepth, depth);
+ r_maxdepth = MAX(r_maxdepth, p_depth);
}
}
@@ -210,8 +210,8 @@ private:
}
}
- bool is_left_of_axis(const Vector3 &org, const Vector3 &axis) const {
- return axis.dot(volume.get_center() - org) <= 0;
+ bool is_left_of_axis(const Vector3 &p_org, const Vector3 &p_axis) const {
+ return p_axis.dot(volume.get_center() - p_org) <= 0;
}
Node() {
@@ -237,50 +237,50 @@ private:
_FORCE_INLINE_ Node *_create_node(Node *p_parent, void *p_data);
_FORCE_INLINE_ DynamicBVH::Node *_create_node_with_volume(Node *p_parent, const Volume &p_volume, void *p_data);
_FORCE_INLINE_ void _insert_leaf(Node *p_root, Node *p_leaf);
- _FORCE_INLINE_ Node *_remove_leaf(Node *leaf);
+ _FORCE_INLINE_ Node *_remove_leaf(Node *r_leaf);
void _fetch_leaves(Node *p_root, LocalVector<Node *> &r_leaves, int p_depth = -1);
- static int _split(Node **leaves, int p_count, const Vector3 &p_org, const Vector3 &p_axis);
- static Volume _bounds(Node **leaves, int p_count);
- void _bottom_up(Node **leaves, int p_count);
- Node *_top_down(Node **leaves, int p_count, int p_bu_threshold);
- Node *_node_sort(Node *n, Node *&r);
+ static int _split(Node **r_leaves, int p_count, const Vector3 &p_org, const Vector3 &p_axis);
+ static Volume _bounds(Node **r_leaves, int p_count);
+ void _bottom_up(Node **r_leaves, int p_count);
+ Node *_top_down(Node **r_leaves, int p_count, int p_bu_threshold);
+ Node *_node_sort(Node *r_node, Node *&r_root);
- _FORCE_INLINE_ void _update(Node *leaf, int lookahead = -1);
+ _FORCE_INLINE_ void _update(Node *r_leaf, int p_lookahead = -1);
void _extract_leaves(Node *p_node, List<ID> *r_elements);
- _FORCE_INLINE_ bool _ray_aabb(const Vector3 &rayFrom, const Vector3 &rayInvDirection, const unsigned int raySign[3], const Vector3 bounds[2], real_t &tmin, real_t lambda_min, real_t lambda_max) {
+ _FORCE_INLINE_ bool _ray_aabb(const Vector3 &p_ray_from, const Vector3 &p_ray_inv_direction, const unsigned int p_ray_sign[3], const Vector3 p_bounds[2], real_t &r_tmin, real_t p_lambda_min, real_t p_lambda_max) {
real_t tmax, tymin, tymax, tzmin, tzmax;
- tmin = (bounds[raySign[0]].x - rayFrom.x) * rayInvDirection.x;
- tmax = (bounds[1 - raySign[0]].x - rayFrom.x) * rayInvDirection.x;
- tymin = (bounds[raySign[1]].y - rayFrom.y) * rayInvDirection.y;
- tymax = (bounds[1 - raySign[1]].y - rayFrom.y) * rayInvDirection.y;
+ r_tmin = (p_bounds[p_ray_sign[0]].x - p_ray_from.x) * p_ray_inv_direction.x;
+ tmax = (p_bounds[1 - p_ray_sign[0]].x - p_ray_from.x) * p_ray_inv_direction.x;
+ tymin = (p_bounds[p_ray_sign[1]].y - p_ray_from.y) * p_ray_inv_direction.y;
+ tymax = (p_bounds[1 - p_ray_sign[1]].y - p_ray_from.y) * p_ray_inv_direction.y;
- if ((tmin > tymax) || (tymin > tmax)) {
+ if ((r_tmin > tymax) || (tymin > tmax)) {
return false;
}
- if (tymin > tmin) {
- tmin = tymin;
+ if (tymin > r_tmin) {
+ r_tmin = tymin;
}
if (tymax < tmax) {
tmax = tymax;
}
- tzmin = (bounds[raySign[2]].z - rayFrom.z) * rayInvDirection.z;
- tzmax = (bounds[1 - raySign[2]].z - rayFrom.z) * rayInvDirection.z;
+ tzmin = (p_bounds[p_ray_sign[2]].z - p_ray_from.z) * p_ray_inv_direction.z;
+ tzmax = (p_bounds[1 - p_ray_sign[2]].z - p_ray_from.z) * p_ray_inv_direction.z;
- if ((tmin > tzmax) || (tzmin > tmax)) {
+ if ((r_tmin > tzmax) || (tzmin > tmax)) {
return false;
}
- if (tzmin > tmin) {
- tmin = tzmin;
+ if (tzmin > r_tmin) {
+ r_tmin = tzmin;
}
if (tzmax < tmax) {
tmax = tzmax;
}
- return ((tmin < lambda_max) && (tmax > lambda_min));
+ return ((r_tmin < p_lambda_max) && (tmax > p_lambda_min));
}
public:
@@ -288,8 +288,8 @@ public:
void clear();
bool is_empty() const { return (nullptr == bvh_root); }
void optimize_bottom_up();
- void optimize_top_down(int bu_threshold = 128);
- void optimize_incremental(int passes);
+ void optimize_top_down(int p_bu_threshold = 128);
+ void optimize_incremental(int p_passes);
ID insert(const AABB &p_box, void *p_userdata);
bool update(const ID &p_id, const AABB &p_box);
void remove(const ID &p_id);
diff --git a/core/math/geometry_2d.cpp b/core/math/geometry_2d.cpp
index 5ac8b51627f..6ceca0de6d0 100644
--- a/core/math/geometry_2d.cpp
+++ b/core/math/geometry_2d.cpp
@@ -247,7 +247,7 @@ void Geometry2D::make_atlas(const Vector<Size2i> &p_rects, Vector<Point2i> &r_re
r_size = Size2(results[best].max_w, results[best].max_h);
}
-Vector<Vector<Point2>> Geometry2D::_polypaths_do_operation(PolyBooleanOperation p_op, const Vector<Point2> &p_polypath_a, const Vector<Point2> &p_polypath_b, bool is_a_open) {
+Vector<Vector<Point2>> Geometry2D::_polypaths_do_operation(PolyBooleanOperation p_op, const Vector<Point2> &p_polypath_a, const Vector<Point2> &p_polypath_b, bool p_is_a_open) {
using namespace Clipper2Lib;
ClipType op = ClipType::Union;
@@ -278,7 +278,7 @@ Vector<Vector<Point2>> Geometry2D::_polypaths_do_operation(PolyBooleanOperation
ClipperD clp(clipper_precision); // Scale points up internally to attain the desired precision.
clp.PreserveCollinear(false); // Remove redundant vertices.
- if (is_a_open) {
+ if (p_is_a_open) {
clp.AddOpenSubject({ path_a });
} else {
clp.AddSubject({ path_a });
@@ -287,7 +287,7 @@ Vector<Vector<Point2>> Geometry2D::_polypaths_do_operation(PolyBooleanOperation
PathsD paths;
- if (is_a_open) {
+ if (p_is_a_open) {
PolyTreeD tree; // Needed to populate polylines.
clp.Execute(op, FillRule::EvenOdd, tree, paths);
} else {
diff --git a/core/math/geometry_2d.h b/core/math/geometry_2d.h
index fa5b0f061bd..e4e1e6b1637 100644
--- a/core/math/geometry_2d.h
+++ b/core/math/geometry_2d.h
@@ -41,10 +41,10 @@
class Geometry2D {
public:
- static real_t get_closest_points_between_segments(const Vector2 &p1, const Vector2 &q1, const Vector2 &p2, const Vector2 &q2, Vector2 &c1, Vector2 &c2) {
- Vector2 d1 = q1 - p1; // Direction vector of segment S1.
- Vector2 d2 = q2 - p2; // Direction vector of segment S2.
- Vector2 r = p1 - p2;
+ static real_t get_closest_points_between_segments(const Vector2 &p_p1, const Vector2 &p_q1, const Vector2 &p_p2, const Vector2 &p_q2, Vector2 &p_c1, Vector2 &p_c2) {
+ Vector2 d1 = p_q1 - p_p1; // Direction vector of segment S1.
+ Vector2 d2 = p_q2 - p_p2; // Direction vector of segment S2.
+ Vector2 r = p_p1 - p_p2;
real_t a = d1.dot(d1); // Squared length of segment S1, always nonnegative.
real_t e = d2.dot(d2); // Squared length of segment S2, always nonnegative.
real_t f = d2.dot(r);
@@ -52,9 +52,9 @@ public:
// Check if either or both segments degenerate into points.
if (a <= (real_t)CMP_EPSILON && e <= (real_t)CMP_EPSILON) {
// Both segments degenerate into points.
- c1 = p1;
- c2 = p2;
- return Math::sqrt((c1 - c2).dot(c1 - c2));
+ p_c1 = p_p1;
+ p_c2 = p_p2;
+ return Math::sqrt((p_c1 - p_c2).dot(p_c1 - p_c2));
}
if (a <= (real_t)CMP_EPSILON) {
// First segment degenerates into a point.
@@ -94,9 +94,9 @@ public:
}
}
}
- c1 = p1 + d1 * s;
- c2 = p2 + d2 * t;
- return Math::sqrt((c1 - c2).dot(c1 - c2));
+ p_c1 = p_p1 + d1 * s;
+ p_c2 = p_p2 + d2 * t;
+ return Math::sqrt((p_c1 - p_c2).dot(p_c1 - p_c2));
}
#ifndef DISABLE_DEPRECATED
@@ -134,10 +134,10 @@ public:
return p_point.distance_to(get_closest_point_to_segment(p_point, p_segment_a, p_segment_b));
}
- static bool is_point_in_triangle(const Vector2 &s, const Vector2 &a, const Vector2 &b, const Vector2 &c) {
- Vector2 an = a - s;
- Vector2 bn = b - s;
- Vector2 cn = c - s;
+ static bool is_point_in_triangle(const Vector2 &p_point, const Vector2 &p_a, const Vector2 &p_b, const Vector2 &p_c) {
+ Vector2 an = p_a - p_point;
+ Vector2 bn = p_b - p_point;
+ Vector2 cn = p_c - p_point;
bool orientation = an.cross(bn) > 0;
@@ -427,34 +427,34 @@ public:
return false;
}
- static real_t vec2_cross(const Point2 &O, const Point2 &A, const Point2 &B) {
- return (real_t)(A.x - O.x) * (B.y - O.y) - (real_t)(A.y - O.y) * (B.x - O.x);
+ static real_t vec2_cross(const Point2 &p_o, const Point2 &p_a, const Point2 &p_b) {
+ return (real_t)(p_a.x - p_o.x) * (p_b.y - p_o.y) - (real_t)(p_a.y - p_o.y) * (p_b.x - p_o.x);
}
// Returns a list of points on the convex hull in counter-clockwise order.
// Note: the last point in the returned list is the same as the first one.
- static Vector<Point2> convex_hull(Vector<Point2> P) {
- int n = P.size(), k = 0;
+ static Vector<Point2> convex_hull(Vector<Point2> p_points) {
+ int n = p_points.size(), k = 0;
Vector<Point2> H;
H.resize(2 * n);
// Sort points lexicographically.
- P.sort();
+ p_points.sort();
// Build lower hull.
for (int i = 0; i < n; ++i) {
- while (k >= 2 && vec2_cross(H[k - 2], H[k - 1], P[i]) <= 0) {
+ while (k >= 2 && vec2_cross(H[k - 2], H[k - 1], p_points[i]) <= 0) {
k--;
}
- H.write[k++] = P[i];
+ H.write[k++] = p_points[i];
}
// Build upper hull.
for (int i = n - 2, t = k + 1; i >= 0; i--) {
- while (k >= t && vec2_cross(H[k - 2], H[k - 1], P[i]) <= 0) {
+ while (k >= t && vec2_cross(H[k - 2], H[k - 1], p_points[i]) <= 0) {
k--;
}
- H.write[k++] = P[i];
+ H.write[k++] = p_points[i];
}
H.resize(k);
@@ -508,6 +508,6 @@ public:
static Vector<Vector3i> partial_pack_rects(const Vector<Vector2i> &p_sizes, const Size2i &p_atlas_size);
private:
- static Vector<Vector<Point2>> _polypaths_do_operation(PolyBooleanOperation p_op, const Vector<Point2> &p_polypath_a, const Vector<Point2> &p_polypath_b, bool is_a_open = false);
+ static Vector<Vector<Point2>> _polypaths_do_operation(PolyBooleanOperation p_op, const Vector<Point2> &p_polypath_a, const Vector<Point2> &p_polypath_b, bool p_is_a_open = false);
static Vector<Vector<Point2>> _polypath_offset(const Vector<Point2> &p_polypath, real_t p_delta, PolyJoinType p_join_type, PolyEndType p_end_type);
};
diff --git a/core/math/geometry_3d.cpp b/core/math/geometry_3d.cpp
index 987e0c2399b..27f79298768 100644
--- a/core/math/geometry_3d.cpp
+++ b/core/math/geometry_3d.cpp
@@ -218,23 +218,23 @@ enum _CellFlags {
_CELL_PREV_FIRST = 7 << 5,
};
-static inline void _plot_face(uint8_t ***p_cell_status, int x, int y, int z, int len_x, int len_y, int len_z, const Vector3 &voxelsize, const Face3 &p_face) {
- AABB aabb(Vector3(x, y, z), Vector3(len_x, len_y, len_z));
- aabb.position = aabb.position * voxelsize;
- aabb.size = aabb.size * voxelsize;
+static inline void _plot_face(uint8_t ***p_cell_status, int p_x, int p_y, int p_z, int p_len_x, int p_len_y, int p_len_z, const Vector3 &p_voxelsize, const Face3 &p_face) {
+ AABB aabb(Vector3(p_x, p_y, p_z), Vector3(p_len_x, p_len_y, p_len_z));
+ aabb.position = aabb.position * p_voxelsize;
+ aabb.size = aabb.size * p_voxelsize;
if (!p_face.intersects_aabb(aabb)) {
return;
}
- if (len_x == 1 && len_y == 1 && len_z == 1) {
- p_cell_status[x][y][z] = _CELL_SOLID;
+ if (p_len_x == 1 && p_len_y == 1 && p_len_z == 1) {
+ p_cell_status[p_x][p_y][p_z] = _CELL_SOLID;
return;
}
- int div_x = len_x > 1 ? 2 : 1;
- int div_y = len_y > 1 ? 2 : 1;
- int div_z = len_z > 1 ? 2 : 1;
+ int div_x = p_len_x > 1 ? 2 : 1;
+ int div_y = p_len_y > 1 ? 2 : 1;
+ int div_z = p_len_z > 1 ? 2 : 1;
#define SPLIT_DIV(m_i, m_div, m_v, m_len_v, m_new_v, m_new_len_v) \
if (m_div == 1) { \
@@ -256,15 +256,15 @@ static inline void _plot_face(uint8_t ***p_cell_status, int x, int y, int z, int
int new_len_z;
for (int i = 0; i < div_x; i++) {
- SPLIT_DIV(i, div_x, x, len_x, new_x, new_len_x);
+ SPLIT_DIV(i, div_x, p_x, p_len_x, new_x, new_len_x);
for (int j = 0; j < div_y; j++) {
- SPLIT_DIV(j, div_y, y, len_y, new_y, new_len_y);
+ SPLIT_DIV(j, div_y, p_y, p_len_y, new_y, new_len_y);
for (int k = 0; k < div_z; k++) {
- SPLIT_DIV(k, div_z, z, len_z, new_z, new_len_z);
+ SPLIT_DIV(k, div_z, p_z, p_len_z, new_z, new_len_z);
- _plot_face(p_cell_status, new_x, new_y, new_z, new_len_x, new_len_y, new_len_z, voxelsize, p_face);
+ _plot_face(p_cell_status, new_x, new_y, new_z, new_len_x, new_len_y, new_len_z, p_voxelsize, p_face);
}
}
}
@@ -272,19 +272,19 @@ static inline void _plot_face(uint8_t ***p_cell_status, int x, int y, int z, int
#undef SPLIT_DIV
}
-static inline void _mark_outside(uint8_t ***p_cell_status, int x, int y, int z, int len_x, int len_y, int len_z) {
- if (p_cell_status[x][y][z] & 3) {
+static inline void _mark_outside(uint8_t ***p_cell_status, int p_x, int p_y, int p_z, int p_len_x, int p_len_y, int p_len_z) {
+ if (p_cell_status[p_x][p_y][p_z] & 3) {
return; // Nothing to do, already used and/or visited.
}
- p_cell_status[x][y][z] = _CELL_PREV_FIRST;
+ p_cell_status[p_x][p_y][p_z] = _CELL_PREV_FIRST;
while (true) {
- uint8_t &c = p_cell_status[x][y][z];
+ uint8_t &c = p_cell_status[p_x][p_y][p_z];
if ((c & _CELL_STEP_MASK) == _CELL_STEP_NONE) {
// Haven't been in here, mark as outside.
- p_cell_status[x][y][z] |= _CELL_EXTERIOR;
+ p_cell_status[p_x][p_y][p_z] |= _CELL_EXTERIOR;
}
if ((c & _CELL_STEP_MASK) != _CELL_STEP_DONE) {
@@ -299,28 +299,28 @@ static inline void _mark_outside(uint8_t ***p_cell_status, int x, int y, int z,
return;
} break;
case _CELL_PREV_Y_POS: {
- y++;
- ERR_FAIL_COND(y >= len_y);
+ p_y++;
+ ERR_FAIL_COND(p_y >= p_len_y);
} break;
case _CELL_PREV_Y_NEG: {
- y--;
- ERR_FAIL_COND(y < 0);
+ p_y--;
+ ERR_FAIL_COND(p_y < 0);
} break;
case _CELL_PREV_X_POS: {
- x++;
- ERR_FAIL_COND(x >= len_x);
+ p_x++;
+ ERR_FAIL_COND(p_x >= p_len_x);
} break;
case _CELL_PREV_X_NEG: {
- x--;
- ERR_FAIL_COND(x < 0);
+ p_x--;
+ ERR_FAIL_COND(p_x < 0);
} break;
case _CELL_PREV_Z_POS: {
- z++;
- ERR_FAIL_COND(z >= len_z);
+ p_z++;
+ ERR_FAIL_COND(p_z >= p_len_z);
} break;
case _CELL_PREV_Z_NEG: {
- z--;
- ERR_FAIL_COND(z < 0);
+ p_z--;
+ ERR_FAIL_COND(p_z < 0);
} break;
default: {
ERR_FAIL();
@@ -329,7 +329,7 @@ static inline void _mark_outside(uint8_t ***p_cell_status, int x, int y, int z,
continue;
}
- int next_x = x, next_y = y, next_z = z;
+ int next_x = p_x, next_y = p_y, next_z = p_z;
uint8_t prev = 0;
switch (c & _CELL_STEP_MASK) {
@@ -361,13 +361,13 @@ static inline void _mark_outside(uint8_t ***p_cell_status, int x, int y, int z,
ERR_FAIL();
}
- if (next_x < 0 || next_x >= len_x) {
+ if (next_x < 0 || next_x >= p_len_x) {
continue;
}
- if (next_y < 0 || next_y >= len_y) {
+ if (next_y < 0 || next_y >= p_len_y) {
continue;
}
- if (next_z < 0 || next_z >= len_z) {
+ if (next_z < 0 || next_z >= p_len_z) {
continue;
}
@@ -375,19 +375,19 @@ static inline void _mark_outside(uint8_t ***p_cell_status, int x, int y, int z,
continue;
}
- x = next_x;
- y = next_y;
- z = next_z;
- p_cell_status[x][y][z] |= prev;
+ p_x = next_x;
+ p_y = next_y;
+ p_z = next_z;
+ p_cell_status[p_x][p_y][p_z] |= prev;
}
}
-static inline void _build_faces(uint8_t ***p_cell_status, int x, int y, int z, int len_x, int len_y, int len_z, Vector<Face3> &p_faces) {
- ERR_FAIL_INDEX(x, len_x);
- ERR_FAIL_INDEX(y, len_y);
- ERR_FAIL_INDEX(z, len_z);
+static inline void _build_faces(uint8_t ***p_cell_status, int p_x, int p_y, int p_z, int p_len_x, int p_len_y, int p_len_z, Vector<Face3> &r_faces) {
+ ERR_FAIL_INDEX(p_x, p_len_x);
+ ERR_FAIL_INDEX(p_y, p_len_y);
+ ERR_FAIL_INDEX(p_z, p_len_z);
- if (p_cell_status[x][y][z] & _CELL_EXTERIOR) {
+ if (p_cell_status[p_x][p_y][p_z] & _CELL_EXTERIOR) {
return;
}
@@ -405,19 +405,19 @@ static inline void _build_faces(uint8_t ***p_cell_status, int x, int y, int z, i
for (int i = 0; i < 6; i++) {
Vector3 face_points[4];
- int disp_x = x + ((i % 3) == 0 ? ((i < 3) ? 1 : -1) : 0);
- int disp_y = y + (((i - 1) % 3) == 0 ? ((i < 3) ? 1 : -1) : 0);
- int disp_z = z + (((i - 2) % 3) == 0 ? ((i < 3) ? 1 : -1) : 0);
+ int disp_x = p_x + ((i % 3) == 0 ? ((i < 3) ? 1 : -1) : 0);
+ int disp_y = p_y + (((i - 1) % 3) == 0 ? ((i < 3) ? 1 : -1) : 0);
+ int disp_z = p_z + (((i - 2) % 3) == 0 ? ((i < 3) ? 1 : -1) : 0);
bool plot = false;
- if (disp_x < 0 || disp_x >= len_x) {
+ if (disp_x < 0 || disp_x >= p_len_x) {
plot = true;
}
- if (disp_y < 0 || disp_y >= len_y) {
+ if (disp_y < 0 || disp_y >= p_len_y) {
plot = true;
}
- if (disp_z < 0 || disp_z >= len_z) {
+ if (disp_z < 0 || disp_z >= p_len_z) {
plot = true;
}
@@ -430,16 +430,16 @@ static inline void _build_faces(uint8_t ***p_cell_status, int x, int y, int z, i
}
for (int j = 0; j < 4; j++) {
- face_points[j] = vert(indices[i][j]) + Vector3(x, y, z);
+ face_points[j] = vert(indices[i][j]) + Vector3(p_x, p_y, p_z);
}
- p_faces.push_back(
+ r_faces.push_back(
Face3(
face_points[0],
face_points[1],
face_points[2]));
- p_faces.push_back(
+ r_faces.push_back(
Face3(
face_points[2],
face_points[3],
@@ -447,7 +447,7 @@ static inline void _build_faces(uint8_t ***p_cell_status, int x, int y, int z, i
}
}
-Vector<Face3> Geometry3D::wrap_geometry(const Vector<Face3> &p_array, real_t *p_error) {
+Vector<Face3> Geometry3D::wrap_geometry(const Vector<Face3> &p_array, real_t *r_error) {
int face_count = p_array.size();
const Face3 *faces = p_array.ptr();
constexpr double min_size = 1.0;
@@ -575,8 +575,8 @@ Vector<Face3> Geometry3D::wrap_geometry(const Vector<Face3> &p_array, real_t *p_
}
memdelete_arr(cell_status);
- if (p_error) {
- *p_error = voxelsize.length();
+ if (r_error) {
+ *r_error = voxelsize.length();
}
return wrapped_faces;
@@ -863,20 +863,20 @@ Vector<Vector3> Geometry3D::compute_convex_mesh_points(const Plane *p_planes, in
#define BIG_VAL 1e20
/* dt of 1d function using squared distance */
-static void edt(float *f, int stride, int n) {
- float *d = (float *)alloca(sizeof(float) * n + sizeof(int) * n + sizeof(float) * (n + 1));
- int *v = reinterpret_cast<int *>(&(d[n]));
- float *z = reinterpret_cast<float *>(&v[n]);
+static void edt(float *p_f, int p_stride, int p_n) {
+ float *d = (float *)alloca(sizeof(float) * p_n + sizeof(int) * p_n + sizeof(float) * (p_n + 1));
+ int *v = reinterpret_cast<int *>(&(d[p_n]));
+ float *z = reinterpret_cast<float *>(&v[p_n]);
int k = 0;
v[0] = 0;
z[0] = -BIG_VAL;
z[1] = +BIG_VAL;
- for (int q = 1; q <= n - 1; q++) {
- float s = ((f[q * stride] + square(q)) - (f[v[k] * stride] + square(v[k]))) / (2 * q - 2 * v[k]);
+ for (int q = 1; q <= p_n - 1; q++) {
+ float s = ((p_f[q * p_stride] + square(q)) - (p_f[v[k] * p_stride] + square(v[k]))) / (2 * q - 2 * v[k]);
while (s <= z[k]) {
k--;
- s = ((f[q * stride] + square(q)) - (f[v[k] * stride] + square(v[k]))) / (2 * q - 2 * v[k]);
+ s = ((p_f[q * p_stride] + square(q)) - (p_f[v[k] * p_stride] + square(v[k]))) / (2 * q - 2 * v[k]);
}
k++;
v[k] = q;
@@ -886,15 +886,15 @@ static void edt(float *f, int stride, int n) {
}
k = 0;
- for (int q = 0; q <= n - 1; q++) {
+ for (int q = 0; q <= p_n - 1; q++) {
while (z[k + 1] < q) {
k++;
}
- d[q] = square(q - v[k]) + f[v[k] * stride];
+ d[q] = square(q - v[k]) + p_f[v[k] * p_stride];
}
- for (int i = 0; i < n; i++) {
- f[i * stride] = d[i];
+ for (int i = 0; i < p_n; i++) {
+ p_f[i * p_stride] = d[i];
}
}
diff --git a/core/math/geometry_3d.h b/core/math/geometry_3d.h
index ec98bd9f246..35225e258d6 100644
--- a/core/math/geometry_3d.h
+++ b/core/math/geometry_3d.h
@@ -482,23 +482,23 @@ inline bool triangle_sphere_intersection_test(const Vector3 *p_triangle, const V
}
#endif // DISABLE_DEPRECATED
-inline Vector<Vector3> clip_polygon(const Vector<Vector3> &polygon, const Plane &p_plane) {
+inline Vector<Vector3> clip_polygon(const Vector<Vector3> &p_polygon, const Plane &p_plane) {
enum LocationCache {
LOC_INSIDE = 1,
LOC_BOUNDARY = 0,
LOC_OUTSIDE = -1
};
- if (polygon.is_empty()) {
- return polygon;
+ if (p_polygon.is_empty()) {
+ return p_polygon;
}
- int *location_cache = (int *)alloca(sizeof(int) * polygon.size());
+ int *location_cache = (int *)alloca(sizeof(int) * p_polygon.size());
int inside_count = 0;
int outside_count = 0;
- for (int a = 0; a < polygon.size(); a++) {
- real_t dist = p_plane.distance_to(polygon[a]);
+ for (int a = 0; a < p_polygon.size(); a++) {
+ real_t dist = p_plane.distance_to(p_polygon[a]);
if (dist < (real_t)-CMP_POINT_IN_PLANE_EPSILON) {
location_cache[a] = LOC_INSIDE;
inside_count++;
@@ -513,20 +513,20 @@ inline Vector<Vector3> clip_polygon(const Vector<Vector3> &polygon, const Plane
}
if (outside_count == 0) {
- return polygon; // No changes.
+ return p_polygon; // No changes.
} else if (inside_count == 0) {
return Vector<Vector3>(); // Empty.
}
- long previous = polygon.size() - 1;
+ long previous = p_polygon.size() - 1;
Vector<Vector3> clipped;
- for (int index = 0; index < polygon.size(); index++) {
+ for (int index = 0; index < p_polygon.size(); index++) {
int loc = location_cache[index];
if (loc == LOC_OUTSIDE) {
if (location_cache[previous] == LOC_INSIDE) {
- const Vector3 &v1 = polygon[previous];
- const Vector3 &v2 = polygon[index];
+ const Vector3 &v1 = p_polygon[previous];
+ const Vector3 &v2 = p_polygon[index];
Vector3 segment = v1 - v2;
real_t den = p_plane.normal.dot(segment);
@@ -535,9 +535,9 @@ inline Vector<Vector3> clip_polygon(const Vector<Vector3> &polygon, const Plane
clipped.push_back(v1 + segment * dist);
}
} else {
- const Vector3 &v1 = polygon[index];
+ const Vector3 &v1 = p_polygon[index];
if ((loc == LOC_INSIDE) && (location_cache[previous] == LOC_OUTSIDE)) {
- const Vector3 &v2 = polygon[previous];
+ const Vector3 &v2 = p_polygon[previous];
Vector3 segment = v1 - v2;
real_t den = p_plane.normal.dot(segment);
real_t dist = p_plane.distance_to(v1) / den;
@@ -615,22 +615,22 @@ Vector<Vector3> compute_convex_mesh_points(const Plane *p_planes, int p_plane_co
max = x2; \
}
-_FORCE_INLINE_ bool planeBoxOverlap(Vector3 normal, real_t d, Vector3 maxbox) {
+_FORCE_INLINE_ bool planeBoxOverlap(Vector3 p_normal, real_t p_d, Vector3 p_maxbox) {
int q;
Vector3 vmin, vmax;
for (q = 0; q <= 2; q++) {
- if (normal[q] > 0.0f) {
- vmin[q] = -maxbox[q];
- vmax[q] = maxbox[q];
+ if (p_normal[q] > 0.0f) {
+ vmin[q] = -p_maxbox[q];
+ vmax[q] = p_maxbox[q];
} else {
- vmin[q] = maxbox[q];
- vmax[q] = -maxbox[q];
+ vmin[q] = p_maxbox[q];
+ vmax[q] = -p_maxbox[q];
}
}
- if (normal.dot(vmin) + d > 0.0f) {
+ if (p_normal.dot(vmin) + p_d > 0.0f) {
return false;
}
- if (normal.dot(vmax) + d >= 0.0f) {
+ if (p_normal.dot(vmax) + p_d >= 0.0f) {
return true;
}
@@ -648,7 +648,7 @@ _FORCE_INLINE_ bool planeBoxOverlap(Vector3 normal, real_t d, Vector3 maxbox) {
min = p2; \
max = p0; \
} \
- rad = fa * boxhalfsize.y + fb * boxhalfsize.z; \
+ rad = fa * p_box_half_size.y + fb * p_box_half_size.z; \
if (min > rad || max < -rad) { \
return false; \
}
@@ -663,7 +663,7 @@ _FORCE_INLINE_ bool planeBoxOverlap(Vector3 normal, real_t d, Vector3 maxbox) {
min = p1; \
max = p0; \
} \
- rad = fa * boxhalfsize.y + fb * boxhalfsize.z; \
+ rad = fa * p_box_half_size.y + fb * p_box_half_size.z; \
if (min > rad || max < -rad) { \
return false; \
}
@@ -679,7 +679,7 @@ _FORCE_INLINE_ bool planeBoxOverlap(Vector3 normal, real_t d, Vector3 maxbox) {
min = p2; \
max = p0; \
} \
- rad = fa * boxhalfsize.x + fb * boxhalfsize.z; \
+ rad = fa * p_box_half_size.x + fb * p_box_half_size.z; \
if (min > rad || max < -rad) { \
return false; \
}
@@ -694,7 +694,7 @@ _FORCE_INLINE_ bool planeBoxOverlap(Vector3 normal, real_t d, Vector3 maxbox) {
min = p1; \
max = p0; \
} \
- rad = fa * boxhalfsize.x + fb * boxhalfsize.z; \
+ rad = fa * p_box_half_size.x + fb * p_box_half_size.z; \
if (min > rad || max < -rad) { \
return false; \
}
@@ -710,7 +710,7 @@ _FORCE_INLINE_ bool planeBoxOverlap(Vector3 normal, real_t d, Vector3 maxbox) {
min = p1; \
max = p2; \
} \
- rad = fa * boxhalfsize.x + fb * boxhalfsize.y; \
+ rad = fa * p_box_half_size.x + fb * p_box_half_size.y; \
if (min > rad || max < -rad) { \
return false; \
}
@@ -725,12 +725,12 @@ _FORCE_INLINE_ bool planeBoxOverlap(Vector3 normal, real_t d, Vector3 maxbox) {
min = p1; \
max = p0; \
} \
- rad = fa * boxhalfsize.x + fb * boxhalfsize.y; \
+ rad = fa * p_box_half_size.x + fb * p_box_half_size.y; \
if (min > rad || max < -rad) { \
return false; \
}
-_FORCE_INLINE_ bool triangle_box_overlap(const Vector3 &boxcenter, const Vector3 boxhalfsize, const Vector3 *triverts) {
+_FORCE_INLINE_ bool triangle_box_overlap(const Vector3 &p_box_center, const Vector3 p_box_half_size, const Vector3 *p_triverts) {
/* use separating axis theorem to test overlap between triangle and box */
/* need to test for overlap in these directions: */
/* 1) the {x,y,z}-directions (actually, since we use the AABB of the triangle */
@@ -743,9 +743,9 @@ _FORCE_INLINE_ bool triangle_box_overlap(const Vector3 &boxcenter, const Vector3
/* This is the fastest branch on Sun */
/* move everything so that the boxcenter is in (0,0,0) */
- const Vector3 v0 = triverts[0] - boxcenter;
- const Vector3 v1 = triverts[1] - boxcenter;
- const Vector3 v2 = triverts[2] - boxcenter;
+ const Vector3 v0 = p_triverts[0] - p_box_center;
+ const Vector3 v1 = p_triverts[1] - p_box_center;
+ const Vector3 v2 = p_triverts[2] - p_box_center;
/* compute triangle edges */
const Vector3 e0 = v1 - v0; /* tri edge 0 */
@@ -783,19 +783,19 @@ _FORCE_INLINE_ bool triangle_box_overlap(const Vector3 &boxcenter, const Vector3
/* test in X-direction */
FINDMINMAX(v0.x, v1.x, v2.x, min, max);
- if (min > boxhalfsize.x || max < -boxhalfsize.x) {
+ if (min > p_box_half_size.x || max < -p_box_half_size.x) {
return false;
}
/* test in Y-direction */
FINDMINMAX(v0.y, v1.y, v2.y, min, max);
- if (min > boxhalfsize.y || max < -boxhalfsize.y) {
+ if (min > p_box_half_size.y || max < -p_box_half_size.y) {
return false;
}
/* test in Z-direction */
FINDMINMAX(v0.z, v1.z, v2.z, min, max);
- if (min > boxhalfsize.z || max < -boxhalfsize.z) {
+ if (min > p_box_half_size.z || max < -p_box_half_size.z) {
return false;
}
@@ -804,7 +804,7 @@ _FORCE_INLINE_ bool triangle_box_overlap(const Vector3 &boxcenter, const Vector3
/* compute plane equation of triangle: normal*x+d=0 */
const Vector3 normal = e0.cross(e1);
const real_t d = -normal.dot(v0); /* plane eq: normal.x+d=0 */
- return planeBoxOverlap(normal, d, boxhalfsize); /* if true, box and triangle overlaps */
+ return planeBoxOverlap(normal, d, p_box_half_size); /* if true, box and triangle overlaps */
}
Vector<uint32_t> generate_edf(const Vector<bool> &p_voxels, const Vector3i &p_size, bool p_negative);
diff --git a/core/math/math_funcs_binary.h b/core/math/math_funcs_binary.h
index f4da5097e97..1e2d9b32541 100644
--- a/core/math/math_funcs_binary.h
+++ b/core/math/math_funcs_binary.h
@@ -38,8 +38,8 @@ namespace Math {
// Returns `true` if a positive integer is a power of 2, `false` otherwise.
template <typename T>
-constexpr bool is_power_of_2(const T x) {
- return x && ((x & (x - 1)) == 0);
+constexpr bool is_power_of_2(const T p_x) {
+ return p_x && ((p_x & (p_x - 1)) == 0);
}
// Function to find the next power of 2 to an integer.
@@ -173,16 +173,16 @@ constexpr uint32_t nearest_shift(uint32_t p_number) {
// constexpr function to find the floored log2 of a number
template <typename T>
-constexpr T floor_log2(T x) {
- return x < 2 ? x : 1 + floor_log2(x >> 1);
+constexpr T floor_log2(T p_x) {
+ return p_x < 2 ? p_x : 1 + floor_log2(p_x >> 1);
}
// Get the number of bits needed to represent the number.
// IE, if you pass in 8, you will get 4.
// If you want to know how many bits are needed to store 8 values however, pass in (8 - 1).
template <typename T>
-constexpr T get_num_bits(T x) {
- return floor_log2(x);
+constexpr T get_num_bits(T p_x) {
+ return floor_log2(p_x);
}
} //namespace Math
diff --git a/core/math/random_pcg.h b/core/math/random_pcg.h
index a9eb3db67f5..a00f6e587a6 100644
--- a/core/math/random_pcg.h
+++ b/core/math/random_pcg.h
@@ -37,15 +37,15 @@
#include <cmath> // ldexp
#if defined(__GNUC__)
-#define CLZ32(x) __builtin_clz(x)
+#define CLZ32(m_x) __builtin_clz(m_x)
#elif defined(_MSC_VER)
#include <intrin.h>
-static int __bsr_clz32(uint32_t x) {
+static int __bsr_clz32(uint32_t p_x) {
unsigned long index;
- _BitScanReverse(&index, x);
+ _BitScanReverse(&index, p_x);
return 31 - index;
}
-#define CLZ32(x) __bsr_clz32(x)
+#define CLZ32(m_x) __bsr_clz32(m_x)
#endif
template <typename T>
@@ -75,8 +75,8 @@ public:
_FORCE_INLINE_ uint32_t rand() {
return pcg32_random_r(&pcg);
}
- _FORCE_INLINE_ uint32_t rand(uint32_t bounds) {
- return pcg32_boundedrand_r(&pcg, bounds);
+ _FORCE_INLINE_ uint32_t rand(uint32_t p_bounds) {
+ return pcg32_boundedrand_r(&pcg, p_bounds);
}
int64_t rand_weighted(const Vector<float> &p_weights);
diff --git a/core/math/transform_3d.h b/core/math/transform_3d.h
index 9df450b2e5b..8c7406bd10e 100644
--- a/core/math/transform_3d.h
+++ b/core/math/transform_3d.h
@@ -113,9 +113,9 @@ struct [[nodiscard]] Transform3D {
Transform3D interpolate_with(const Transform3D &p_transform, real_t p_c) const;
- _FORCE_INLINE_ Transform3D inverse_xform(const Transform3D &t) const {
- Vector3 v = t.origin - origin;
- return Transform3D(basis.transpose_xform(t.basis),
+ _FORCE_INLINE_ Transform3D inverse_xform(const Transform3D &p_transform) const {
+ Vector3 v = p_transform.origin - origin;
+ return Transform3D(basis.transpose_xform(p_transform.basis),
basis.xform(v));
}
diff --git a/core/math/triangle_mesh.h b/core/math/triangle_mesh.h
index c3c77794e76..362225f54bb 100644
--- a/core/math/triangle_mesh.h
+++ b/core/math/triangle_mesh.h
@@ -75,7 +75,7 @@ private:
}
};
- int _create_bvh(BVH *p_bvh, BVH **p_bb, int p_from, int p_size, int p_depth, int &max_depth, int &max_alloc);
+ int _create_bvh(BVH *p_bvh, BVH **p_bb, int p_from, int p_size, int p_depth, int &r_max_depth, int &r_max_alloc);
Vector<BVH> bvh;
int max_depth = 0;
diff --git a/core/math/triangulate.cpp b/core/math/triangulate.cpp
index 5923423b929..0a961a48f26 100644
--- a/core/math/triangulate.cpp
+++ b/core/math/triangulate.cpp
@@ -30,9 +30,9 @@
#include "triangulate.h"
-real_t Triangulate::get_area(const Vector<Vector2> &contour) {
- int n = contour.size();
- const Vector2 *c = &contour[0];
+real_t Triangulate::get_area(const Vector<Vector2> &p_contour) {
+ int n = p_contour.size();
+ const Vector2 *c = &p_contour[0];
real_t A = 0.0;
@@ -44,70 +44,66 @@ real_t Triangulate::get_area(const Vector<Vector2> &contour) {
/* `is_inside_triangle` decides if a point P is inside the triangle
* defined by A, B, C. */
-bool Triangulate::is_inside_triangle(real_t Ax, real_t Ay,
- real_t Bx, real_t By,
- real_t Cx, real_t Cy,
- real_t Px, real_t Py,
- bool include_edges) {
+bool Triangulate::is_inside_triangle(real_t p_ax, real_t p_ay, real_t p_bx, real_t p_by, real_t p_cx, real_t p_cy, real_t p_px, real_t p_py, bool p_include_edges) {
real_t ax, ay, bx, by, cx, cy, apx, apy, bpx, bpy, cpx, cpy;
real_t cCROSSap, bCROSScp, aCROSSbp;
- ax = Cx - Bx;
- ay = Cy - By;
- bx = Ax - Cx;
- by = Ay - Cy;
- cx = Bx - Ax;
- cy = By - Ay;
- apx = Px - Ax;
- apy = Py - Ay;
- bpx = Px - Bx;
- bpy = Py - By;
- cpx = Px - Cx;
- cpy = Py - Cy;
+ ax = p_cx - p_bx;
+ ay = p_cy - p_by;
+ bx = p_ax - p_cx;
+ by = p_ay - p_cy;
+ cx = p_bx - p_ax;
+ cy = p_by - p_ay;
+ apx = p_px - p_ax;
+ apy = p_py - p_ay;
+ bpx = p_px - p_bx;
+ bpy = p_py - p_by;
+ cpx = p_px - p_cx;
+ cpy = p_py - p_cy;
aCROSSbp = ax * bpy - ay * bpx;
cCROSSap = cx * apy - cy * apx;
bCROSScp = bx * cpy - by * cpx;
- if (include_edges) {
+ if (p_include_edges) {
return ((aCROSSbp > 0.0f) && (bCROSScp > 0.0f) && (cCROSSap > 0.0f));
} else {
return ((aCROSSbp >= 0.0f) && (bCROSScp >= 0.0f) && (cCROSSap >= 0.0f));
}
}
-bool Triangulate::snip(const Vector<Vector2> &p_contour, int u, int v, int w, int n, const Vector<int> &V, bool relaxed) {
+bool Triangulate::snip(const Vector<Vector2> &p_contour, int p_u, int p_v, int p_w, int p_n, const Vector<int> &p_values, bool p_relaxed) {
int p;
real_t Ax, Ay, Bx, By, Cx, Cy, Px, Py;
const Vector2 *contour = &p_contour[0];
- Ax = contour[V[u]].x;
- Ay = contour[V[u]].y;
+ Ax = contour[p_values[p_u]].x;
+ Ay = contour[p_values[p_u]].y;
- Bx = contour[V[v]].x;
- By = contour[V[v]].y;
+ Bx = contour[p_values[p_v]].x;
+ By = contour[p_values[p_v]].y;
- Cx = contour[V[w]].x;
- Cy = contour[V[w]].y;
+ Cx = contour[p_values[p_w]].x;
+ Cy = contour[p_values[p_w]].y;
// It can happen that the triangulation ends up with three aligned vertices to deal with.
// In this scenario, making the check below strict may reject the possibility of
// forming a last triangle with these aligned vertices, preventing the triangulation
// from completing.
// To avoid that we allow zero-area triangles if all else failed.
- float threshold = relaxed ? -CMP_EPSILON : CMP_EPSILON;
+ float threshold = p_relaxed ? -CMP_EPSILON : CMP_EPSILON;
if (threshold > (((Bx - Ax) * (Cy - Ay)) - ((By - Ay) * (Cx - Ax)))) {
return false;
}
- for (p = 0; p < n; p++) {
- if ((p == u) || (p == v) || (p == w)) {
+ for (p = 0; p < p_n; p++) {
+ if ((p == p_u) || (p == p_v) || (p == p_w)) {
continue;
}
- Px = contour[V[p]].x;
- Py = contour[V[p]].y;
- if (is_inside_triangle(Ax, Ay, Bx, By, Cx, Cy, Px, Py, relaxed)) {
+ Px = contour[p_values[p]].x;
+ Py = contour[p_values[p]].y;
+ if (is_inside_triangle(Ax, Ay, Bx, By, Cx, Cy, Px, Py, p_relaxed)) {
return false;
}
}
@@ -115,10 +111,10 @@ bool Triangulate::snip(const Vector<Vector2> &p_contour, int u, int v, int w, in
return true;
}
-bool Triangulate::triangulate(const Vector<Vector2> &contour, Vector<int> &result) {
+bool Triangulate::triangulate(const Vector<Vector2> &p_contour, Vector<int> &r_result) {
/* allocate and initialize list of Vertices in polygon */
- int n = contour.size();
+ int n = p_contour.size();
if (n < 3) {
return false;
}
@@ -128,7 +124,7 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour, Vector<int> &resul
/* we want a counter-clockwise polygon in V */
- if (0.0f < get_area(contour)) {
+ if (0.0f < get_area(p_contour)) {
for (int v = 0; v < n; v++) {
V.write[v] = v;
}
@@ -178,7 +174,7 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour, Vector<int> &resul
w = 0; /* next */
}
- if (snip(contour, u, v, w, nv, V, relaxed)) {
+ if (snip(p_contour, u, v, w, nv, V, relaxed)) {
int a, b, c, s, t;
/* true names of the vertices */
@@ -187,9 +183,9 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour, Vector<int> &resul
c = V[w];
/* output Triangle */
- result.push_back(a);
- result.push_back(b);
- result.push_back(c);
+ r_result.push_back(a);
+ r_result.push_back(b);
+ r_result.push_back(c);
/* remove v from remaining polygon */
for (s = v, t = v + 1; t < nv; s++, t++) {
diff --git a/core/math/triangulate.h b/core/math/triangulate.h
index 87cdbd4f9cf..2f4624728c1 100644
--- a/core/math/triangulate.h
+++ b/core/math/triangulate.h
@@ -41,19 +41,15 @@ class Triangulate {
public:
// triangulate a contour/polygon, places results in STL vector
// as series of triangles.
- static bool triangulate(const Vector<Vector2> &contour, Vector<int> &result);
+ static bool triangulate(const Vector<Vector2> &p_contour, Vector<int> &r_result);
// compute area of a contour/polygon
- static real_t get_area(const Vector<Vector2> &contour);
+ static real_t get_area(const Vector<Vector2> &p_contour);
// decide if point Px/Py is inside triangle defined by
// (Ax,Ay) (Bx,By) (Cx,Cy)
- static bool is_inside_triangle(real_t Ax, real_t Ay,
- real_t Bx, real_t By,
- real_t Cx, real_t Cy,
- real_t Px, real_t Py,
- bool include_edges);
+ static bool is_inside_triangle(real_t p_ax, real_t p_ay, real_t p_bx, real_t p_by, real_t p_cx, real_t p_cy, real_t p_px, real_t p_py, bool p_include_edges);
private:
- static bool snip(const Vector<Vector2> &p_contour, int u, int v, int w, int n, const Vector<int> &V, bool relaxed);
+ static bool snip(const Vector<Vector2> &p_contour, int p_u, int p_v, int p_w, int p_n, const Vector<int> &p_values, bool p_relaxed);
};
diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp
index 6aa18cab520..709e34581a0 100644
--- a/core/object/class_db.cpp
+++ b/core/object/class_db.cpp
@@ -1822,11 +1822,11 @@ void ClassDB::bind_compatibility_method_custom(const StringName &p_class, Method
_bind_method_custom(p_class, p_method, true);
}
-void ClassDB::_bind_compatibility(ClassInfo *type, MethodBind *p_method) {
- if (!type->method_map_compatibility.has(p_method->get_name())) {
- type->method_map_compatibility.insert(p_method->get_name(), LocalVector<MethodBind *>());
+void ClassDB::_bind_compatibility(ClassInfo *r_type, MethodBind *p_method) {
+ if (!r_type->method_map_compatibility.has(p_method->get_name())) {
+ r_type->method_map_compatibility.insert(p_method->get_name(), LocalVector<MethodBind *>());
}
- type->method_map_compatibility[p_method->get_name()].push_back(p_method);
+ r_type->method_map_compatibility[p_method->get_name()].push_back(p_method);
}
void ClassDB::_bind_method_custom(const StringName &p_class, MethodBind *p_method, bool p_compatibility) {
@@ -1892,11 +1892,11 @@ MethodBind *ClassDB::_bind_vararg_method(MethodBind *p_bind, const StringName &p
}
#ifdef DEBUG_ENABLED
-MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, bool p_compatibility, const MethodDefinition &method_name, const Variant **p_defs, int p_defcount) {
- StringName mdname = method_name.name;
+MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, bool p_compatibility, const MethodDefinition &p_method_name, const Variant **p_defs, int p_defcount) {
+ StringName mdname = p_method_name.name;
#else
-MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, bool p_compatibility, const char *method_name, const Variant **p_defs, int p_defcount) {
- StringName mdname = StringName(method_name);
+MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, bool p_compatibility, const char *p_method_name, const Variant **p_defs, int p_defcount) {
+ StringName mdname = StringName(p_method_name);
#endif // DEBUG_ENABLED
Locker::Lock lock(Locker::STATE_WRITE);
@@ -1924,7 +1924,7 @@ MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, bool p_
#ifdef DEBUG_ENABLED
- if (method_name.args.size() > p_bind->get_argument_count()) {
+ if (p_method_name.args.size() > p_bind->get_argument_count()) {
memdelete(p_bind);
ERR_FAIL_V_MSG(nullptr, vformat("Method definition provides more arguments than the method actually has '%s::%s'.", instance_type, mdname));
}
@@ -1934,7 +1934,7 @@ MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, bool p_
ERR_FAIL_V_MSG(nullptr, vformat("Method definition for '%s::%s' provides more default arguments than the method has arguments.", instance_type, mdname));
}
- p_bind->set_argument_names(method_name.args);
+ p_bind->set_argument_names(p_method_name.args);
if (!p_compatibility) {
type->method_order.push_back(mdname);
diff --git a/core/object/class_db.h b/core/object/class_db.h
index d038e6bceb5..359dd16f030 100644
--- a/core/object/class_db.h
+++ b/core/object/class_db.h
@@ -200,9 +200,9 @@ public:
#endif
#ifdef DEBUG_ENABLED
- static MethodBind *bind_methodfi(uint32_t p_flags, MethodBind *p_bind, bool p_compatibility, const MethodDefinition &method_name, const Variant **p_defs, int p_defcount);
+ static MethodBind *bind_methodfi(uint32_t p_flags, MethodBind *p_bind, bool p_compatibility, const MethodDefinition &p_method_name, const Variant **p_defs, int p_defcount);
#else
- static MethodBind *bind_methodfi(uint32_t p_flags, MethodBind *p_bind, bool p_compatibility, const char *method_name, const Variant **p_defs, int p_defcount);
+ static MethodBind *bind_methodfi(uint32_t p_flags, MethodBind *p_bind, bool p_compatibility, const char *p_method_name, const Variant **p_defs, int p_defcount);
#endif // DEBUG_ENABLED
static APIType current_api;
@@ -231,7 +231,7 @@ private:
// Non-locking variants of get_parent_class and is_parent_class.
static StringName _get_parent_class(const StringName &p_class);
static bool _is_parent_class(const StringName &p_class, const StringName &p_inherits);
- static void _bind_compatibility(ClassInfo *type, MethodBind *p_method);
+ static void _bind_compatibility(ClassInfo *r_type, MethodBind *p_method);
static MethodBind *_bind_vararg_method(MethodBind *p_bind, const StringName &p_name, const Vector<Variant> &p_default_args, bool p_compatibility);
static void _bind_method_custom(const StringName &p_class, MethodBind *p_method, bool p_compatibility);
diff --git a/core/object/method_info.h b/core/object/method_info.h
index e8e30dee8ce..2c71126edbb 100644
--- a/core/object/method_info.h
+++ b/core/object/method_info.h
@@ -74,16 +74,16 @@ struct MethodInfo {
MethodInfo() {}
- explicit MethodInfo(const GDExtensionMethodInfo &pinfo) :
- name(*reinterpret_cast<StringName *>(pinfo.name)),
- return_val(PropertyInfo(pinfo.return_value)),
- flags(pinfo.flags),
- id(pinfo.id) {
- for (uint32_t i = 0; i < pinfo.argument_count; i++) {
- arguments.push_back(PropertyInfo(pinfo.arguments[i]));
+ explicit MethodInfo(const GDExtensionMethodInfo &p_info) :
+ name(*reinterpret_cast<StringName *>(p_info.name)),
+ return_val(PropertyInfo(p_info.return_value)),
+ flags(p_info.flags),
+ id(p_info.id) {
+ for (uint32_t i = 0; i < p_info.argument_count; i++) {
+ arguments.push_back(PropertyInfo(p_info.arguments[i]));
}
- const Variant *def_values = (const Variant *)pinfo.default_arguments;
- for (uint32_t j = 0; j < pinfo.default_argument_count; j++) {
+ const Variant *def_values = (const Variant *)p_info.default_arguments;
+ for (uint32_t j = 0; j < p_info.default_argument_count; j++) {
default_arguments.push_back(def_values[j]);
}
}
@@ -96,16 +96,16 @@ struct MethodInfo {
arguments = Vector<PropertyInfo>{ p_params... };
}
- MethodInfo(Variant::Type ret) { return_val.type = ret; }
- MethodInfo(Variant::Type ret, const String &p_name) {
- return_val.type = ret;
+ MethodInfo(Variant::Type p_ret) { return_val.type = p_ret; }
+ MethodInfo(Variant::Type p_ret, const String &p_name) {
+ return_val.type = p_ret;
name = p_name;
}
template <typename... VarArgs>
- MethodInfo(Variant::Type ret, const String &p_name, VarArgs... p_params) {
+ MethodInfo(Variant::Type p_ret, const String &p_name, VarArgs... p_params) {
name = p_name;
- return_val.type = ret;
+ return_val.type = p_ret;
arguments = Vector<PropertyInfo>{ p_params... };
}
diff --git a/core/object/property_info.h b/core/object/property_info.h
index 19a44075bce..c672fab04ef 100644
--- a/core/object/property_info.h
+++ b/core/object/property_info.h
@@ -160,13 +160,13 @@ struct PropertyInfo {
type(Variant::OBJECT),
class_name(p_class_name) {}
- explicit PropertyInfo(const GDExtensionPropertyInfo &pinfo) :
- type((Variant::Type)pinfo.type),
- name(*reinterpret_cast<StringName *>(pinfo.name)),
- class_name(*reinterpret_cast<StringName *>(pinfo.class_name)),
- hint((PropertyHint)pinfo.hint),
- hint_string(*reinterpret_cast<String *>(pinfo.hint_string)),
- usage(pinfo.usage) {}
+ explicit PropertyInfo(const GDExtensionPropertyInfo &p_info) :
+ type((Variant::Type)p_info.type),
+ name(*reinterpret_cast<StringName *>(p_info.name)),
+ class_name(*reinterpret_cast<StringName *>(p_info.class_name)),
+ hint((PropertyHint)p_info.hint),
+ hint_string(*reinterpret_cast<String *>(p_info.hint_string)),
+ usage(p_info.usage) {}
bool operator==(const PropertyInfo &p_info) const {
return ((type == p_info.type) &&
diff --git a/core/object/script_instance.cpp b/core/object/script_instance.cpp
index 7a6e8c02041..f689b63d72d 100644
--- a/core/object/script_instance.cpp
+++ b/core/object/script_instance.cpp
@@ -58,7 +58,7 @@ Variant ScriptInstance::call_const(const StringName &p_method, const Variant **p
return callp(p_method, p_args, p_argcount, r_error);
}
-void ScriptInstance::get_property_state(List<Pair<StringName, Variant>> &state) {
+void ScriptInstance::get_property_state(List<Pair<StringName, Variant>> &r_state) {
List<PropertyInfo> pinfo;
get_property_list(&pinfo);
for (const PropertyInfo &E : pinfo) {
@@ -66,7 +66,7 @@ void ScriptInstance::get_property_state(List<Pair<StringName, Variant>> &state)
Pair<StringName, Variant> p;
p.first = E.name;
if (get(p.first, p.second)) {
- state.push_back(p);
+ r_state.push_back(p);
}
}
}
diff --git a/core/object/script_instance.h b/core/object/script_instance.h
index a3b64d8cdef..eebf3bf85f6 100644
--- a/core/object/script_instance.h
+++ b/core/object/script_instance.h
@@ -47,7 +47,7 @@ public:
virtual bool property_get_revert(const StringName &p_name, Variant &r_ret) const = 0;
virtual Object *get_owner() { return nullptr; }
- virtual void get_property_state(List<Pair<StringName, Variant>> &state);
+ virtual void get_property_state(List<Pair<StringName, Variant>> &r_state);
virtual void get_method_list(List<MethodInfo> *p_list) const = 0;
virtual bool has_method(const StringName &p_method) const = 0;
diff --git a/core/object/script_language_extension.h b/core/object/script_language_extension.h
index 74468866593..1e35cf38058 100644
--- a/core/object/script_language_extension.h
+++ b/core/object/script_language_extension.h
@@ -861,12 +861,12 @@ public:
List<Pair<StringName, Variant>> *state = (List<Pair<StringName, Variant>> *)p_userdata;
state->push_back(Pair<StringName, Variant>(*(const StringName *)p_name, *(const Variant *)p_value));
}
- virtual void get_property_state(List<Pair<StringName, Variant>> &state) override {
+ virtual void get_property_state(List<Pair<StringName, Variant>> &r_state) override {
if (native_info->get_property_state_func) {
- native_info->get_property_state_func(instance, _add_property_with_state, &state);
+ native_info->get_property_state_func(instance, _add_property_with_state, &r_state);
return;
}
- ScriptInstance::get_property_state(state);
+ ScriptInstance::get_property_state(r_state);
}
virtual void get_method_list(List<MethodInfo> *p_list) const override {
diff --git a/core/object/undo_redo.cpp b/core/object/undo_redo.cpp
index 29963b47807..e6c5582ce62 100644
--- a/core/object/undo_redo.cpp
+++ b/core/object/undo_redo.cpp
@@ -345,14 +345,14 @@ void UndoRedo::commit_action(bool p_execute) {
}
}
-void UndoRedo::_process_operation_list(List<Operation>::Element *E, bool p_execute) {
+void UndoRedo::_process_operation_list(List<Operation>::Element *r_elements, bool p_execute) {
const int PREALLOCATE_ARGS_COUNT = 16;
LocalVector<const Variant *> args;
args.reserve(PREALLOCATE_ARGS_COUNT);
- for (; E; E = E->next()) {
- Operation &op = E->get();
+ for (; r_elements; r_elements = r_elements->next()) {
+ Operation &op = r_elements->get();
Object *obj = ObjectDB::get_instance(op.object);
if (!obj) { //may have been deleted and this is fine
diff --git a/core/object/undo_redo.h b/core/object/undo_redo.h
index 4359db4d0ee..3717f6035cc 100644
--- a/core/object/undo_redo.h
+++ b/core/object/undo_redo.h
@@ -86,7 +86,7 @@ private:
int merge_total = 0;
void _pop_history_tail();
- void _process_operation_list(List<Operation>::Element *E, bool p_execute);
+ void _process_operation_list(List<Operation>::Element *r_elements, bool p_execute);
void _discard_redo();
bool _redo(bool p_execute);
diff --git a/core/object/worker_thread_pool.h b/core/object/worker_thread_pool.h
index 808be67a261..008d3b481fd 100644
--- a/core/object/worker_thread_pool.h
+++ b/core/object/worker_thread_pool.h
@@ -176,7 +176,7 @@ private:
static void _thread_function(void *p_user);
- void _process_task(Task *task);
+ void _process_task(Task *p_task);
void _post_tasks(Task **p_tasks, uint32_t p_count, bool p_high_priority, MutexLock<BinaryMutex> &p_lock, bool p_pump_task);
void _notify_threads(const ThreadData *p_current_thread_data, uint32_t p_process_count, uint32_t p_promote_count);
diff --git a/core/os/keyboard.h b/core/os/keyboard.h
index 8c64522abb4..6b03a018d2f 100644
--- a/core/os/keyboard.h
+++ b/core/os/keyboard.h
@@ -269,72 +269,72 @@ enum class KeyLocation {
// To avoid having unnecessary operators, only define the ones that are needed.
-constexpr Key operator-(uint32_t a, Key b) {
- return (Key)(a - (uint32_t)b);
+constexpr Key operator-(uint32_t p_left, Key p_right) {
+ return (Key)(p_left - (uint32_t)p_right);
}
-constexpr Key &operator-=(Key &a, int b) {
- a = static_cast<Key>(static_cast<int>(a) - static_cast<int>(b));
- return a;
+constexpr Key &operator-=(Key &p_left, int p_right) {
+ p_left = static_cast<Key>(static_cast<int>(p_left) - static_cast<int>(p_right));
+ return p_left;
}
-constexpr Key operator+(Key a, int b) {
- return (Key)((int)a + (int)b);
+constexpr Key operator+(Key p_left, int p_right) {
+ return (Key)((int)p_left + (int)p_right);
}
-constexpr Key operator+(Key a, Key b) {
- return (Key)((int)a + (int)b);
+constexpr Key operator+(Key p_left, Key p_right) {
+ return (Key)((int)p_left + (int)p_right);
}
-constexpr Key operator-(Key a, Key b) {
- return (Key)((int)a - (int)b);
+constexpr Key operator-(Key p_left, Key p_right) {
+ return (Key)((int)p_left - (int)p_right);
}
-constexpr Key operator&(Key a, Key b) {
- return (Key)((int)a & (int)b);
+constexpr Key operator&(Key p_left, Key p_right) {
+ return (Key)((int)p_left & (int)p_right);
}
-constexpr Key operator|(Key a, Key b) {
- return (Key)((int)a | (int)b);
+constexpr Key operator|(Key p_left, Key p_right) {
+ return (Key)((int)p_left | (int)p_right);
}
-constexpr Key &operator|=(Key &a, Key b) {
- a = static_cast<Key>(static_cast<int>(a) | static_cast<int>(b));
- return a;
+constexpr Key &operator|=(Key &p_left, Key p_right) {
+ p_left = static_cast<Key>(static_cast<int>(p_left) | static_cast<int>(p_right));
+ return p_left;
}
-constexpr Key &operator|=(Key &a, KeyModifierMask b) {
- a = static_cast<Key>(static_cast<int>(a) | static_cast<int>(b));
- return a;
+constexpr Key &operator|=(Key &p_left, KeyModifierMask p_right) {
+ p_left = static_cast<Key>(static_cast<int>(p_left) | static_cast<int>(p_right));
+ return p_left;
}
-constexpr Key &operator&=(Key &a, KeyModifierMask b) {
- a = static_cast<Key>(static_cast<int>(a) & static_cast<int>(b));
- return a;
+constexpr Key &operator&=(Key &p_left, KeyModifierMask p_right) {
+ p_left = static_cast<Key>(static_cast<int>(p_left) & static_cast<int>(p_right));
+ return p_left;
}
-constexpr Key operator|(Key a, KeyModifierMask b) {
- return (Key)((int)a | (int)b);
+constexpr Key operator|(Key p_left, KeyModifierMask p_right) {
+ return (Key)((int)p_left | (int)p_right);
}
-constexpr Key operator&(Key a, KeyModifierMask b) {
- return (Key)((int)a & (int)b);
+constexpr Key operator&(Key p_left, KeyModifierMask p_right) {
+ return (Key)((int)p_left & (int)p_right);
}
-constexpr Key operator+(KeyModifierMask a, Key b) {
- return (Key)((int)a + (int)b);
+constexpr Key operator+(KeyModifierMask p_left, Key p_right) {
+ return (Key)((int)p_left + (int)p_right);
}
-constexpr Key operator|(KeyModifierMask a, Key b) {
- return (Key)((int)a | (int)b);
+constexpr Key operator|(KeyModifierMask p_left, Key p_right) {
+ return (Key)((int)p_left | (int)p_right);
}
-constexpr KeyModifierMask operator+(KeyModifierMask a, KeyModifierMask b) {
- return (KeyModifierMask)((int)a + (int)b);
+constexpr KeyModifierMask operator+(KeyModifierMask p_left, KeyModifierMask p_right) {
+ return (KeyModifierMask)((int)p_left + (int)p_right);
}
-constexpr KeyModifierMask operator|(KeyModifierMask a, KeyModifierMask b) {
- return (KeyModifierMask)((int)a | (int)b);
+constexpr KeyModifierMask operator|(KeyModifierMask p_left, KeyModifierMask p_right) {
+ return (KeyModifierMask)((int)p_left | (int)p_right);
}
String keycode_get_string(Key p_code);
diff --git a/core/os/os.h b/core/os/os.h
index c523c9dd8b8..0a8342fae92 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -121,7 +121,7 @@ protected:
friend class Main;
// Needed by tests to setup command-line args.
- friend int test_main(int argc, char *argv[]);
+ friend int test_main(int p_argc, char *p_argv[]);
HasServerFeatureCallback has_server_feature_callback = nullptr;
bool _separate_thread_render = false;
@@ -212,7 +212,7 @@ public:
virtual String get_system_font_path(const String &p_font_name, int p_weight = 400, int p_stretch = 100, bool p_italic = false) const { return String(); }
virtual Vector<String> get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale = String(), const String &p_script = String(), int p_weight = 400, int p_stretch = 100, bool p_italic = false) const { return Vector<String>(); }
virtual String get_executable_path() const;
- virtual Error execute(const String &p_path, const List<String> &p_arguments, String *r_pipe = nullptr, int *r_exitcode = nullptr, bool read_stderr = false, Mutex *p_pipe_mutex = nullptr, bool p_open_console = false) = 0;
+ virtual Error execute(const String &p_path, const List<String> &p_arguments, String *r_pipe = nullptr, int *r_exitcode = nullptr, bool p_read_stderr = false, Mutex *p_pipe_mutex = nullptr, bool p_open_console = false) = 0;
virtual Dictionary execute_with_pipe(const String &p_path, const List<String> &p_arguments, bool p_blocking = true) { return Dictionary(); }
virtual Error create_process(const String &p_path, const List<String> &p_arguments, ProcessID *r_child_id = nullptr, bool p_open_console = false) = 0;
virtual Error create_instance(const List<String> &p_arguments, ProcessID *r_child_id = nullptr) { return create_process(get_executable_path(), p_arguments, r_child_id); }
@@ -270,7 +270,7 @@ public:
String name;
};
- virtual DateTime get_datetime(bool utc = false) const = 0;
+ virtual DateTime get_datetime(bool p_utc = false) const = 0;
virtual TimeZoneInfo get_time_zone_info() const = 0;
virtual double get_unix_time() const;
diff --git a/core/string/fuzzy_search.cpp b/core/string/fuzzy_search.cpp
index a55f14df82c..f45e190b21d 100644
--- a/core/string/fuzzy_search.cpp
+++ b/core/string/fuzzy_search.cpp
@@ -270,11 +270,11 @@ Vector<FuzzySearchToken> FuzzySearch::_get_tokens(const String &p_query) const {
}
struct TokenComparator {
- bool operator()(const FuzzySearchToken &A, const FuzzySearchToken &B) const {
- if (A.string.length() == B.string.length()) {
- return A.idx < B.idx;
+ bool operator()(const FuzzySearchToken &p_left, const FuzzySearchToken &p_right) const {
+ if (p_left.string.length() == p_right.string.length()) {
+ return p_left.idx < p_right.idx;
}
- return A.string.length() > B.string.length();
+ return p_left.string.length() > p_right.string.length();
}
};
diff --git a/core/string/optimized_translation.h b/core/string/optimized_translation.h
index 546823b1c8b..25d5cd45845 100644
--- a/core/string/optimized_translation.h
+++ b/core/string/optimized_translation.h
@@ -71,16 +71,16 @@ class OptimizedTranslation : public Translation {
Elem elem[1];
};
- _FORCE_INLINE_ uint32_t hash(uint32_t d, const char *p_str) const {
- if (d == 0) {
- d = 0x1000193;
+ _FORCE_INLINE_ uint32_t hash(uint32_t p_d, const char *p_str) const {
+ if (p_d == 0) {
+ p_d = 0x1000193;
}
while (*p_str) {
- d = (d * 0x1000193) ^ static_cast<uint8_t>(*p_str);
+ p_d = (p_d * 0x1000193) ^ static_cast<uint8_t>(*p_str);
p_str++;
}
- return d;
+ return p_d;
}
virtual Vector<String> _get_message_list() const override;
diff --git a/core/string/string_name.h b/core/string/string_name.h
index bf59b0d8043..f3f07a903a4 100644
--- a/core/string/string_name.h
+++ b/core/string/string_name.h
@@ -136,20 +136,20 @@ public:
struct AlphCompare {
template <typename LT, typename RT>
- _FORCE_INLINE_ bool operator()(const LT &l, const RT &r) const {
- return compare(l, r);
+ _FORCE_INLINE_ bool operator()(const LT &p_left, const RT &p_right) const {
+ return compare(p_left, p_right);
}
- _FORCE_INLINE_ static bool compare(const StringName &l, const StringName &r) {
- return str_compare(l.get_data(), r.get_data()) < 0;
+ _FORCE_INLINE_ static bool compare(const StringName &p_left, const StringName &p_right) {
+ return str_compare(p_left.get_data(), p_right.get_data()) < 0;
}
- _FORCE_INLINE_ static bool compare(const String &l, const StringName &r) {
- return str_compare(l.get_data(), r.get_data()) < 0;
+ _FORCE_INLINE_ static bool compare(const String &p_left, const StringName &p_right) {
+ return str_compare(p_left.get_data(), p_right.get_data()) < 0;
}
- _FORCE_INLINE_ static bool compare(const StringName &l, const String &r) {
- return str_compare(l.get_data(), r.get_data()) < 0;
+ _FORCE_INLINE_ static bool compare(const StringName &p_left, const String &p_right) {
+ return str_compare(p_left.get_data(), p_right.get_data()) < 0;
}
- _FORCE_INLINE_ static bool compare(const String &l, const String &r) {
- return str_compare(l.get_data(), r.get_data()) < 0;
+ _FORCE_INLINE_ static bool compare(const String &p_left, const String &p_right) {
+ return str_compare(p_left.get_data(), p_right.get_data()) < 0;
}
};
diff --git a/core/string/ucaps.h b/core/string/ucaps.h
index 43443747639..7939c52b7bf 100644
--- a/core/string/ucaps.h
+++ b/core/string/ucaps.h
@@ -3034,7 +3034,7 @@ static const int reverse_caps_table[UTL_LEN][2] = {
{ 0x1E921, 0x1E943 },
};
-inline int _find_upper(int ch) {
+inline int _find_upper(int p_ch) {
int low = 0;
int high = LTU_LEN - 1;
int middle;
@@ -3042,19 +3042,19 @@ inline int _find_upper(int ch) {
while (low <= high) {
middle = (low + high) / 2;
- if (ch < caps_table[middle][0]) {
+ if (p_ch < caps_table[middle][0]) {
high = middle - 1; // Search low end of array.
- } else if (caps_table[middle][0] < ch) {
+ } else if (caps_table[middle][0] < p_ch) {
low = middle + 1; // Search high end of array.
} else {
return caps_table[middle][1];
}
}
- return ch;
+ return p_ch;
}
-inline int _find_lower(int ch) {
+inline int _find_lower(int p_ch) {
int low = 0;
int high = UTL_LEN - 1;
int middle;
@@ -3062,14 +3062,14 @@ inline int _find_lower(int ch) {
while (low <= high) {
middle = (low + high) / 2;
- if (ch < reverse_caps_table[middle][0]) {
+ if (p_ch < reverse_caps_table[middle][0]) {
high = middle - 1; // Search low end of array.
- } else if (reverse_caps_table[middle][0] < ch) {
+ } else if (reverse_caps_table[middle][0] < p_ch) {
low = middle + 1; // Search high end of array.
} else {
return reverse_caps_table[middle][1];
}
}
- return ch;
+ return p_ch;
}
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp
index a303375cdbb..85e9f821fad 100644
--- a/core/string/ustring.cpp
+++ b/core/string/ustring.cpp
@@ -61,8 +61,8 @@ STATIC_ASSERT_INCOMPLETE_TYPE(class, Object);
static const int MAX_DECIMALS = 32;
-static _FORCE_INLINE_ char32_t lower_case(char32_t c) {
- return (is_ascii_upper_case(c) ? (c + ('a' - 'A')) : c);
+static _FORCE_INLINE_ char32_t lower_case(char32_t p_char) {
+ return (is_ascii_upper_case(p_char) ? (p_char + ('a' - 'A')) : p_char);
}
// Case-insensitive version of are_spans_equal
@@ -1316,17 +1316,17 @@ Vector<int> String::split_ints_mk(const Vector<String> &p_splitters, bool p_allo
return ret;
}
-String String::join(const Vector<String> &parts) const {
- if (parts.is_empty()) {
+String String::join(const Vector<String> &p_parts) const {
+ if (p_parts.is_empty()) {
return String();
- } else if (parts.size() == 1) {
- return parts[0];
+ } else if (p_parts.size() == 1) {
+ return p_parts[0];
}
const int this_length = length();
- int new_size = (parts.size() - 1) * this_length;
- for (const String &part : parts) {
+ int new_size = (p_parts.size() - 1) * this_length;
+ for (const String &part : p_parts) {
new_size += part.length();
}
new_size += 1;
@@ -1337,7 +1337,7 @@ String String::join(const Vector<String> &parts) const {
const char32_t *this_ptr = ptr();
bool first = true;
- for (const String &part : parts) {
+ for (const String &part : p_parts) {
if (first) {
first = false;
} else if (this_length) {
@@ -1499,8 +1499,8 @@ String String::num(double p_num, int p_decimals) {
return buf;
}
-String String::num_int64(int64_t p_num, int base, bool capitalize_hex) {
- ERR_FAIL_COND_V_MSG(base < 2 || base > 36, "", "Cannot convert to base " + itos(base) + ", since the value is " + (base < 2 ? "less than 2." : "greater than 36."));
+String String::num_int64(int64_t p_num, int p_base, bool p_capitalize_hex) {
+ ERR_FAIL_COND_V_MSG(p_base < 2 || p_base > 36, "", "Cannot convert to base " + itos(p_base) + ", since the value is " + (p_base < 2 ? "less than 2." : "greater than 36."));
bool sign = p_num < 0;
@@ -1508,7 +1508,7 @@ String String::num_int64(int64_t p_num, int base, bool capitalize_hex) {
int chars = 0;
do {
- n /= base;
+ n /= p_base;
chars++;
} while (n);
@@ -1521,15 +1521,15 @@ String String::num_int64(int64_t p_num, int base, bool capitalize_hex) {
c[chars] = 0;
n = p_num;
do {
- int mod = Math::abs(n % base);
+ int mod = Math::abs(n % p_base);
if (mod >= 10) {
- char a = (capitalize_hex ? 'A' : 'a');
+ char a = (p_capitalize_hex ? 'A' : 'a');
c[--chars] = a + (mod - 10);
} else {
c[--chars] = '0' + mod;
}
- n /= base;
+ n /= p_base;
} while (n);
if (sign) {
@@ -1539,14 +1539,14 @@ String String::num_int64(int64_t p_num, int base, bool capitalize_hex) {
return s;
}
-String String::num_uint64(uint64_t p_num, int base, bool capitalize_hex) {
- ERR_FAIL_COND_V_MSG(base < 2 || base > 36, "", "Cannot convert to base " + itos(base) + ", since the value is " + (base < 2 ? "less than 2." : "greater than 36."));
+String String::num_uint64(uint64_t p_num, int p_base, bool p_capitalize_hex) {
+ ERR_FAIL_COND_V_MSG(p_base < 2 || p_base > 36, "", "Cannot convert to base " + itos(p_base) + ", since the value is " + (p_base < 2 ? "less than 2." : "greater than 36."));
uint64_t n = p_num;
int chars = 0;
do {
- n /= base;
+ n /= p_base;
chars++;
} while (n);
@@ -1556,15 +1556,15 @@ String String::num_uint64(uint64_t p_num, int base, bool capitalize_hex) {
c[chars] = 0;
n = p_num;
do {
- int mod = n % base;
+ int mod = n % p_base;
if (mod >= 10) {
- char a = (capitalize_hex ? 'A' : 'a');
+ char a = (p_capitalize_hex ? 'A' : 'a');
c[--chars] = a + (mod - 10);
} else {
c[--chars] = '0' + mod;
}
- n /= base;
+ n /= p_base;
} while (n);
return s;
@@ -2262,7 +2262,7 @@ int64_t String::bin_to_int() const {
}
template <typename C, typename T>
-_ALWAYS_INLINE_ int64_t _to_int(const T &p_in, int to) {
+_ALWAYS_INLINE_ int64_t _to_int(const T &p_in, int p_to) {
// Accumulate the total number in an unsigned integer as the range is:
// +9223372036854775807 to -9223372036854775808 and the smallest negative
// number does not fit inside an int64_t. So we accumulate the positive
@@ -2272,7 +2272,7 @@ _ALWAYS_INLINE_ int64_t _to_int(const T &p_in, int to) {
uint8_t digits = 0;
bool positive = true;
- for (int i = 0; i < to; i++) {
+ for (int i = 0; i < p_to; i++) {
C c = p_in[i];
if (is_digit(c)) {
// No need to do expensive checks unless we're approaching INT64_MAX / INT64_MIN.
@@ -2371,10 +2371,10 @@ static double built_in_strtod(
* necessary unless F is present. The "E" may
* actually be an "e". E and X may both be
* omitted (but not just one). */
- const C *string,
+ const C *p_string,
/* If non-nullptr, store terminating Cacter's
* address here. */
- C **endPtr = nullptr) {
+ C **r_end = nullptr) {
/* Largest possible base 10 exponent. Any
* exponent larger than this will already
* produce underflow or overflow, so there's
@@ -2423,7 +2423,7 @@ static double built_in_strtod(
* Strip off leading blanks and check for a sign.
*/
- p = string;
+ p = p_string;
while (*p == ' ' || *p == '\t' || *p == '\n') {
p += 1;
}
@@ -2476,7 +2476,7 @@ static double built_in_strtod(
}
if (mantSize == 0) {
fraction = 0.0;
- p = string;
+ p = p_string;
goto done;
} else {
int frac1, frac2;
@@ -2565,8 +2565,8 @@ static double built_in_strtod(
}
done:
- if (endPtr != nullptr) {
- *endPtr = (C *)p;
+ if (r_end != nullptr) {
+ *r_end = (C *)p;
}
if (sign) {
@@ -3439,7 +3439,7 @@ int String::countn(const char *p_string, int p_from, int p_to) const {
return _count(p_string, p_from, p_to, true);
}
-bool String::_base_is_subsequence_of(const String &p_string, bool case_insensitive) const {
+bool String::_base_is_subsequence_of(const String &p_string, bool p_case_insensitive) const {
int len = length();
if (len == 0) {
// Technically an empty string is subsequence of any string
@@ -3455,7 +3455,7 @@ bool String::_base_is_subsequence_of(const String &p_string, bool case_insensiti
for (; *src && *tgt; tgt++) {
bool match = false;
- if (case_insensitive) {
+ if (p_case_insensitive) {
char32_t srcc = _find_lower(*src);
char32_t tgtc = _find_lower(*tgt);
match = srcc == tgtc;
@@ -3547,11 +3547,11 @@ bool String::matchn(const String &p_wildcard) const {
return _wildcard_match(p_wildcard.get_data(), get_data(), false);
}
-String String::format(const Variant &values, const String &placeholder) const {
+String String::format(const Variant &p_values, const String &p_placeholder) const {
String new_string = *this;
- if (values.get_type() == Variant::ARRAY) {
- Array values_arr = values;
+ if (p_values.get_type() == Variant::ARRAY) {
+ Array values_arr = p_values;
for (int i = 0; i < values_arr.size(); i++) {
if (values_arr[i].get_type() == Variant::ARRAY) { //Array in Array structure [["name","RobotGuy"],[0,"godot"],["strength",9000.91]]
@@ -3561,35 +3561,35 @@ String String::format(const Variant &values, const String &placeholder) const {
String key = value_arr[0];
String val = value_arr[1];
- new_string = new_string.replace(placeholder.replace("_", key), val);
+ new_string = new_string.replace(p_placeholder.replace("_", key), val);
} else {
ERR_PRINT(vformat("Invalid format: the inner Array at index %d needs to contain only 2 elements, as a key-value pair.", i).ascii().get_data());
}
} else { //Array structure ["RobotGuy","Logis","rookie"]
String val = values_arr[i];
- if (placeholder.contains_char('_')) {
- new_string = new_string.replace(placeholder.replace("_", String::num_int64(i)), val);
+ if (p_placeholder.contains_char('_')) {
+ new_string = new_string.replace(p_placeholder.replace("_", String::num_int64(i)), val);
} else {
- new_string = new_string.replace_first(placeholder, val);
+ new_string = new_string.replace_first(p_placeholder, val);
}
}
}
- } else if (values.get_type() == Variant::DICTIONARY) {
- Dictionary d = values;
+ } else if (p_values.get_type() == Variant::DICTIONARY) {
+ Dictionary d = p_values;
for (const KeyValue<Variant, Variant> &kv : d) {
- new_string = new_string.replace(placeholder.replace("_", kv.key), kv.value);
+ new_string = new_string.replace(p_placeholder.replace("_", kv.key), kv.value);
}
- } else if (values.get_type() == Variant::OBJECT) {
- Object *obj = values.get_validated_object();
+ } else if (p_values.get_type() == Variant::OBJECT) {
+ Object *obj = p_values.get_validated_object();
ERR_FAIL_NULL_V(obj, new_string);
List<PropertyInfo> props;
obj->get_property_list(&props);
for (const PropertyInfo &E : props) {
- new_string = new_string.replace(placeholder.replace("_", E.name), obj->get(E.name));
+ new_string = new_string.replace(p_placeholder.replace("_", E.name), obj->get(E.name));
}
} else {
ERR_PRINT(String("Invalid type: use Array, Dictionary or Object.").ascii().get_data());
@@ -4064,11 +4064,11 @@ String String::dedent() const {
return new_string;
}
-String String::strip_edges(bool left, bool right) const {
+String String::strip_edges(bool p_left, bool p_right) const {
int len = length();
int beg = 0, end = len;
- if (left) {
+ if (p_left) {
for (int i = 0; i < len; i++) {
if (operator[](i) <= 32) {
beg++;
@@ -4078,7 +4078,7 @@ String String::strip_edges(bool left, bool right) const {
}
}
- if (right) {
+ if (p_right) {
for (int i = len - 1; i >= 0; i--) {
if (operator[](i) <= 32) {
end--;
@@ -5156,21 +5156,21 @@ String rtoss(double p_val) {
}
// Right-pad with a character.
-String String::rpad(int min_length, const String &character) const {
+String String::rpad(int p_min_length, const String &p_character) const {
String s = *this;
- int padding = min_length - s.length();
+ int padding = p_min_length - s.length();
if (padding > 0) {
- s += character.repeat(padding);
+ s += p_character.repeat(padding);
}
return s;
}
// Left-pad with a character.
-String String::lpad(int min_length, const String &character) const {
+String String::lpad(int p_min_length, const String &p_character) const {
String s = *this;
- int padding = min_length - s.length();
+ int padding = p_min_length - s.length();
if (padding > 0) {
- s = character.repeat(padding) + s;
+ s = p_character.repeat(padding) + s;
}
return s;
}
@@ -5179,14 +5179,14 @@ String String::lpad(int min_length, const String &character) const {
// "fish %s pie" % "frog"
// "fish %s %d pie" % ["frog", 12]
// In case of an error, the string returned is the error description and "error" is true.
-String String::sprintf(const Span<Variant> &values, bool *error) const {
+String String::sprintf(const Span<Variant> &p_values, bool *r_error) const {
static const String ZERO("0");
static const String SPACE(" ");
static const String MINUS("-");
static const String PLUS("+");
LocalVector<bool> used_args;
- used_args.resize_initialized(values.size());
+ used_args.resize_initialized(p_values.size());
String formatted;
char32_t *self = (char32_t *)get_data();
bool in_format = false;
@@ -5200,8 +5200,8 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
bool show_sign = false;
bool as_unsigned = false;
- if (error) {
- *error = true;
+ if (r_error) {
+ *r_error = true;
}
for (; *self; self++) {
@@ -5219,15 +5219,15 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
case 'x': // Hexadecimal (lowercase)
case 'X': { // Hexadecimal (uppercase)
uint64_t index = (selected_index >= 0 ? selected_index : value_index);
- if (index >= values.size()) {
+ if (index >= p_values.size()) {
return "not enough arguments for format string";
}
- if (!values[index].is_num()) {
+ if (!p_values[index].is_num()) {
return "a number is required";
}
- int64_t value = values[index];
+ int64_t value = p_values[index];
int base = 16;
bool capitalize = false;
switch (c) {
@@ -5293,15 +5293,15 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
}
case 'f': { // Float
uint64_t index = (selected_index >= 0 ? selected_index : value_index);
- if (index >= values.size()) {
+ if (index >= p_values.size()) {
return "not enough arguments for format string";
}
- if (!values[index].is_num()) {
+ if (!p_values[index].is_num()) {
return "a number is required";
}
- double value = values[index];
+ double value = p_values[index];
bool is_negative = std::signbit(value);
String str = String::num(Math::abs(value), min_decimals);
const bool is_finite = Math::is_finite(value);
@@ -5342,12 +5342,12 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
}
case 'v': { // Vector2/3/4/2i/3i/4i
uint64_t index = (selected_index >= 0 ? selected_index : value_index);
- if (index >= values.size()) {
+ if (index >= p_values.size()) {
return "not enough arguments for format string";
}
int count;
- switch (values[index].get_type()) {
+ switch (p_values[index].get_type()) {
case Variant::VECTOR2:
case Variant::VECTOR2I: {
count = 2;
@@ -5365,7 +5365,7 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
}
}
- Vector4 vec = values[index];
+ Vector4 vec = p_values[index];
String str = "(";
for (int i = 0; i < count; i++) {
double val = vec[i];
@@ -5416,11 +5416,11 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
}
case 's': { // String
uint64_t index = (selected_index >= 0 ? selected_index : value_index);
- if (index >= values.size()) {
+ if (index >= p_values.size()) {
return "not enough arguments for format string";
}
- String str = values[index];
+ String str = p_values[index];
// Padding.
if (left_justified) {
str = str.rpad(min_chars);
@@ -5438,14 +5438,14 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
}
case 'c': {
uint64_t index = (selected_index >= 0 ? selected_index : value_index);
- if (index >= values.size()) {
+ if (index >= p_values.size()) {
return "not enough arguments for format string";
}
// Convert to character.
String str;
- if (values[index].is_num()) {
- int value = values[index];
+ if (p_values[index].is_num()) {
+ int value = p_values[index];
if (value < 0) {
return "unsigned integer is lower than minimum";
} else if (value >= 0xd800 && value <= 0xdfff) {
@@ -5453,9 +5453,9 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
} else if (value > 0x10ffff) {
return "unsigned integer is greater than maximum";
}
- str = chr(values[index]);
- } else if (values[index].get_type() == Variant::STRING) {
- str = values[index];
+ str = chr(p_values[index]);
+ } else if (p_values[index].get_type() == Variant::STRING) {
+ str = p_values[index];
if (str.length() != 1) {
return "%c requires number or single-character string";
}
@@ -5537,19 +5537,19 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
case '*': { // Dynamic width, based on value.
uint64_t index = (selected_index >= 0 ? selected_index : value_index);
- if (index >= values.size()) {
+ if (index >= p_values.size()) {
return "not enough arguments for format string";
}
- Variant::Type value_type = values[index].get_type();
- if (!values[index].is_num() &&
+ Variant::Type value_type = p_values[index].get_type();
+ if (!p_values[index].is_num() &&
value_type != Variant::VECTOR2 && value_type != Variant::VECTOR2I &&
value_type != Variant::VECTOR3 && value_type != Variant::VECTOR3I &&
value_type != Variant::VECTOR4 && value_type != Variant::VECTOR4I) {
return "* wants number or vector";
}
- int size = values[index];
+ int size = p_values[index];
if (in_decimals) {
min_decimals = size;
@@ -5596,14 +5596,14 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
}
}
- if (error) {
- *error = false;
+ if (r_error) {
+ *r_error = false;
}
return formatted;
}
-String String::quote(const String &quotechar) const {
- return quotechar + *this + quotechar;
+String String::quote(const String &p_quotechar) const {
+ return p_quotechar + *this + p_quotechar;
}
String String::unquote() const {
diff --git a/core/string/ustring.h b/core/string/ustring.h
index 9c39c7fc00d..10262dd56a8 100644
--- a/core/string/ustring.h
+++ b/core/string/ustring.h
@@ -106,17 +106,17 @@ constexpr size_t strnlen(const wchar_t *p_str, size_t p_clip_to_len) {
}
template <typename L, typename R>
-constexpr int64_t str_compare(const L *l_ptr, const R *r_ptr) {
+constexpr int64_t str_compare(const L *p_left, const R *p_right) {
while (true) {
- const char32_t l = *l_ptr;
- const char32_t r = *r_ptr;
+ const char32_t l = *p_left;
+ const char32_t r = *p_right;
if (l == 0 || l != r) {
return static_cast<int64_t>(l) - static_cast<int64_t>(r);
}
- l_ptr++;
- r_ptr++;
+ p_left++;
+ p_right++;
}
}
@@ -283,7 +283,7 @@ class [[nodiscard]] String {
#endif
}
- bool _base_is_subsequence_of(const String &p_string, bool case_insensitive) const;
+ bool _base_is_subsequence_of(const String &p_string, bool p_case_insensitive) const;
int _count(const String &p_string, int p_from, int p_to, bool p_case_insensitive) const;
int _count(const char *p_string, int p_from, int p_to, bool p_case_insensitive) const;
String _separate_compound_words() const;
@@ -405,7 +405,7 @@ public:
bool is_lowercase() const;
Vector<String> bigrams() const;
float similarity(const String &p_string) const;
- String format(const Variant &values, const String &placeholder = "{_}") const;
+ String format(const Variant &p_values, const String &p_placeholder = "{_}") const;
String replace_first(const String &p_key, const String &p_with) const;
String replace_first(const char *p_key, const char *p_with) const;
String replace(const String &p_key, const String &p_with) const;
@@ -428,18 +428,18 @@ public:
String trim_prefix(const char *p_prefix) const;
String trim_suffix(const String &p_suffix) const;
String trim_suffix(const char *p_suffix) const;
- String lpad(int min_length, const String &character = " ") const;
- String rpad(int min_length, const String &character = " ") const;
- String sprintf(const Span<Variant> &values, bool *error) const;
- String quote(const String &quotechar = "\"") const;
+ String lpad(int p_min_length, const String &p_character = " ") const;
+ String rpad(int p_min_length, const String &p_character = " ") const;
+ String sprintf(const Span<Variant> &p_values, bool *r_error) const;
+ String quote(const String &p_quotechar = "\"") const;
String unquote() const;
static String num(double p_num, int p_decimals = -1);
static String num_scientific(double p_num);
static String num_scientific(float p_num);
static String num_real(double p_num, bool p_trailing = true);
static String num_real(float p_num, bool p_trailing = true);
- static String num_int64(int64_t p_num, int base = 10, bool capitalize_hex = false);
- static String num_uint64(uint64_t p_num, int base = 10, bool capitalize_hex = false);
+ static String num_int64(int64_t p_num, int p_base = 10, bool p_capitalize_hex = false);
+ static String num_uint64(uint64_t p_num, int p_base = 10, bool p_capitalize_hex = false);
static String chr(char32_t p_char) {
String string;
string.append_utf32(Span(&p_char, 1));
@@ -488,7 +488,7 @@ public:
Vector<int> split_ints(const String &p_splitter, bool p_allow_empty = true) const;
Vector<int> split_ints_mk(const Vector<String> &p_splitters, bool p_allow_empty = true) const;
- String join(const Vector<String> &parts) const;
+ String join(const Vector<String> &p_parts) const;
static char32_t char_uppercase(char32_t p_char);
static char32_t char_lowercase(char32_t p_char);
@@ -504,7 +504,7 @@ public:
String right(int p_len) const;
String indent(const String &p_prefix) const;
String dedent() const;
- String strip_edges(bool left = true, bool right = true) const;
+ String strip_edges(bool p_left = true, bool p_right = true) const;
String strip_escapes() const;
String lstrip(const String &p_chars) const;
String rstrip(const String &p_chars) const;
diff --git a/core/templates/a_hash_map.h b/core/templates/a_hash_map.h
index be038d9753d..12118ca9bdc 100644
--- a/core/templates/a_hash_map.h
+++ b/core/templates/a_hash_map.h
@@ -447,8 +447,8 @@ public:
return *this;
}
- _FORCE_INLINE_ bool operator==(const ConstIterator &b) const { return pair == b.pair; }
- _FORCE_INLINE_ bool operator!=(const ConstIterator &b) const { return pair != b.pair; }
+ _FORCE_INLINE_ bool operator==(const ConstIterator &p_other) const { return pair == p_other.pair; }
+ _FORCE_INLINE_ bool operator!=(const ConstIterator &p_other) const { return pair != p_other.pair; }
_FORCE_INLINE_ explicit operator bool() const {
return pair != end;
@@ -496,8 +496,8 @@ public:
return *this;
}
- _FORCE_INLINE_ bool operator==(const Iterator &b) const { return pair == b.pair; }
- _FORCE_INLINE_ bool operator!=(const Iterator &b) const { return pair != b.pair; }
+ _FORCE_INLINE_ bool operator==(const Iterator &p_other) const { return pair == p_other.pair; }
+ _FORCE_INLINE_ bool operator!=(const Iterator &p_other) const { return pair != p_other.pair; }
_FORCE_INLINE_ explicit operator bool() const {
return pair != end;
diff --git a/core/templates/command_queue_mt.h b/core/templates/command_queue_mt.h
index 80566ced20b..6a8fef6e422 100644
--- a/core/templates/command_queue_mt.h
+++ b/core/templates/command_queue_mt.h
@@ -134,9 +134,9 @@ class CommandQueueMT {
}
template <typename T, bool NeedsSync, typename... Args>
- _FORCE_INLINE_ void _push_internal(Args &&...args) {
+ _FORCE_INLINE_ void _push_internal(Args &&...p_args) {
MutexLock mlock(mutex);
- create_command<T>(std::forward<Args>(args)...);
+ create_command<T>(std::forward<Args>(p_args)...);
if (pump_task_id != WorkerThreadPool::INVALID_TASK_ID) {
WorkerThreadPool::get_singleton()->notify_yield_over(pump_task_id);
diff --git a/core/templates/hash_map.h b/core/templates/hash_map.h
index 1477ab9fecb..da23cf2b7b1 100644
--- a/core/templates/hash_map.h
+++ b/core/templates/hash_map.h
@@ -444,14 +444,14 @@ public:
return *this;
}
- _FORCE_INLINE_ bool operator==(const ConstIterator &b) const { return E == b.E; }
- _FORCE_INLINE_ bool operator!=(const ConstIterator &b) const { return E != b.E; }
+ _FORCE_INLINE_ bool operator==(const ConstIterator &p_other) const { return E == p_other.E; }
+ _FORCE_INLINE_ bool operator!=(const ConstIterator &p_other) const { return E != p_other.E; }
_FORCE_INLINE_ explicit operator bool() const {
return E != nullptr;
}
- _FORCE_INLINE_ ConstIterator(const HashMapElement<TKey, TValue> *p_E) { E = p_E; }
+ _FORCE_INLINE_ ConstIterator(const HashMapElement<TKey, TValue> *p_element) { E = p_element; }
_FORCE_INLINE_ ConstIterator() {}
_FORCE_INLINE_ ConstIterator(const ConstIterator &p_it) { E = p_it.E; }
_FORCE_INLINE_ void operator=(const ConstIterator &p_it) {
@@ -480,14 +480,14 @@ public:
return *this;
}
- _FORCE_INLINE_ bool operator==(const Iterator &b) const { return E == b.E; }
- _FORCE_INLINE_ bool operator!=(const Iterator &b) const { return E != b.E; }
+ _FORCE_INLINE_ bool operator==(const Iterator &p_other) const { return E == p_other.E; }
+ _FORCE_INLINE_ bool operator!=(const Iterator &p_other) const { return E != p_other.E; }
_FORCE_INLINE_ explicit operator bool() const {
return E != nullptr;
}
- _FORCE_INLINE_ Iterator(HashMapElement<TKey, TValue> *p_E) { E = p_E; }
+ _FORCE_INLINE_ Iterator(HashMapElement<TKey, TValue> *p_element) { E = p_element; }
_FORCE_INLINE_ Iterator() {}
_FORCE_INLINE_ Iterator(const Iterator &p_it) { E = p_it.E; }
_FORCE_INLINE_ void operator=(const Iterator &p_it) {
diff --git a/core/templates/hash_set.h b/core/templates/hash_set.h
index 2259e3f7ef4..1e803f10a06 100644
--- a/core/templates/hash_set.h
+++ b/core/templates/hash_set.h
@@ -350,8 +350,8 @@ public:
return *this;
}
- _FORCE_INLINE_ bool operator==(const Iterator &b) const { return _keys == b._keys && _key_idx == b._key_idx; }
- _FORCE_INLINE_ bool operator!=(const Iterator &b) const { return _keys != b._keys || _key_idx != b._key_idx; }
+ _FORCE_INLINE_ bool operator==(const Iterator &p_other) const { return _keys == p_other._keys && _key_idx == p_other._key_idx; }
+ _FORCE_INLINE_ bool operator!=(const Iterator &p_other) const { return _keys != p_other._keys || _key_idx != p_other._key_idx; }
_FORCE_INLINE_ explicit operator bool() const {
return _keys != nullptr;
diff --git a/core/templates/hashfuncs.cpp b/core/templates/hashfuncs.cpp
index cb0052bc902..e936cd5f087 100644
--- a/core/templates/hashfuncs.cpp
+++ b/core/templates/hashfuncs.cpp
@@ -66,12 +66,12 @@ uint32_t hash_murmur3_one_double(double p_in, uint32_t p_seed) {
return hash_murmur3_one_64(u.i, p_seed);
}
-uint32_t hash_murmur3_buffer(const void *key, int length, const uint32_t seed) {
+uint32_t hash_murmur3_buffer(const void *p_key, int p_length, const uint32_t p_seed) {
// Although not required, this is a random prime number.
- const uint8_t *data = (const uint8_t *)key;
- const int nblocks = length / 4;
+ const uint8_t *data = (const uint8_t *)p_key;
+ const int nblocks = p_length / 4;
- uint32_t h1 = seed;
+ uint32_t h1 = p_seed;
const uint32_t c1 = 0xcc9e2d51;
const uint32_t c2 = 0x1b873593;
@@ -94,7 +94,7 @@ uint32_t hash_murmur3_buffer(const void *key, int length, const uint32_t seed) {
uint32_t k1 = 0;
- switch (length & 3) {
+ switch (p_length & 3) {
case 3:
k1 ^= tail[2] << 16;
[[fallthrough]];
@@ -110,7 +110,7 @@ uint32_t hash_murmur3_buffer(const void *key, int length, const uint32_t seed) {
};
// Finalize with additional bit mixing.
- h1 ^= length;
+ h1 ^= p_length;
return hash_fmix32(h1);
}
diff --git a/core/templates/hashfuncs.h b/core/templates/hashfuncs.h
index d9c9c098543..1047915ee45 100644
--- a/core/templates/hashfuncs.h
+++ b/core/templates/hashfuncs.h
@@ -95,14 +95,14 @@ _FORCE_INLINE_ uint32_t hash_one_uint64(const uint64_t p_int) {
return uint32_t(v);
}
-_FORCE_INLINE_ uint64_t hash64_murmur3_64(uint64_t key, uint64_t seed) {
- key ^= seed;
- key ^= key >> 33;
- key *= 0xff51afd7ed558ccd;
- key ^= key >> 33;
- key *= 0xc4ceb9fe1a85ec53;
- key ^= key >> 33;
- return key;
+_FORCE_INLINE_ uint64_t hash64_murmur3_64(uint64_t p_key, uint64_t p_seed) {
+ p_key ^= p_seed;
+ p_key ^= p_key >> 33;
+ p_key *= 0xff51afd7ed558ccd;
+ p_key ^= p_key >> 33;
+ p_key *= 0xc4ceb9fe1a85ec53;
+ p_key ^= p_key >> 33;
+ return p_key;
}
#define HASH_MURMUR3_SEED 0x7F07C65
@@ -137,21 +137,21 @@ _FORCE_INLINE_ uint32_t hash_murmur3_one_real(real_t p_in, uint32_t p_seed = HAS
#endif
}
-_FORCE_INLINE_ uint32_t hash_rotl32(uint32_t x, int8_t r) {
- return (x << r) | (x >> (32 - r));
+_FORCE_INLINE_ uint32_t hash_rotl32(uint32_t p_x, int8_t p_r) {
+ return (p_x << p_r) | (p_x >> (32 - p_r));
}
-_FORCE_INLINE_ uint32_t hash_fmix32(uint32_t h) {
- h ^= h >> 16;
- h *= 0x85ebca6b;
- h ^= h >> 13;
- h *= 0xc2b2ae35;
- h ^= h >> 16;
+_FORCE_INLINE_ uint32_t hash_fmix32(uint32_t p_h) {
+ p_h ^= p_h >> 16;
+ p_h *= 0x85ebca6b;
+ p_h ^= p_h >> 13;
+ p_h *= 0xc2b2ae35;
+ p_h ^= p_h >> 16;
- return h;
+ return p_h;
}
-uint32_t hash_murmur3_buffer(const void *key, int length, uint32_t seed = HASH_MURMUR3_SEED);
+uint32_t hash_murmur3_buffer(const void *p_key, int p_length, uint32_t p_seed = HASH_MURMUR3_SEED);
uint32_t hash_djb2_one_float(double p_in, uint32_t p_prev = 5381);
uint64_t hash_djb2_one_float_64(double p_in, uint64_t p_prev = 5381);
@@ -291,10 +291,10 @@ template <typename T>
constexpr bool has_is_same_method_v = has_is_same_method<T>::value;
struct HashHasher {
- static _FORCE_INLINE_ uint32_t hash(const int32_t hash) { return hash; }
- static _FORCE_INLINE_ uint32_t hash(const uint32_t hash) { return hash; }
- static _FORCE_INLINE_ uint64_t hash(const int64_t hash) { return hash; }
- static _FORCE_INLINE_ uint64_t hash(const uint64_t hash) { return hash; }
+ static _FORCE_INLINE_ uint32_t hash(const int32_t p_hash) { return p_hash; }
+ static _FORCE_INLINE_ uint32_t hash(const uint32_t p_hash) { return p_hash; }
+ static _FORCE_INLINE_ uint64_t hash(const int64_t p_hash) { return p_hash; }
+ static _FORCE_INLINE_ uint64_t hash(const uint64_t p_hash) { return p_hash; }
};
template <typename T, typename = void>
@@ -399,25 +399,25 @@ inline constexpr uint64_t hash_table_size_primes_inv[HASH_TABLE_SIZE_MAX] = {
* Faster Remainder by Direct Computation: Applications to Compilers and Software Libraries
* https://arxiv.org/abs/1902.01961
*/
-static _FORCE_INLINE_ uint32_t fastmod(const uint32_t n, const uint64_t c, const uint32_t d) {
+static _FORCE_INLINE_ uint32_t fastmod(const uint32_t p_n, const uint64_t p_c, const uint32_t p_d) {
#if defined(_MSC_VER)
// Returns the upper 64 bits of the product of two 64-bit unsigned integers.
// This intrinsic function is required since MSVC does not support unsigned 128-bit integers.
#if defined(_M_X64) || defined(_M_ARM64)
- return __umulh(c * n, d);
+ return __umulh(p_c * p_n, p_d);
#else
// Fallback to the slower method for 32-bit platforms.
- return n % d;
+ return p_n % p_d;
#endif // _M_X64 || _M_ARM64
#else
#ifdef __SIZEOF_INT128__
// Prevent compiler warning, because we know what we are doing.
- uint64_t lowbits = c * n;
+ uint64_t lowbits = p_c * p_n;
__extension__ typedef unsigned __int128 uint128;
- return static_cast<uint64_t>(((uint128)lowbits * d) >> 64);
+ return static_cast<uint64_t>(((uint128)lowbits * p_d) >> 64);
#else
// Fallback to the slower method if no 128-bit unsigned integer type is available.
- return n % d;
+ return p_n % p_d;
#endif // __SIZEOF_INT128__
#endif // _MSC_VER
}
diff --git a/core/templates/iterable.h b/core/templates/iterable.h
index f531976aabc..b2481ceaa71 100644
--- a/core/templates/iterable.h
+++ b/core/templates/iterable.h
@@ -41,8 +41,8 @@ public:
I begin() { return _begin; }
I end() { return _end; }
- Iterable(I &&begin, I &&end) :
- _begin(std::move(begin)), _end(std::move(end)) {}
- Iterable(const I &begin, const I &end) :
- _begin(begin), _end(end) {}
+ Iterable(I &&p_begin, I &&p_end) :
+ _begin(std::move(p_begin)), _end(std::move(p_end)) {}
+ Iterable(const I &p_begin, const I &p_end) :
+ _begin(p_begin), _end(p_end) {}
};
diff --git a/core/templates/list.h b/core/templates/list.h
index 3f9ddf46de5..3c250b4cf5c 100644
--- a/core/templates/list.h
+++ b/core/templates/list.h
@@ -152,10 +152,10 @@ public:
return *this;
}
- _FORCE_INLINE_ bool operator==(const ConstIterator &b) const { return E == b.E; }
- _FORCE_INLINE_ bool operator!=(const ConstIterator &b) const { return E != b.E; }
+ _FORCE_INLINE_ bool operator==(const ConstIterator &p_other) const { return E == p_other.E; }
+ _FORCE_INLINE_ bool operator!=(const ConstIterator &p_other) const { return E != p_other.E; }
- _FORCE_INLINE_ ConstIterator(const Element *p_E) { E = p_E; }
+ _FORCE_INLINE_ ConstIterator(const Element *p_element) { E = p_element; }
_FORCE_INLINE_ ConstIterator() {}
_FORCE_INLINE_ ConstIterator(const ConstIterator &p_it) { E = p_it.E; }
@@ -177,10 +177,10 @@ public:
return *this;
}
- _FORCE_INLINE_ bool operator==(const Iterator &b) const { return E == b.E; }
- _FORCE_INLINE_ bool operator!=(const Iterator &b) const { return E != b.E; }
+ _FORCE_INLINE_ bool operator==(const Iterator &p_other) const { return E == p_other.E; }
+ _FORCE_INLINE_ bool operator!=(const Iterator &p_other) const { return E != p_other.E; }
- Iterator(Element *p_E) { E = p_E; }
+ Iterator(Element *p_element) { E = p_element; }
Iterator() {}
Iterator(const Iterator &p_it) { E = p_it.E; }
@@ -223,27 +223,27 @@ private:
Element *last = nullptr;
int size_cache = 0;
- bool erase(Element *p_I) {
- ERR_FAIL_NULL_V(p_I, false);
- ERR_FAIL_COND_V(p_I->data != this, false);
+ bool erase(Element *p_element) {
+ ERR_FAIL_NULL_V(p_element, false);
+ ERR_FAIL_COND_V(p_element->data != this, false);
- if (first == p_I) {
- first = p_I->next_ptr;
+ if (first == p_element) {
+ first = p_element->next_ptr;
}
- if (last == p_I) {
- last = p_I->prev_ptr;
+ if (last == p_element) {
+ last = p_element->prev_ptr;
}
- if (p_I->prev_ptr) {
- p_I->prev_ptr->next_ptr = p_I->next_ptr;
+ if (p_element->prev_ptr) {
+ p_element->prev_ptr->next_ptr = p_element->next_ptr;
}
- if (p_I->next_ptr) {
- p_I->next_ptr->prev_ptr = p_I->prev_ptr;
+ if (p_element->next_ptr) {
+ p_element->next_ptr->prev_ptr = p_element->prev_ptr;
}
- memdelete_allocator<Element, A>(p_I);
+ memdelete_allocator<Element, A>(p_element);
size_cache--;
return true;
@@ -284,7 +284,7 @@ public:
/**
* store a new element at the end of the list
*/
- Element *push_back(const T &value) _LIFETIME_BOUND_ {
+ Element *push_back(const T &p_value) _LIFETIME_BOUND_ {
if (!_data) {
_data = memnew_allocator(_Data, A);
_data->first = nullptr;
@@ -293,7 +293,7 @@ public:
}
Element *n = memnew_allocator(Element, A);
- n->value = (T &)value;
+ n->value = (T &)p_value;
n->prev_ptr = _data->last;
n->next_ptr = nullptr;
@@ -323,7 +323,7 @@ public:
/**
* store a new element at the beginning of the list
*/
- Element *push_front(const T &value) _LIFETIME_BOUND_ {
+ Element *push_front(const T &p_value) _LIFETIME_BOUND_ {
if (!_data) {
_data = memnew_allocator(_Data, A);
_data->first = nullptr;
@@ -332,7 +332,7 @@ public:
}
Element *n = memnew_allocator(Element, A);
- n->value = (T &)value;
+ n->value = (T &)p_value;
n->prev_ptr = nullptr;
n->next_ptr = _data->first;
n->data = _data;
@@ -442,9 +442,9 @@ public:
/**
* erase an element in the list, by iterator pointing to it. Return true if it was found/erased.
*/
- bool erase(Element *p_I) {
- if (_data && p_I) {
- bool ret = _data->erase(p_I);
+ bool erase(Element *p_element) {
+ if (_data && p_element) {
+ bool ret = _data->erase(p_element);
if (_data->size_cache == 0) {
memdelete_allocator<_Data, A>(_data);
@@ -460,8 +460,8 @@ public:
/**
* erase the first element in the list, that contains value
*/
- bool erase(const T &value) {
- Element *I = find(value);
+ bool erase(const T &p_value) {
+ Element *I = find(p_value);
return erase(I);
}
@@ -485,43 +485,43 @@ public:
return _data ? _data->size_cache : 0;
}
- void swap(Element *p_A, Element *p_B) {
- ERR_FAIL_COND(!p_A || !p_B);
- ERR_FAIL_COND(p_A->data != _data);
- ERR_FAIL_COND(p_B->data != _data);
+ void swap(Element *p_left, Element *p_right) {
+ ERR_FAIL_COND(!p_left || !p_right);
+ ERR_FAIL_COND(p_left->data != _data);
+ ERR_FAIL_COND(p_right->data != _data);
- if (p_A == p_B) {
+ if (p_left == p_right) {
return;
}
- Element *A_prev = p_A->prev_ptr;
- Element *A_next = p_A->next_ptr;
- Element *B_prev = p_B->prev_ptr;
- Element *B_next = p_B->next_ptr;
+ Element *A_prev = p_left->prev_ptr;
+ Element *A_next = p_left->next_ptr;
+ Element *B_prev = p_right->prev_ptr;
+ Element *B_next = p_right->next_ptr;
if (A_prev) {
- A_prev->next_ptr = p_B;
+ A_prev->next_ptr = p_right;
} else {
- _data->first = p_B;
+ _data->first = p_right;
}
if (B_prev) {
- B_prev->next_ptr = p_A;
+ B_prev->next_ptr = p_left;
} else {
- _data->first = p_A;
+ _data->first = p_left;
}
if (A_next) {
- A_next->prev_ptr = p_B;
+ A_next->prev_ptr = p_right;
} else {
- _data->last = p_B;
+ _data->last = p_right;
}
if (B_next) {
- B_next->prev_ptr = p_A;
+ B_next->prev_ptr = p_left;
} else {
- _data->last = p_A;
+ _data->last = p_left;
}
- p_A->prev_ptr = A_next == p_B ? p_B : B_prev;
- p_A->next_ptr = B_next == p_A ? p_B : B_next;
- p_B->prev_ptr = B_next == p_A ? p_A : A_prev;
- p_B->next_ptr = A_next == p_B ? p_A : A_next;
+ p_left->prev_ptr = A_next == p_right ? p_right : B_prev;
+ p_left->next_ptr = B_next == p_left ? p_right : B_next;
+ p_right->prev_ptr = B_next == p_left ? p_left : A_prev;
+ p_right->next_ptr = A_next == p_right ? p_left : A_next;
}
/**
* copy the list
@@ -574,30 +574,30 @@ public:
return I->get();
}
- void move_to_back(Element *p_I) {
- ERR_FAIL_COND(p_I->data != _data);
- if (!p_I->next_ptr) {
+ void move_to_back(Element *p_element) {
+ ERR_FAIL_COND(p_element->data != _data);
+ if (!p_element->next_ptr) {
return;
}
- if (_data->first == p_I) {
- _data->first = p_I->next_ptr;
+ if (_data->first == p_element) {
+ _data->first = p_element->next_ptr;
}
- if (_data->last == p_I) {
- _data->last = p_I->prev_ptr;
+ if (_data->last == p_element) {
+ _data->last = p_element->prev_ptr;
}
- if (p_I->prev_ptr) {
- p_I->prev_ptr->next_ptr = p_I->next_ptr;
+ if (p_element->prev_ptr) {
+ p_element->prev_ptr->next_ptr = p_element->next_ptr;
}
- p_I->next_ptr->prev_ptr = p_I->prev_ptr;
+ p_element->next_ptr->prev_ptr = p_element->prev_ptr;
- _data->last->next_ptr = p_I;
- p_I->prev_ptr = _data->last;
- p_I->next_ptr = nullptr;
- _data->last = p_I;
+ _data->last->next_ptr = p_element;
+ p_element->prev_ptr = _data->last;
+ p_element->next_ptr = nullptr;
+ _data->last = p_element;
}
void reverse() {
@@ -611,60 +611,60 @@ public:
}
}
- void move_to_front(Element *p_I) {
- ERR_FAIL_COND(p_I->data != _data);
- if (!p_I->prev_ptr) {
+ void move_to_front(Element *p_element) {
+ ERR_FAIL_COND(p_element->data != _data);
+ if (!p_element->prev_ptr) {
return;
}
- if (_data->first == p_I) {
- _data->first = p_I->next_ptr;
+ if (_data->first == p_element) {
+ _data->first = p_element->next_ptr;
}
- if (_data->last == p_I) {
- _data->last = p_I->prev_ptr;
+ if (_data->last == p_element) {
+ _data->last = p_element->prev_ptr;
}
- p_I->prev_ptr->next_ptr = p_I->next_ptr;
+ p_element->prev_ptr->next_ptr = p_element->next_ptr;
- if (p_I->next_ptr) {
- p_I->next_ptr->prev_ptr = p_I->prev_ptr;
+ if (p_element->next_ptr) {
+ p_element->next_ptr->prev_ptr = p_element->prev_ptr;
}
- _data->first->prev_ptr = p_I;
- p_I->next_ptr = _data->first;
- p_I->prev_ptr = nullptr;
- _data->first = p_I;
+ _data->first->prev_ptr = p_element;
+ p_element->next_ptr = _data->first;
+ p_element->prev_ptr = nullptr;
+ _data->first = p_element;
}
- void move_before(Element *value, Element *where) {
- if (value->prev_ptr) {
- value->prev_ptr->next_ptr = value->next_ptr;
+ void move_before(Element *p_value, Element *p_where) {
+ if (p_value->prev_ptr) {
+ p_value->prev_ptr->next_ptr = p_value->next_ptr;
} else {
- _data->first = value->next_ptr;
+ _data->first = p_value->next_ptr;
}
- if (value->next_ptr) {
- value->next_ptr->prev_ptr = value->prev_ptr;
+ if (p_value->next_ptr) {
+ p_value->next_ptr->prev_ptr = p_value->prev_ptr;
} else {
- _data->last = value->prev_ptr;
+ _data->last = p_value->prev_ptr;
}
- value->next_ptr = where;
- if (!where) {
- value->prev_ptr = _data->last;
- _data->last = value;
+ p_value->next_ptr = p_where;
+ if (!p_where) {
+ p_value->prev_ptr = _data->last;
+ _data->last = p_value;
return;
}
- value->prev_ptr = where->prev_ptr;
+ p_value->prev_ptr = p_where->prev_ptr;
- if (where->prev_ptr) {
- where->prev_ptr->next_ptr = value;
+ if (p_where->prev_ptr) {
+ p_where->prev_ptr->next_ptr = p_value;
} else {
- _data->first = value;
+ _data->first = p_value;
}
- where->prev_ptr = value;
+ p_where->prev_ptr = p_value;
}
void sort() {
diff --git a/core/templates/local_vector.h b/core/templates/local_vector.h
index 6e614d30a26..4da8977855b 100644
--- a/core/templates/local_vector.h
+++ b/core/templates/local_vector.h
@@ -221,8 +221,8 @@ public:
return *this;
}
- _FORCE_INLINE_ bool operator==(const Iterator &b) const { return elem_ptr == b.elem_ptr; }
- _FORCE_INLINE_ bool operator!=(const Iterator &b) const { return elem_ptr != b.elem_ptr; }
+ _FORCE_INLINE_ bool operator==(const Iterator &p_other) const { return elem_ptr == p_other.elem_ptr; }
+ _FORCE_INLINE_ bool operator!=(const Iterator &p_other) const { return elem_ptr != p_other.elem_ptr; }
Iterator(T *p_ptr) { elem_ptr = p_ptr; }
Iterator() {}
@@ -246,8 +246,8 @@ public:
return *this;
}
- _FORCE_INLINE_ bool operator==(const ConstIterator &b) const { return elem_ptr == b.elem_ptr; }
- _FORCE_INLINE_ bool operator!=(const ConstIterator &b) const { return elem_ptr != b.elem_ptr; }
+ _FORCE_INLINE_ bool operator==(const ConstIterator &p_other) const { return elem_ptr == p_other.elem_ptr; }
+ _FORCE_INLINE_ bool operator!=(const ConstIterator &p_other) const { return elem_ptr != p_other.elem_ptr; }
ConstIterator(const T *p_ptr) { elem_ptr = p_ptr; }
ConstIterator() {}
diff --git a/core/templates/rb_map.h b/core/templates/rb_map.h
index fc8ff9729a6..aeffb644b02 100644
--- a/core/templates/rb_map.h
+++ b/core/templates/rb_map.h
@@ -122,7 +122,7 @@ public:
E = p_it.E;
return *this;
}
- Iterator(Element *p_E) { E = p_E; }
+ Iterator(Element *p_element) { E = p_element; }
Iterator() {}
Iterator(const Iterator &p_it) { E = p_it.E; }
@@ -154,7 +154,7 @@ public:
E = p_it.E;
return *this;
}
- ConstIterator(const Element *p_E) { E = p_E; }
+ ConstIterator(const Element *p_element) { E = p_element; }
ConstIterator() {}
ConstIterator(const ConstIterator &p_it) { E = p_it.E; }
@@ -583,16 +583,16 @@ private:
ERR_FAIL_COND(_data._nil->color == RED);
}
- void _calculate_depth(Element *p_element, int &max_d, int d) const {
+ void _calculate_depth(Element *p_element, int &p_max_d, int p_d) const {
if (p_element == _data._nil) {
return;
}
- _calculate_depth(p_element->left, max_d, d + 1);
- _calculate_depth(p_element->right, max_d, d + 1);
+ _calculate_depth(p_element->left, p_max_d, p_d + 1);
+ _calculate_depth(p_element->right, p_max_d, p_d + 1);
- if (d > max_d) {
- max_d = d;
+ if (p_d > p_max_d) {
+ p_max_d = p_d;
}
}
diff --git a/core/templates/rb_set.h b/core/templates/rb_set.h
index 265ef47823b..23e8164e4d8 100644
--- a/core/templates/rb_set.h
+++ b/core/templates/rb_set.h
@@ -96,11 +96,11 @@ public:
return *this;
}
- _FORCE_INLINE_ bool operator==(const Iterator &b) const { return E == b.E; }
- _FORCE_INLINE_ bool operator!=(const Iterator &b) const { return E != b.E; }
+ _FORCE_INLINE_ bool operator==(const Iterator &p_other) const { return E == p_other.E; }
+ _FORCE_INLINE_ bool operator!=(const Iterator &p_other) const { return E != p_other.E; }
explicit operator bool() const { return E != nullptr; }
- Iterator(Element *p_E) { E = p_E; }
+ Iterator(Element *p_element) { E = p_element; }
Iterator() {}
Iterator(const Iterator &p_it) { E = p_it.E; }
@@ -122,10 +122,10 @@ public:
return *this;
}
- _FORCE_INLINE_ bool operator==(const ConstIterator &b) const { return E == b.E; }
- _FORCE_INLINE_ bool operator!=(const ConstIterator &b) const { return E != b.E; }
+ _FORCE_INLINE_ bool operator==(const ConstIterator &p_other) const { return E == p_other.E; }
+ _FORCE_INLINE_ bool operator!=(const ConstIterator &p_other) const { return E != p_other.E; }
- _FORCE_INLINE_ ConstIterator(const Element *p_E) { E = p_E; }
+ _FORCE_INLINE_ ConstIterator(const Element *p_element) { E = p_element; }
_FORCE_INLINE_ ConstIterator() {}
_FORCE_INLINE_ ConstIterator(const ConstIterator &p_it) { E = p_it.E; }
@@ -534,16 +534,16 @@ private:
ERR_FAIL_COND(_data._nil->color == RED);
}
- void _calculate_depth(Element *p_element, int &max_d, int d) const {
+ void _calculate_depth(Element *p_element, int &p_max_d, int p_d) const {
if (p_element == _data._nil) {
return;
}
- _calculate_depth(p_element->left, max_d, d + 1);
- _calculate_depth(p_element->right, max_d, d + 1);
+ _calculate_depth(p_element->left, p_max_d, p_d + 1);
+ _calculate_depth(p_element->right, p_max_d, p_d + 1);
- if (d > max_d) {
- max_d = d;
+ if (p_d > p_max_d) {
+ p_max_d = p_d;
}
}
diff --git a/core/templates/ring_buffer.h b/core/templates/ring_buffer.h
index 395e653d56c..cc9a3ef1c18 100644
--- a/core/templates/ring_buffer.h
+++ b/core/templates/ring_buffer.h
@@ -101,7 +101,7 @@ public:
return p_size;
}
- int find(const T &t, int p_offset, int p_max_size) const {
+ int find(const T &p_value, int p_offset, int p_max_size) const {
int left = data_left();
if ((p_offset + p_max_size) > left) {
p_max_size = left - p_offset;
@@ -118,7 +118,7 @@ public:
end = MIN(end, size());
int total = end - pos;
for (int i = 0; i < total; i++) {
- if (data[pos + i] == t) {
+ if (data[pos + i] == p_value) {
return i + (p_max_size - to_read);
}
}
diff --git a/core/templates/safe_list.h b/core/templates/safe_list.h
index 768135ce969..856b4e15272 100644
--- a/core/templates/safe_list.h
+++ b/core/templates/safe_list.h
@@ -56,7 +56,7 @@ class SafeList {
// to the previous list item in time that was also logically deleted.
std::atomic<SafeListNode *> graveyard_next = nullptr;
- std::function<void(T)> deletion_fn = [](T t) { return; };
+ std::function<void(T)> deletion_fn = [](T p_t) { return; };
T val;
};
@@ -147,7 +147,7 @@ public:
void erase(T p_value) {
Iterator tmp = find(p_value);
- erase(tmp, [](T t) { return; });
+ erase(tmp, [](T p_t) { return; });
}
void erase(Iterator &p_iterator, std::function<void(T)> p_deletion_fn) {
diff --git a/core/templates/sort_array.h b/core/templates/sort_array.h
index 8ccc96c1cb1..4248ca62fb1 100644
--- a/core/templates/sort_array.h
+++ b/core/templates/sort_array.h
@@ -54,30 +54,30 @@ class SortArray {
public:
Comparator compare;
- inline int64_t median_of_3_index(const T *p_ptr, int64_t a_index, int64_t b_index, int64_t c_index) const {
- const T &a = p_ptr[a_index];
- const T &b = p_ptr[b_index];
- const T &c = p_ptr[c_index];
+ inline int64_t median_of_3_index(const T *p_ptr, int64_t p_a_index, int64_t p_b_index, int64_t p_c_index) const {
+ const T &a = p_ptr[p_a_index];
+ const T &b = p_ptr[p_b_index];
+ const T &c = p_ptr[p_c_index];
if (compare(a, b)) {
if (compare(b, c)) {
- return b_index;
+ return p_b_index;
} else if (compare(a, c)) {
- return c_index;
+ return p_c_index;
} else {
- return a_index;
+ return p_a_index;
}
} else if (compare(a, c)) {
- return a_index;
+ return p_a_index;
} else if (compare(b, c)) {
- return c_index;
+ return p_c_index;
} else {
- return b_index;
+ return p_b_index;
}
}
- inline int64_t bitlog(int64_t n) const {
+ inline int64_t bitlog(int64_t p_n) const {
int64_t k;
- for (k = 0; n != 1; n >>= 1) {
+ for (k = 0; p_n != 1; p_n >>= 1) {
++k;
}
return k;
diff --git a/core/templates/span.h b/core/templates/span.h
index ad3bb479e54..5cb850dc3ef 100644
--- a/core/templates/span.h
+++ b/core/templates/span.h
@@ -130,7 +130,7 @@ public:
/// Find the index of the given value using binary search.
/// Note: Assumes that elements in the span are sorted. Otherwise, use find() instead.
template <typename Comparator = Comparator<T>>
- constexpr uint64_t bisect(const T &p_value, bool p_before, Comparator compare = Comparator()) const;
+ constexpr uint64_t bisect(const T &p_value, bool p_before, Comparator p_compare = Comparator()) const;
/// The caller is responsible to ensure size() > 0.
constexpr T max() const;
@@ -195,13 +195,13 @@ constexpr uint64_t Span<T>::count(const T &p_val) const {
template <typename T>
template <typename Comparator>
-constexpr uint64_t Span<T>::bisect(const T &p_value, bool p_before, Comparator compare) const {
+constexpr uint64_t Span<T>::bisect(const T &p_value, bool p_before, Comparator p_compare) const {
uint64_t lo = 0;
uint64_t hi = size();
if (p_before) {
while (lo < hi) {
const uint64_t mid = (lo + hi) / 2;
- if (compare(ptr()[mid], p_value)) {
+ if (p_compare(ptr()[mid], p_value)) {
lo = mid + 1;
} else {
hi = mid;
@@ -210,7 +210,7 @@ constexpr uint64_t Span<T>::bisect(const T &p_value, bool p_before, Comparator c
} else {
while (lo < hi) {
const uint64_t mid = (lo + hi) / 2;
- if (compare(p_value, ptr()[mid])) {
+ if (p_compare(p_value, ptr()[mid])) {
hi = mid;
} else {
lo = mid + 1;
diff --git a/core/templates/tuple.h b/core/templates/tuple.h
index bb71f61d6d0..5354f3053b8 100644
--- a/core/templates/tuple.h
+++ b/core/templates/tuple.h
@@ -80,9 +80,9 @@ struct Tuple<T, Rest...> : Tuple<Rest...> {
Tuple() = default;
template <typename F, typename... R>
- _FORCE_INLINE_ Tuple(F &&f, R &&...rest) :
- Tuple<Rest...>(std::forward<R>(rest)...),
- value(std::forward<F>(f)) {}
+ _FORCE_INLINE_ Tuple(F &&p_first, R &&...p_rest) :
+ Tuple<Rest...>(std::forward<R>(p_rest)...),
+ value(std::forward<F>(p_first)) {}
};
// Tuple is zero-constructible if and only if all constrained types are zero-constructible.
@@ -94,8 +94,8 @@ struct TupleGet;
template <typename First, typename... Rest>
struct TupleGet<0, Tuple<First, Rest...>> {
- _FORCE_INLINE_ static First &tuple_get(Tuple<First, Rest...> &t) {
- return t.value;
+ _FORCE_INLINE_ static First &tuple_get(Tuple<First, Rest...> &p_tuple) {
+ return p_tuple.value;
}
};
@@ -106,17 +106,17 @@ struct TupleGet<0, Tuple<First, Rest...>> {
template <size_t I, typename First, typename... Rest>
struct TupleGet<I, Tuple<First, Rest...>> {
- _FORCE_INLINE_ static auto &tuple_get(Tuple<First, Rest...> &t) {
- return TupleGet<I - 1, Tuple<Rest...>>::tuple_get(static_cast<Tuple<Rest...> &>(t));
+ _FORCE_INLINE_ static auto &tuple_get(Tuple<First, Rest...> &p_tuple) {
+ return TupleGet<I - 1, Tuple<Rest...>>::tuple_get(static_cast<Tuple<Rest...> &>(p_tuple));
}
};
template <size_t I, typename... Types>
-_FORCE_INLINE_ auto &tuple_get(Tuple<Types...> &t) {
- return TupleGet<I, Tuple<Types...>>::tuple_get(t);
+_FORCE_INLINE_ auto &tuple_get(Tuple<Types...> &p_tuple) {
+ return TupleGet<I, Tuple<Types...>>::tuple_get(p_tuple);
}
template <size_t I, typename... Types>
-_FORCE_INLINE_ const auto &tuple_get(const Tuple<Types...> &t) {
- return TupleGet<I, Tuple<Types...>>::tuple_get(t);
+_FORCE_INLINE_ const auto &tuple_get(const Tuple<Types...> &p_tuple) {
+ return TupleGet<I, Tuple<Types...>>::tuple_get(p_tuple);
}
diff --git a/core/templates/vector.h b/core/templates/vector.h
index dd899bd320b..251c4d7059b 100644
--- a/core/templates/vector.h
+++ b/core/templates/vector.h
@@ -175,14 +175,14 @@ public:
}
template <typename Comparator, bool Validate = SORT_ARRAY_VALIDATE_ENABLED, typename... Args>
- void sort_custom(Args &&...args) {
+ void sort_custom(Args &&...p_args) {
Size len = _cowdata.size();
if (len == 0) {
return;
}
T *data = ptrw();
- SortArray<T, Comparator, Validate> sorter{ args... };
+ SortArray<T, Comparator, Validate> sorter{ p_args... };
sorter.sort(data, len);
}
@@ -191,8 +191,8 @@ public:
}
template <typename Comparator, typename Value, typename... Args>
- Size bsearch_custom(const Value &p_value, bool p_before, Args &&...args) const {
- return span().bisect(p_value, p_before, Comparator{ args... });
+ Size bsearch_custom(const Value &p_value, bool p_before, Args &&...p_args) const {
+ return span().bisect(p_value, p_before, Comparator{ p_args... });
}
Vector<T> duplicate() const {
@@ -270,8 +270,8 @@ public:
return *this;
}
- _FORCE_INLINE_ bool operator==(const Iterator &b) const { return elem_ptr == b.elem_ptr; }
- _FORCE_INLINE_ bool operator!=(const Iterator &b) const { return elem_ptr != b.elem_ptr; }
+ _FORCE_INLINE_ bool operator==(const Iterator &p_other) const { return elem_ptr == p_other.elem_ptr; }
+ _FORCE_INLINE_ bool operator!=(const Iterator &p_other) const { return elem_ptr != p_other.elem_ptr; }
Iterator(T *p_ptr) { elem_ptr = p_ptr; }
Iterator() {}
@@ -295,8 +295,8 @@ public:
return *this;
}
- _FORCE_INLINE_ bool operator==(const ConstIterator &b) const { return elem_ptr == b.elem_ptr; }
- _FORCE_INLINE_ bool operator!=(const ConstIterator &b) const { return elem_ptr != b.elem_ptr; }
+ _FORCE_INLINE_ bool operator==(const ConstIterator &p_other) const { return elem_ptr == p_other.elem_ptr; }
+ _FORCE_INLINE_ bool operator!=(const ConstIterator &p_other) const { return elem_ptr != p_other.elem_ptr; }
ConstIterator(const T *p_ptr) { elem_ptr = p_ptr; }
ConstIterator() {}
diff --git a/core/typedefs.h b/core/typedefs.h
index b96a73b5e6a..610b1a5b563 100644
--- a/core/typedefs.h
+++ b/core/typedefs.h
@@ -152,23 +152,23 @@ static_assert(__cplusplus >= 201703L, "Minimum of C++17 required.");
#undef CLAMP
template <typename T>
-constexpr const T SIGN(const T m_v) {
- return m_v > 0 ? +1.0f : (m_v < 0 ? -1.0f : 0.0f);
+constexpr const T SIGN(const T p_value) {
+ return p_value > 0 ? +1.0f : (p_value < 0 ? -1.0f : 0.0f);
}
template <typename T, typename T2>
-constexpr auto MIN(const T m_a, const T2 m_b) {
- return m_a < m_b ? m_a : m_b;
+constexpr auto MIN(const T p_left, const T2 p_right) {
+ return p_left < p_right ? p_left : p_right;
}
template <typename T, typename T2>
-constexpr auto MAX(const T m_a, const T2 m_b) {
- return m_a > m_b ? m_a : m_b;
+constexpr auto MAX(const T p_left, const T2 p_right) {
+ return p_left > p_right ? p_left : p_right;
}
template <typename T, typename T2, typename T3>
-constexpr auto CLAMP(const T m_a, const T2 m_min, const T3 m_max) {
- return m_a < m_min ? m_min : (m_a > m_max ? m_max : m_a);
+constexpr auto CLAMP(const T p_value, const T2 p_min, const T3 p_max) {
+ return p_value < p_min ? p_min : (p_value > p_max ? p_max : p_value);
}
// Like std::size, but without requiring any additional includes.
diff --git a/core/variant/array.cpp b/core/variant/array.cpp
index f23ae619ee4..5b061072ac2 100644
--- a/core/variant/array.cpp
+++ b/core/variant/array.cpp
@@ -134,7 +134,7 @@ bool Array::operator!=(const Array &p_array) const {
return !recursive_equal(p_array, 0);
}
-bool Array::recursive_equal(const Array &p_array, int recursion_count) const {
+bool Array::recursive_equal(const Array &p_array, int p_recursion_count) const {
// Cheap checks
if (_p == p_array._p) {
return true;
@@ -147,13 +147,13 @@ bool Array::recursive_equal(const Array &p_array, int recursion_count) const {
}
// Heavy O(n) check
- if (recursion_count > MAX_RECURSION) {
+ if (p_recursion_count > MAX_RECURSION) {
ERR_PRINT("Max recursion reached");
return true;
}
- recursion_count++;
+ p_recursion_count++;
for (int i = 0; i < size; i++) {
- if (!a1[i].hash_compare(a2[i], recursion_count, false)) {
+ if (!a1[i].hash_compare(a2[i], p_recursion_count, false)) {
return false;
}
}
@@ -192,17 +192,17 @@ uint32_t Array::hash() const {
return recursive_hash(0);
}
-uint32_t Array::recursive_hash(int recursion_count) const {
- if (recursion_count > MAX_RECURSION) {
+uint32_t Array::recursive_hash(int p_recursion_count) const {
+ if (p_recursion_count > MAX_RECURSION) {
ERR_PRINT("Max recursion reached");
return 0;
}
uint32_t h = hash_murmur3_one_32(Variant::ARRAY);
- recursion_count++;
+ p_recursion_count++;
for (int i = 0; i < _p->array.size(); i++) {
- h = hash_murmur3_one_32(_p->array[i].recursive_hash(recursion_count), h);
+ h = hash_murmur3_one_32(_p->array[i].recursive_hash(p_recursion_count), h);
}
return hash_fmix32(h);
}
@@ -534,24 +534,24 @@ Array Array::duplicate_deep(ResourceDeepDuplicateMode p_deep_subresources_mode)
return recursive_duplicate(true, p_deep_subresources_mode, 0);
}
-Array Array::recursive_duplicate(bool p_deep, ResourceDeepDuplicateMode p_deep_subresources_mode, int recursion_count) const {
+Array Array::recursive_duplicate(bool p_deep, ResourceDeepDuplicateMode p_deep_subresources_mode, int p_recursion_count) const {
Array new_arr;
new_arr._p->typed = _p->typed;
- if (recursion_count > MAX_RECURSION) {
+ if (p_recursion_count > MAX_RECURSION) {
ERR_PRINT("Max recursion reached");
return new_arr;
}
if (p_deep) {
- bool is_call_chain_end = recursion_count == 0;
+ bool is_call_chain_end = p_recursion_count == 0;
- recursion_count++;
+ p_recursion_count++;
int element_count = size();
new_arr.resize(element_count);
Variant *write = new_arr._p->array.ptrw();
for (int i = 0; i < element_count; i++) {
- write[i] = get(i).recursive_duplicate(true, p_deep_subresources_mode, recursion_count);
+ write[i] = get(i).recursive_duplicate(true, p_deep_subresources_mode, p_recursion_count);
}
// Variant::recursive_duplicate() may have created a remap cache by now.
diff --git a/core/variant/array.h b/core/variant/array.h
index cd2a1c081e7..6ec2a7ef931 100644
--- a/core/variant/array.h
+++ b/core/variant/array.h
@@ -111,10 +111,10 @@ public:
bool operator==(const Array &p_array) const;
bool operator!=(const Array &p_array) const;
- bool recursive_equal(const Array &p_array, int recursion_count) const;
+ bool recursive_equal(const Array &p_array, int p_recursion_count) const;
uint32_t hash() const;
- uint32_t recursive_hash(int recursion_count) const;
+ uint32_t recursive_hash(int p_recursion_count) const;
void operator=(const Array &p_array);
void assign(const Array &p_array);
@@ -155,7 +155,7 @@ public:
Array duplicate(bool p_deep = false) const;
Array duplicate_deep(ResourceDeepDuplicateMode p_deep_subresources_mode = RESOURCE_DEEP_DUPLICATE_INTERNAL) const;
- Array recursive_duplicate(bool p_deep, ResourceDeepDuplicateMode p_deep_subresources_mode, int recursion_count) const;
+ Array recursive_duplicate(bool p_deep, ResourceDeepDuplicateMode p_deep_subresources_mode, int p_recursion_count) const;
Array slice(int p_begin, int p_end = INT_MAX, int p_step = 1, bool p_deep = false) const;
Array filter(const Callable &p_callable) const;
diff --git a/core/variant/binder_common.h b/core/variant/binder_common.h
index 1a1e0148f40..85e06a2a995 100644
--- a/core/variant/binder_common.h
+++ b/core/variant/binder_common.h
@@ -174,7 +174,7 @@ void call_with_variant_args(T *p_instance, void (T::*p_method)(P...), const Vari
}
template <typename T, typename... P>
-void call_with_variant_args_dv(T *p_instance, void (T::*p_method)(P...), const Variant **p_args, int p_argcount, Callable::CallError &r_error, const Vector<Variant> &default_values) {
+void call_with_variant_args_dv(T *p_instance, void (T::*p_method)(P...), const Variant **p_args, int p_argcount, Callable::CallError &r_error, const Vector<Variant> &p_default_values) {
#ifdef DEBUG_ENABLED
if ((size_t)p_argcount > sizeof...(P)) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
@@ -185,7 +185,7 @@ void call_with_variant_args_dv(T *p_instance, void (T::*p_method)(P...), const V
int32_t missing = (int32_t)sizeof...(P) - (int32_t)p_argcount;
- int32_t dvs = default_values.size();
+ int32_t dvs = p_default_values.size();
#ifdef DEBUG_ENABLED
if (missing > dvs) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
@@ -199,7 +199,7 @@ void call_with_variant_args_dv(T *p_instance, void (T::*p_method)(P...), const V
if (i < p_argcount) {
args[i] = p_args[i];
} else {
- args[i] = &default_values[i - p_argcount + (dvs - missing)];
+ args[i] = &p_default_values[i - p_argcount + (dvs - missing)];
}
}
@@ -225,7 +225,7 @@ void call_with_variant_argsc(T *p_instance, void (T::*p_method)(P...) const, con
}
template <typename T, typename... P>
-void call_with_variant_argsc_dv(T *p_instance, void (T::*p_method)(P...) const, const Variant **p_args, int p_argcount, Callable::CallError &r_error, const Vector<Variant> &default_values) {
+void call_with_variant_argsc_dv(T *p_instance, void (T::*p_method)(P...) const, const Variant **p_args, int p_argcount, Callable::CallError &r_error, const Vector<Variant> &p_default_values) {
#ifdef DEBUG_ENABLED
if ((size_t)p_argcount > sizeof...(P)) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
@@ -236,7 +236,7 @@ void call_with_variant_argsc_dv(T *p_instance, void (T::*p_method)(P...) const,
int32_t missing = (int32_t)sizeof...(P) - (int32_t)p_argcount;
- int32_t dvs = default_values.size();
+ int32_t dvs = p_default_values.size();
#ifdef DEBUG_ENABLED
if (missing > dvs) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
@@ -250,7 +250,7 @@ void call_with_variant_argsc_dv(T *p_instance, void (T::*p_method)(P...) const,
if (i < p_argcount) {
args[i] = p_args[i];
} else {
- args[i] = &default_values[i - p_argcount + (dvs - missing)];
+ args[i] = &p_default_values[i - p_argcount + (dvs - missing)];
}
}
@@ -258,7 +258,7 @@ void call_with_variant_argsc_dv(T *p_instance, void (T::*p_method)(P...) const,
}
template <typename T, typename R, typename... P>
-void call_with_variant_args_ret_dv(T *p_instance, R (T::*p_method)(P...), const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error, const Vector<Variant> &default_values) {
+void call_with_variant_args_ret_dv(T *p_instance, R (T::*p_method)(P...), const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error, const Vector<Variant> &p_default_values) {
#ifdef DEBUG_ENABLED
if ((size_t)p_argcount > sizeof...(P)) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
@@ -269,7 +269,7 @@ void call_with_variant_args_ret_dv(T *p_instance, R (T::*p_method)(P...), const
int32_t missing = (int32_t)sizeof...(P) - (int32_t)p_argcount;
- int32_t dvs = default_values.size();
+ int32_t dvs = p_default_values.size();
#ifdef DEBUG_ENABLED
if (missing > dvs) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
@@ -283,7 +283,7 @@ void call_with_variant_args_ret_dv(T *p_instance, R (T::*p_method)(P...), const
if (i < p_argcount) {
args[i] = p_args[i];
} else {
- args[i] = &default_values[i - p_argcount + (dvs - missing)];
+ args[i] = &p_default_values[i - p_argcount + (dvs - missing)];
}
}
@@ -291,7 +291,7 @@ void call_with_variant_args_ret_dv(T *p_instance, R (T::*p_method)(P...), const
}
template <typename T, typename R, typename... P>
-void call_with_variant_args_retc_dv(T *p_instance, R (T::*p_method)(P...) const, const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error, const Vector<Variant> &default_values) {
+void call_with_variant_args_retc_dv(T *p_instance, R (T::*p_method)(P...) const, const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error, const Vector<Variant> &p_default_values) {
#ifdef DEBUG_ENABLED
if ((size_t)p_argcount > sizeof...(P)) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
@@ -302,7 +302,7 @@ void call_with_variant_args_retc_dv(T *p_instance, R (T::*p_method)(P...) const,
int32_t missing = (int32_t)sizeof...(P) - (int32_t)p_argcount;
- int32_t dvs = default_values.size();
+ int32_t dvs = p_default_values.size();
#ifdef DEBUG_ENABLED
if (missing > dvs) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
@@ -316,7 +316,7 @@ void call_with_variant_args_retc_dv(T *p_instance, R (T::*p_method)(P...) const,
if (i < p_argcount) {
args[i] = p_args[i];
} else {
- args[i] = &default_values[i - p_argcount + (dvs - missing)];
+ args[i] = &p_default_values[i - p_argcount + (dvs - missing)];
}
}
@@ -366,28 +366,28 @@ void call_with_ptr_args_static_method(void (*p_method)(P...), const void **p_arg
// Validated
template <typename T, typename... P>
-void call_with_validated_variant_args(Variant *base, void (T::*p_method)(P...), const Variant **p_args) {
- call_with_validated_variant_args_helper<T, P...>(&VariantInternalAccessor<T>::get(base), p_method, p_args, BuildIndexSequence<sizeof...(P)>{});
+void call_with_validated_variant_args(Variant *p_base, void (T::*p_method)(P...), const Variant **p_args) {
+ call_with_validated_variant_args_helper<T, P...>(&VariantInternalAccessor<T>::get(p_base), p_method, p_args, BuildIndexSequence<sizeof...(P)>{});
}
template <typename T, typename R, typename... P>
-void call_with_validated_variant_args_ret(Variant *base, R (T::*p_method)(P...), const Variant **p_args, Variant *r_ret) {
- call_with_validated_variant_args_ret_helper<T, R, P...>(&VariantInternalAccessor<T>::get(base), p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
+void call_with_validated_variant_args_ret(Variant *p_base, R (T::*p_method)(P...), const Variant **p_args, Variant *r_ret) {
+ call_with_validated_variant_args_ret_helper<T, R, P...>(&VariantInternalAccessor<T>::get(p_base), p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
}
template <typename T, typename R, typename... P>
-void call_with_validated_variant_args_retc(Variant *base, R (T::*p_method)(P...) const, const Variant **p_args, Variant *r_ret) {
- call_with_validated_variant_args_retc_helper<T, R, P...>(&VariantInternalAccessor<T>::get(base), p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
+void call_with_validated_variant_args_retc(Variant *p_base, R (T::*p_method)(P...) const, const Variant **p_args, Variant *r_ret) {
+ call_with_validated_variant_args_retc_helper<T, R, P...>(&VariantInternalAccessor<T>::get(p_base), p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
}
template <typename T, typename... P>
-void call_with_validated_variant_args_static(Variant *base, void (*p_method)(T *, P...), const Variant **p_args) {
- call_with_validated_variant_args_static_helper<T, P...>(&VariantInternalAccessor<T>::get(base), p_method, p_args, BuildIndexSequence<sizeof...(P)>{});
+void call_with_validated_variant_args_static(Variant *p_base, void (*p_method)(T *, P...), const Variant **p_args) {
+ call_with_validated_variant_args_static_helper<T, P...>(&VariantInternalAccessor<T>::get(p_base), p_method, p_args, BuildIndexSequence<sizeof...(P)>{});
}
template <typename T, typename R, typename... P>
-void call_with_validated_variant_args_static_retc(Variant *base, R (*p_method)(T *, P...), const Variant **p_args, Variant *r_ret) {
- call_with_validated_variant_args_static_retc_helper<T, R, P...>(&VariantInternalAccessor<T>::get(base), p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
+void call_with_validated_variant_args_static_retc(Variant *p_base, R (*p_method)(T *, P...), const Variant **p_args, Variant *r_ret) {
+ call_with_validated_variant_args_static_retc_helper<T, R, P...>(&VariantInternalAccessor<T>::get(p_base), p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
}
template <typename... P>
@@ -403,33 +403,33 @@ void call_with_validated_variant_args_static_method_ret(R (*p_method)(P...), con
// Validated Object
template <typename T, typename... P>
-void call_with_validated_object_instance_args(T *base, void (T::*p_method)(P...), const Variant **p_args) {
- call_with_validated_variant_args_helper<T, P...>(base, p_method, p_args, BuildIndexSequence<sizeof...(P)>{});
+void call_with_validated_object_instance_args(T *p_base, void (T::*p_method)(P...), const Variant **p_args) {
+ call_with_validated_variant_args_helper<T, P...>(p_base, p_method, p_args, BuildIndexSequence<sizeof...(P)>{});
}
template <typename T, typename... P>
-void call_with_validated_object_instance_argsc(T *base, void (T::*p_method)(P...) const, const Variant **p_args) {
- call_with_validated_variant_argsc_helper<T, P...>(base, p_method, p_args, BuildIndexSequence<sizeof...(P)>{});
+void call_with_validated_object_instance_argsc(T *p_base, void (T::*p_method)(P...) const, const Variant **p_args) {
+ call_with_validated_variant_argsc_helper<T, P...>(p_base, p_method, p_args, BuildIndexSequence<sizeof...(P)>{});
}
template <typename T, typename R, typename... P>
-void call_with_validated_object_instance_args_ret(T *base, R (T::*p_method)(P...), const Variant **p_args, Variant *r_ret) {
- call_with_validated_variant_args_ret_helper<T, R, P...>(base, p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
+void call_with_validated_object_instance_args_ret(T *p_base, R (T::*p_method)(P...), const Variant **p_args, Variant *r_ret) {
+ call_with_validated_variant_args_ret_helper<T, R, P...>(p_base, p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
}
template <typename T, typename R, typename... P>
-void call_with_validated_object_instance_args_retc(T *base, R (T::*p_method)(P...) const, const Variant **p_args, Variant *r_ret) {
- call_with_validated_variant_args_retc_helper<T, R, P...>(base, p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
+void call_with_validated_object_instance_args_retc(T *p_base, R (T::*p_method)(P...) const, const Variant **p_args, Variant *r_ret) {
+ call_with_validated_variant_args_retc_helper<T, R, P...>(p_base, p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
}
template <typename T, typename... P>
-void call_with_validated_object_instance_args_static(T *base, void (*p_method)(T *, P...), const Variant **p_args) {
- call_with_validated_variant_args_static_helper<T, P...>(base, p_method, p_args, BuildIndexSequence<sizeof...(P)>{});
+void call_with_validated_object_instance_args_static(T *p_base, void (*p_method)(T *, P...), const Variant **p_args) {
+ call_with_validated_variant_args_static_helper<T, P...>(p_base, p_method, p_args, BuildIndexSequence<sizeof...(P)>{});
}
template <typename T, typename R, typename... P>
-void call_with_validated_object_instance_args_static_retc(T *base, R (*p_method)(T *, P...), const Variant **p_args, Variant *r_ret) {
- call_with_validated_variant_args_static_retc_helper<T, R, P...>(base, p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
+void call_with_validated_object_instance_args_static_retc(T *p_base, R (*p_method)(T *, P...), const Variant **p_args, Variant *r_ret) {
+ call_with_validated_variant_args_static_retc_helper<T, R, P...>(p_base, p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
}
// GCC raises "parameter 'p_args' set but not used" when P = {},
@@ -437,11 +437,11 @@ void call_with_validated_object_instance_args_static_retc(T *base, R (*p_method)
GODOT_GCC_WARNING_PUSH_AND_IGNORE("-Wunused-but-set-parameter")
template <typename Q>
-void call_get_argument_type_helper(int p_arg, int &index, Variant::Type &type) {
- if (p_arg == index) {
- type = GetTypeInfo<Q>::VARIANT_TYPE;
+void call_get_argument_type_helper(int p_arg, int &r_index, Variant::Type &r_type) {
+ if (p_arg == r_index) {
+ r_type = GetTypeInfo<Q>::VARIANT_TYPE;
}
- index++;
+ r_index++;
}
template <typename... P>
@@ -457,30 +457,30 @@ Variant::Type call_get_argument_type(int p_arg) {
}
template <typename Q>
-void call_get_argument_type_info_helper(int p_arg, int &index, PropertyInfo &info) {
- if (p_arg == index) {
- info = GetTypeInfo<Q>::get_class_info();
+void call_get_argument_type_info_helper(int p_arg, int &r_index, PropertyInfo &r_info) {
+ if (p_arg == r_index) {
+ r_info = GetTypeInfo<Q>::get_class_info();
}
- index++;
+ r_index++;
}
template <typename... P>
-void call_get_argument_type_info(int p_arg, PropertyInfo &info) {
+void call_get_argument_type_info(int p_arg, PropertyInfo &r_info) {
int index = 0;
// I think rocket science is simpler than modern C++.
using expand_type = int[];
- expand_type a{ 0, (call_get_argument_type_info_helper<P>(p_arg, index, info), 0)... };
+ expand_type a{ 0, (call_get_argument_type_info_helper<P>(p_arg, index, r_info), 0)... };
(void)a; // Suppress (valid, but unavoidable) -Wunused-variable warning.
(void)index; // Suppress GCC warning.
}
#ifdef DEBUG_ENABLED
template <typename Q>
-void call_get_argument_metadata_helper(int p_arg, int &index, GodotTypeInfo::Metadata &md) {
- if (p_arg == index) {
- md = GetTypeInfo<Q>::METADATA;
+void call_get_argument_metadata_helper(int p_arg, int &r_index, GodotTypeInfo::Metadata &r_metadata) {
+ if (p_arg == r_index) {
+ r_metadata = GetTypeInfo<Q>::METADATA;
}
- index++;
+ r_index++;
}
template <typename... P>
@@ -631,7 +631,7 @@ void call_with_variant_args_retc_static_helper(T *p_instance, R (*p_method)(T *,
}
template <typename T, typename R, typename... P>
-void call_with_variant_args_retc_static_helper_dv(T *p_instance, R (*p_method)(T *, P...), const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &default_values, Callable::CallError &r_error) {
+void call_with_variant_args_retc_static_helper_dv(T *p_instance, R (*p_method)(T *, P...), const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_default_values, Callable::CallError &r_error) {
#ifdef DEBUG_ENABLED
if ((size_t)p_argcount > sizeof...(P)) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
@@ -642,7 +642,7 @@ void call_with_variant_args_retc_static_helper_dv(T *p_instance, R (*p_method)(T
int32_t missing = (int32_t)sizeof...(P) - (int32_t)p_argcount;
- int32_t dvs = default_values.size();
+ int32_t dvs = p_default_values.size();
#ifdef DEBUG_ENABLED
if (missing > dvs) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
@@ -656,7 +656,7 @@ void call_with_variant_args_retc_static_helper_dv(T *p_instance, R (*p_method)(T
if (i < p_argcount) {
args[i] = p_args[i];
} else {
- args[i] = &default_values[i - p_argcount + (dvs - missing)];
+ args[i] = &p_default_values[i - p_argcount + (dvs - missing)];
}
}
@@ -677,7 +677,7 @@ void call_with_variant_args_static_helper(T *p_instance, void (*p_method)(T *, P
}
template <typename T, typename... P>
-void call_with_variant_args_static_helper_dv(T *p_instance, void (*p_method)(T *, P...), const Variant **p_args, int p_argcount, const Vector<Variant> &default_values, Callable::CallError &r_error) {
+void call_with_variant_args_static_helper_dv(T *p_instance, void (*p_method)(T *, P...), const Variant **p_args, int p_argcount, const Vector<Variant> &p_default_values, Callable::CallError &r_error) {
#ifdef DEBUG_ENABLED
if ((size_t)p_argcount > sizeof...(P)) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
@@ -688,7 +688,7 @@ void call_with_variant_args_static_helper_dv(T *p_instance, void (*p_method)(T *
int32_t missing = (int32_t)sizeof...(P) - (int32_t)p_argcount;
- int32_t dvs = default_values.size();
+ int32_t dvs = p_default_values.size();
#ifdef DEBUG_ENABLED
if (missing > dvs) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
@@ -702,7 +702,7 @@ void call_with_variant_args_static_helper_dv(T *p_instance, void (*p_method)(T *
if (i < p_argcount) {
args[i] = p_args[i];
} else {
- args[i] = &default_values[i - p_argcount + (dvs - missing)];
+ args[i] = &p_default_values[i - p_argcount + (dvs - missing)];
}
}
@@ -710,7 +710,7 @@ void call_with_variant_args_static_helper_dv(T *p_instance, void (*p_method)(T *
}
template <typename R, typename... P>
-void call_with_variant_args_static_ret_dv(R (*p_method)(P...), const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error, const Vector<Variant> &default_values) {
+void call_with_variant_args_static_ret_dv(R (*p_method)(P...), const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error, const Vector<Variant> &p_default_values) {
#ifdef DEBUG_ENABLED
if ((size_t)p_argcount > sizeof...(P)) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
@@ -721,7 +721,7 @@ void call_with_variant_args_static_ret_dv(R (*p_method)(P...), const Variant **p
int32_t missing = (int32_t)sizeof...(P) - (int32_t)p_argcount;
- int32_t dvs = default_values.size();
+ int32_t dvs = p_default_values.size();
#ifdef DEBUG_ENABLED
if (missing > dvs) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
@@ -735,7 +735,7 @@ void call_with_variant_args_static_ret_dv(R (*p_method)(P...), const Variant **p
if (i < p_argcount) {
args[i] = p_args[i];
} else {
- args[i] = &default_values[i - p_argcount + (dvs - missing)];
+ args[i] = &p_default_values[i - p_argcount + (dvs - missing)];
}
}
@@ -743,7 +743,7 @@ void call_with_variant_args_static_ret_dv(R (*p_method)(P...), const Variant **p
}
template <typename... P>
-void call_with_variant_args_static_dv(void (*p_method)(P...), const Variant **p_args, int p_argcount, Callable::CallError &r_error, const Vector<Variant> &default_values) {
+void call_with_variant_args_static_dv(void (*p_method)(P...), const Variant **p_args, int p_argcount, Callable::CallError &r_error, const Vector<Variant> &p_default_values) {
#ifdef DEBUG_ENABLED
if ((size_t)p_argcount > sizeof...(P)) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
@@ -754,7 +754,7 @@ void call_with_variant_args_static_dv(void (*p_method)(P...), const Variant **p_
int32_t missing = (int32_t)sizeof...(P) - (int32_t)p_argcount;
- int32_t dvs = default_values.size();
+ int32_t dvs = p_default_values.size();
#ifdef DEBUG_ENABLED
if (missing > dvs) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
@@ -768,7 +768,7 @@ void call_with_variant_args_static_dv(void (*p_method)(P...), const Variant **p_
if (i < p_argcount) {
args[i] = p_args[i];
} else {
- args[i] = &default_values[i - p_argcount + (dvs - missing)];
+ args[i] = &p_default_values[i - p_argcount + (dvs - missing)];
}
}
diff --git a/core/variant/container_type_validate.h b/core/variant/container_type_validate.h
index ac2d4cc6369..545a57d4f41 100644
--- a/core/variant/container_type_validate.h
+++ b/core/variant/container_type_validate.h
@@ -47,30 +47,30 @@ struct ContainerTypeValidate {
const char *where = "container";
private:
- _FORCE_INLINE_ bool _internal_validate(Variant &inout_variant, const char *p_operation, bool p_output_errors) const {
+ _FORCE_INLINE_ bool _internal_validate(Variant &r_inout_variant, const char *p_operation, bool p_output_errors) const {
if (type == Variant::NIL) {
return true;
}
- if (type != inout_variant.get_type()) {
- if (inout_variant.get_type() == Variant::NIL && type == Variant::OBJECT) {
+ if (type != r_inout_variant.get_type()) {
+ if (r_inout_variant.get_type() == Variant::NIL && type == Variant::OBJECT) {
return true;
}
- if (Variant::can_convert_strict(inout_variant.get_type(), type)) {
+ if (Variant::can_convert_strict(r_inout_variant.get_type(), type)) {
Variant converted_to;
- const Variant *converted_from = &inout_variant;
+ const Variant *converted_from = &r_inout_variant;
Callable::CallError call_error;
Variant::construct(type, converted_to, &converted_from, 1, call_error);
if (call_error.error == Callable::CallError::CALL_OK) {
- inout_variant = converted_to;
+ r_inout_variant = converted_to;
return true;
}
}
if (p_output_errors) {
- ERR_FAIL_V_MSG(false, vformat("Attempted to %s a variable of type '%s' into a %s of incompatible type '%s'.", String(p_operation), Variant::get_type_name(inout_variant.get_type()), where, Variant::get_type_name(type)));
+ ERR_FAIL_V_MSG(false, vformat("Attempted to %s a variable of type '%s' into a %s of incompatible type '%s'.", String(p_operation), Variant::get_type_name(r_inout_variant.get_type()), where, Variant::get_type_name(type)));
} else {
return false;
}
@@ -80,7 +80,7 @@ private:
return true;
}
- return _internal_validate_object(inout_variant, p_operation, p_output_errors);
+ return _internal_validate_object(r_inout_variant, p_operation, p_output_errors);
}
_FORCE_INLINE_ bool _internal_validate_object(const Variant &p_variant, const char *p_operation, bool p_output_errors) const {
@@ -150,8 +150,8 @@ private:
}
public:
- _FORCE_INLINE_ bool validate(Variant &inout_variant, const char *p_operation = "use") const {
- return _internal_validate(inout_variant, p_operation, true);
+ _FORCE_INLINE_ bool validate(Variant &r_inout_variant, const char *p_operation = "use") const {
+ return _internal_validate(r_inout_variant, p_operation, true);
}
_FORCE_INLINE_ bool validate_object(const Variant &p_variant, const char *p_operation = "use") const {
diff --git a/core/variant/dictionary.cpp b/core/variant/dictionary.cpp
index 9ca4ba2a569..bc59d95c036 100644
--- a/core/variant/dictionary.cpp
+++ b/core/variant/dictionary.cpp
@@ -260,7 +260,7 @@ bool Dictionary::operator!=(const Dictionary &p_dictionary) const {
return !recursive_equal(p_dictionary, 0);
}
-bool Dictionary::recursive_equal(const Dictionary &p_dictionary, int recursion_count) const {
+bool Dictionary::recursive_equal(const Dictionary &p_dictionary, int p_recursion_count) const {
// Cheap checks
if (_p == p_dictionary._p) {
return true;
@@ -270,14 +270,14 @@ bool Dictionary::recursive_equal(const Dictionary &p_dictionary, int recursion_c
}
// Heavy O(n) check
- if (recursion_count > MAX_RECURSION) {
+ if (p_recursion_count > MAX_RECURSION) {
ERR_PRINT("Max recursion reached");
return true;
}
- recursion_count++;
+ p_recursion_count++;
for (const KeyValue<Variant, Variant> &this_E : _p->variant_map) {
HashMap<Variant, Variant, HashMapHasherDefault, StringLikeVariantComparator>::ConstIterator other_E(p_dictionary._p->variant_map.find(this_E.key));
- if (!other_E || !this_E.value.hash_compare(other_E->value, recursion_count, false)) {
+ if (!other_E || !this_E.value.hash_compare(other_E->value, p_recursion_count, false)) {
return false;
}
}
@@ -366,18 +366,18 @@ uint32_t Dictionary::hash() const {
return recursive_hash(0);
}
-uint32_t Dictionary::recursive_hash(int recursion_count) const {
- if (recursion_count > MAX_RECURSION) {
+uint32_t Dictionary::recursive_hash(int p_recursion_count) const {
+ if (p_recursion_count > MAX_RECURSION) {
ERR_PRINT("Max recursion reached");
return 0;
}
uint32_t h = hash_murmur3_one_32(Variant::DICTIONARY);
- recursion_count++;
+ p_recursion_count++;
for (const KeyValue<Variant, Variant> &E : _p->variant_map) {
- h = hash_murmur3_one_32(E.key.recursive_hash(recursion_count), h);
- h = hash_murmur3_one_32(E.value.recursive_hash(recursion_count), h);
+ h = hash_murmur3_one_32(E.key.recursive_hash(p_recursion_count), h);
+ h = hash_murmur3_one_32(E.value.recursive_hash(p_recursion_count), h);
}
return hash_fmix32(h);
@@ -605,23 +605,23 @@ bool Dictionary::is_read_only() const {
return _p->read_only != nullptr;
}
-Dictionary Dictionary::recursive_duplicate(bool p_deep, ResourceDeepDuplicateMode p_deep_subresources_mode, int recursion_count) const {
+Dictionary Dictionary::recursive_duplicate(bool p_deep, ResourceDeepDuplicateMode p_deep_subresources_mode, int p_recursion_count) const {
Dictionary n;
n._p->typed_key = _p->typed_key;
n._p->typed_value = _p->typed_value;
- if (recursion_count > MAX_RECURSION) {
+ if (p_recursion_count > MAX_RECURSION) {
ERR_PRINT("Max recursion reached");
return n;
}
n.reserve(_p->variant_map.size());
if (p_deep) {
- bool is_call_chain_end = recursion_count == 0;
+ bool is_call_chain_end = p_recursion_count == 0;
- recursion_count++;
+ p_recursion_count++;
for (const KeyValue<Variant, Variant> &E : _p->variant_map) {
- n[E.key.recursive_duplicate(true, p_deep_subresources_mode, recursion_count)] = E.value.recursive_duplicate(true, p_deep_subresources_mode, recursion_count);
+ n[E.key.recursive_duplicate(true, p_deep_subresources_mode, p_recursion_count)] = E.value.recursive_duplicate(true, p_deep_subresources_mode, p_recursion_count);
}
// Variant::recursive_duplicate() may have created a remap cache by now.
diff --git a/core/variant/dictionary.h b/core/variant/dictionary.h
index e70dadbac29..e2526a36f6b 100644
--- a/core/variant/dictionary.h
+++ b/core/variant/dictionary.h
@@ -86,10 +86,10 @@ public:
bool operator==(const Dictionary &p_dictionary) const;
bool operator!=(const Dictionary &p_dictionary) const;
- bool recursive_equal(const Dictionary &p_dictionary, int recursion_count) const;
+ bool recursive_equal(const Dictionary &p_dictionary, int p_recursion_count) const;
uint32_t hash() const;
- uint32_t recursive_hash(int recursion_count) const;
+ uint32_t recursive_hash(int p_recursion_count) const;
void operator=(const Dictionary &p_dictionary);
void assign(const Dictionary &p_dictionary);
@@ -100,7 +100,7 @@ public:
Dictionary duplicate(bool p_deep = false) const;
Dictionary duplicate_deep(ResourceDeepDuplicateMode p_deep_subresources_mode = RESOURCE_DEEP_DUPLICATE_INTERNAL) const;
- Dictionary recursive_duplicate(bool p_deep, ResourceDeepDuplicateMode p_deep_subresources_mode, int recursion_count) const;
+ Dictionary recursive_duplicate(bool p_deep, ResourceDeepDuplicateMode p_deep_subresources_mode, int p_recursion_count) const;
void set_typed(const ContainerType &p_key_type, const ContainerType &p_value_type);
void set_typed(uint32_t p_key_type, const StringName &p_key_class_name, const Variant &p_key_script, uint32_t p_value_type, const StringName &p_value_class_name, const Variant &p_value_script);
diff --git a/core/variant/native_ptr.h b/core/variant/native_ptr.h
index db2531dc330..e2cc3fad9ff 100644
--- a/core/variant/native_ptr.h
+++ b/core/variant/native_ptr.h
@@ -91,11 +91,11 @@ struct VariantCaster<GDExtensionPtr<T>> {
template <typename T>
struct VariantInternalAccessor<GDExtensionPtr<T>> {
- static _FORCE_INLINE_ const GDExtensionPtr<T> &get(const Variant *v) {
- return *reinterpret_cast<const GDExtensionPtr<T> *>(VariantInternal::get_int(v));
+ static _FORCE_INLINE_ const GDExtensionPtr<T> &get(const Variant *p_variant) {
+ return *reinterpret_cast<const GDExtensionPtr<T> *>(VariantInternal::get_int(p_variant));
}
- static _FORCE_INLINE_ void set(Variant *v, const GDExtensionPtr<T> &p_value) {
- *VariantInternal::get_int(v) = uint64_t(p_value.data);
+ static _FORCE_INLINE_ void set(Variant *r_variant, const GDExtensionPtr<T> &p_value) {
+ *VariantInternal::get_int(r_variant) = uint64_t(p_value.data);
}
};
diff --git a/core/variant/type_info.h b/core/variant/type_info.h
index ba254e9dd62..f6e65d406c1 100644
--- a/core/variant/type_info.h
+++ b/core/variant/type_info.h
@@ -256,7 +256,7 @@ inline String enum_qualified_name_to_class_info_name(const String &p_qualified_n
};
template <typename T>
-inline StringName __constant_get_enum_name(T param) {
+inline StringName __constant_get_enum_name(T p_param) {
return GetTypeInfo<T>::get_class_info().class_name;
}
@@ -285,7 +285,7 @@ inline StringName __constant_get_enum_value_name(const char *p_name) {
};
template <typename T>
-inline StringName __constant_get_bitfield_name(T param) {
+inline StringName __constant_get_bitfield_name(T p_param) {
return GetTypeInfo<BitField<T>>::get_class_info().class_name;
}
#define CLASS_INFO(m_type) (GetTypeInfo<m_type *>::get_class_info())
@@ -300,9 +300,9 @@ inline StringName __constant_get_bitfield_name(T param) {
// No initialization by default, except for scalar types.
template <typename T>
struct ZeroInitializer {
- static void initialize(T &value) {
+ static void initialize(T &r_value) {
if constexpr (std::is_scalar_v<T>) {
- value = {};
+ r_value = {};
}
}
};
diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp
index 5d390a0db18..529c5f4f4ab 100644
--- a/core/variant/variant.cpp
+++ b/core/variant/variant.cpp
@@ -1578,8 +1578,8 @@ struct _VariantStrPair {
String key;
String value;
- bool operator<(const _VariantStrPair &p) const {
- return key < p.key;
+ bool operator<(const _VariantStrPair &p_pair) const {
+ return key < p_pair.key;
}
};
@@ -1587,8 +1587,8 @@ Variant::operator String() const {
return stringify(0);
}
-String stringify_variant_clean(const Variant &p_variant, int recursion_count) {
- String s = p_variant.stringify(recursion_count);
+String stringify_variant_clean(const Variant &p_variant, int p_recursion_count) {
+ String s = p_variant.stringify(p_recursion_count);
// Wrap strings in quotes to avoid ambiguity.
switch (p_variant.get_type()) {
@@ -1609,20 +1609,20 @@ String stringify_variant_clean(const Variant &p_variant, int recursion_count) {
}
template <typename T>
-String stringify_vector(const T &vec, int recursion_count) {
+String stringify_vector(const T &p_vec, int p_recursion_count) {
String str("[");
- for (int i = 0; i < vec.size(); i++) {
+ for (int i = 0; i < p_vec.size(); i++) {
if (i > 0) {
str += ", ";
}
- str += stringify_variant_clean(vec[i], recursion_count);
+ str += stringify_variant_clean(p_vec[i], p_recursion_count);
}
str += "]";
return str;
}
-String Variant::stringify(int recursion_count) const {
+String Variant::stringify(int p_recursion_count) const {
switch (type) {
case NIL:
return "<null>";
@@ -1671,8 +1671,8 @@ String Variant::stringify(int recursion_count) const {
case COLOR:
return String(operator Color());
case DICTIONARY: {
- ERR_FAIL_COND_V_MSG(recursion_count > MAX_RECURSION, "{ ... }", "Maximum dictionary recursion reached!");
- recursion_count++;
+ ERR_FAIL_COND_V_MSG(p_recursion_count > MAX_RECURSION, "{ ... }", "Maximum dictionary recursion reached!");
+ p_recursion_count++;
const Dictionary &d = *reinterpret_cast<const Dictionary *>(_data._mem);
@@ -1684,8 +1684,8 @@ String Variant::stringify(int recursion_count) const {
for (const KeyValue<Variant, Variant> &kv : d) {
_VariantStrPair sp;
- sp.key = stringify_variant_clean(kv.key, recursion_count);
- sp.value = stringify_variant_clean(kv.value, recursion_count);
+ sp.key = stringify_variant_clean(kv.key, p_recursion_count);
+ sp.value = stringify_variant_clean(kv.value, p_recursion_count);
pairs.push_back(sp);
}
@@ -1702,40 +1702,40 @@ String Variant::stringify(int recursion_count) const {
}
// Packed arrays cannot contain recursive structures, the recursion_count increment is not needed.
case PACKED_VECTOR2_ARRAY: {
- return stringify_vector(operator PackedVector2Array(), recursion_count);
+ return stringify_vector(operator PackedVector2Array(), p_recursion_count);
}
case PACKED_VECTOR3_ARRAY: {
- return stringify_vector(operator PackedVector3Array(), recursion_count);
+ return stringify_vector(operator PackedVector3Array(), p_recursion_count);
}
case PACKED_COLOR_ARRAY: {
- return stringify_vector(operator PackedColorArray(), recursion_count);
+ return stringify_vector(operator PackedColorArray(), p_recursion_count);
}
case PACKED_VECTOR4_ARRAY: {
- return stringify_vector(operator PackedVector4Array(), recursion_count);
+ return stringify_vector(operator PackedVector4Array(), p_recursion_count);
}
case PACKED_STRING_ARRAY: {
- return stringify_vector(operator PackedStringArray(), recursion_count);
+ return stringify_vector(operator PackedStringArray(), p_recursion_count);
}
case PACKED_BYTE_ARRAY: {
- return stringify_vector(operator PackedByteArray(), recursion_count);
+ return stringify_vector(operator PackedByteArray(), p_recursion_count);
}
case PACKED_INT32_ARRAY: {
- return stringify_vector(operator PackedInt32Array(), recursion_count);
+ return stringify_vector(operator PackedInt32Array(), p_recursion_count);
}
case PACKED_INT64_ARRAY: {
- return stringify_vector(operator PackedInt64Array(), recursion_count);
+ return stringify_vector(operator PackedInt64Array(), p_recursion_count);
}
case PACKED_FLOAT32_ARRAY: {
- return stringify_vector(operator PackedFloat32Array(), recursion_count);
+ return stringify_vector(operator PackedFloat32Array(), p_recursion_count);
}
case PACKED_FLOAT64_ARRAY: {
- return stringify_vector(operator PackedFloat64Array(), recursion_count);
+ return stringify_vector(operator PackedFloat64Array(), p_recursion_count);
}
case ARRAY: {
- ERR_FAIL_COND_V_MSG(recursion_count > MAX_RECURSION, "[...]", "Maximum array recursion reached!");
- recursion_count++;
+ ERR_FAIL_COND_V_MSG(p_recursion_count > MAX_RECURSION, "[...]", "Maximum array recursion reached!");
+ p_recursion_count++;
- return stringify_vector(operator Array(), recursion_count);
+ return stringify_vector(operator Array(), p_recursion_count);
}
case OBJECT: {
if (_get_obj().obj) {
@@ -2502,10 +2502,10 @@ Variant::Variant(const Transform3D &p_transform) :
memnew_placement(_data._transform3d, Transform3D(p_transform));
}
-Variant::Variant(const Projection &pp_projection) :
+Variant::Variant(const Projection &p_projection) :
type(PROJECTION) {
_data._projection = VariantPools::alloc<Projection>();
- memnew_placement(_data._projection, Projection(pp_projection));
+ memnew_placement(_data._projection, Projection(p_projection));
}
Variant::Variant(const Transform2D &p_transform) :
@@ -2834,7 +2834,7 @@ uint32_t Variant::hash() const {
return recursive_hash(0);
}
-uint32_t Variant::recursive_hash(int recursion_count) const {
+uint32_t Variant::recursive_hash(int p_recursion_count) const {
switch (type) {
case NIL: {
return 0;
@@ -2985,7 +2985,7 @@ uint32_t Variant::recursive_hash(int recursion_count) const {
return reinterpret_cast<const NodePath *>(_data._mem)->hash();
} break;
case DICTIONARY: {
- return reinterpret_cast<const Dictionary *>(_data._mem)->recursive_hash(recursion_count);
+ return reinterpret_cast<const Dictionary *>(_data._mem)->recursive_hash(p_recursion_count);
} break;
case CALLABLE: {
@@ -2999,7 +2999,7 @@ uint32_t Variant::recursive_hash(int recursion_count) const {
} break;
case ARRAY: {
const Array &arr = *reinterpret_cast<const Array *>(_data._mem);
- return arr.recursive_hash(recursion_count);
+ return arr.recursive_hash(p_recursion_count);
} break;
case PACKED_BYTE_ARRAY: {
@@ -3201,7 +3201,7 @@ uint32_t Variant::recursive_hash(int recursion_count) const {
\
return true
-bool Variant::hash_compare(const Variant &p_variant, int recursion_count, bool semantic_comparison) const {
+bool Variant::hash_compare(const Variant &p_variant, int p_recursion_count, bool p_semantic_comparison) const {
if (type != p_variant.type) {
return false;
}
@@ -3212,7 +3212,7 @@ bool Variant::hash_compare(const Variant &p_variant, int recursion_count, bool s
} break;
case FLOAT: {
- return hash_compare_scalar_base(_data._float, p_variant._data._float, semantic_comparison);
+ return hash_compare_scalar_base(_data._float, p_variant._data._float, p_semantic_comparison);
} break;
case STRING: {
@@ -3333,7 +3333,7 @@ bool Variant::hash_compare(const Variant &p_variant, int recursion_count, bool s
const Array &l = *(reinterpret_cast<const Array *>(_data._mem));
const Array &r = *(reinterpret_cast<const Array *>(p_variant._data._mem));
- if (!l.recursive_equal(r, recursion_count + 1)) {
+ if (!l.recursive_equal(r, p_recursion_count + 1)) {
return false;
}
@@ -3344,7 +3344,7 @@ bool Variant::hash_compare(const Variant &p_variant, int recursion_count, bool s
const Dictionary &l = *(reinterpret_cast<const Dictionary *>(_data._mem));
const Dictionary &r = *(reinterpret_cast<const Dictionary *>(p_variant._data._mem));
- if (!l.recursive_equal(r, recursion_count + 1)) {
+ if (!l.recursive_equal(r, p_recursion_count + 1)) {
return false;
}
@@ -3500,10 +3500,10 @@ bool Variant::is_read_only() const {
}
}
-void Variant::_variant_call_error(const String &p_method, Callable::CallError &error) {
- switch (error.error) {
+void Variant::_variant_call_error(const String &p_method, Callable::CallError &r_error) {
+ switch (r_error.error) {
case Callable::CallError::CALL_ERROR_INVALID_ARGUMENT: {
- String err = "Invalid type for argument #" + itos(error.argument) + ", expected '" + Variant::get_type_name(Variant::Type(error.expected)) + "'.";
+ String err = "Invalid type for argument #" + itos(r_error.argument) + ", expected '" + Variant::get_type_name(Variant::Type(r_error.expected)) + "'.";
ERR_PRINT(err.utf8().get_data());
} break;
@@ -3531,31 +3531,31 @@ String Variant::get_construct_string() const {
return vars;
}
-String Variant::get_call_error_text(const StringName &p_method, const Variant **p_argptrs, int p_argcount, const Callable::CallError &ce) {
- return get_call_error_text(nullptr, p_method, p_argptrs, p_argcount, ce);
+String Variant::get_call_error_text(const StringName &p_method, const Variant **p_argptrs, int p_argcount, const Callable::CallError &p_ce) {
+ return get_call_error_text(nullptr, p_method, p_argptrs, p_argcount, p_ce);
}
-String Variant::get_call_error_text(Object *p_base, const StringName &p_method, const Variant **p_argptrs, int p_argcount, const Callable::CallError &ce) {
+String Variant::get_call_error_text(Object *p_base, const StringName &p_method, const Variant **p_argptrs, int p_argcount, const Callable::CallError &p_ce) {
String err_text;
- if (ce.error == Callable::CallError::CALL_ERROR_INVALID_ARGUMENT) {
- int errorarg = ce.argument;
+ if (p_ce.error == Callable::CallError::CALL_ERROR_INVALID_ARGUMENT) {
+ int errorarg = p_ce.argument;
if (p_argptrs) {
- err_text = "Cannot convert argument " + itos(errorarg + 1) + " from " + Variant::get_type_name(p_argptrs[errorarg]->get_type()) + " to " + Variant::get_type_name(Variant::Type(ce.expected));
+ err_text = "Cannot convert argument " + itos(errorarg + 1) + " from " + Variant::get_type_name(p_argptrs[errorarg]->get_type()) + " to " + Variant::get_type_name(Variant::Type(p_ce.expected));
} else {
- err_text = "Cannot convert argument " + itos(errorarg + 1) + " from [missing argptr, type unknown] to " + Variant::get_type_name(Variant::Type(ce.expected));
+ err_text = "Cannot convert argument " + itos(errorarg + 1) + " from [missing argptr, type unknown] to " + Variant::get_type_name(Variant::Type(p_ce.expected));
}
- } else if (ce.error == Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) {
- err_text = "Method expected " + itos(ce.expected) + " argument(s), but called with " + itos(p_argcount);
- } else if (ce.error == Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) {
- err_text = "Method expected " + itos(ce.expected) + " argument(s), but called with " + itos(p_argcount);
- } else if (ce.error == Callable::CallError::CALL_ERROR_INVALID_METHOD) {
+ } else if (p_ce.error == Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) {
+ err_text = "Method expected " + itos(p_ce.expected) + " argument(s), but called with " + itos(p_argcount);
+ } else if (p_ce.error == Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) {
+ err_text = "Method expected " + itos(p_ce.expected) + " argument(s), but called with " + itos(p_argcount);
+ } else if (p_ce.error == Callable::CallError::CALL_ERROR_INVALID_METHOD) {
err_text = "Method not found";
- } else if (ce.error == Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL) {
+ } else if (p_ce.error == Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL) {
err_text = "Instance is null";
- } else if (ce.error == Callable::CallError::CALL_ERROR_METHOD_NOT_CONST) {
+ } else if (p_ce.error == Callable::CallError::CALL_ERROR_METHOD_NOT_CONST) {
err_text = "Method not const in const instance";
- } else if (ce.error == Callable::CallError::CALL_OK) {
+ } else if (p_ce.error == Callable::CallError::CALL_OK) {
return "Call OK";
}
@@ -3571,7 +3571,7 @@ String Variant::get_call_error_text(Object *p_base, const StringName &p_method,
return "'" + base_text + String(p_method) + "': " + err_text;
}
-String Variant::get_callable_error_text(const Callable &p_callable, const Variant **p_argptrs, int p_argcount, const Callable::CallError &ce) {
+String Variant::get_callable_error_text(const Callable &p_callable, const Variant **p_argptrs, int p_argcount, const Callable::CallError &p_ce) {
Vector<Variant> binds;
p_callable.get_bound_arguments_ref(binds);
@@ -3588,7 +3588,7 @@ String Variant::get_callable_error_text(const Callable &p_callable, const Varian
for (int i = 0; i < binds.size(); i++) {
argptrs.write[i + p_argcount - args_unbound] = &binds[i];
}
- return get_call_error_text(p_callable.get_object(), p_callable.get_method(), (const Variant **)argptrs.ptr(), argptrs.size(), ce);
+ return get_call_error_text(p_callable.get_object(), p_callable.get_method(), (const Variant **)argptrs.ptr(), argptrs.size(), p_ce);
}
}
diff --git a/core/variant/variant.h b/core/variant/variant.h
index 59429ea3801..d4f5d857819 100644
--- a/core/variant/variant.h
+++ b/core/variant/variant.h
@@ -336,7 +336,7 @@ private:
static void _register_variant_utility_functions();
static void _unregister_variant_utility_functions();
- void _variant_call_error(const String &p_method, Callable::CallError &error);
+ void _variant_call_error(const String &p_method, Callable::CallError &r_error);
template <typename T>
_ALWAYS_INLINE_ T _to_int() const {
@@ -611,19 +611,19 @@ public:
}
static Variant::Type get_operator_return_type(Operator p_operator, Type p_type_a, Type p_type_b);
- typedef void (*ValidatedOperatorEvaluator)(const Variant *left, const Variant *right, Variant *r_ret);
+ typedef void (*ValidatedOperatorEvaluator)(const Variant *p_left, const Variant *p_right, Variant *r_ret);
static ValidatedOperatorEvaluator get_validated_operator_evaluator(Operator p_operator, Type p_type_a, Type p_type_b);
- typedef void (*PTROperatorEvaluator)(const void *left, const void *right, void *r_ret);
+ typedef void (*PTROperatorEvaluator)(const void *p_left, const void *p_right, void *r_ret);
static PTROperatorEvaluator get_ptr_operator_evaluator(Operator p_operator, Type p_type_a, Type p_type_b);
void zero();
Variant duplicate(bool p_deep = false) const;
Variant duplicate_deep(ResourceDeepDuplicateMode p_deep_subresources_mode = RESOURCE_DEEP_DUPLICATE_INTERNAL) const;
- Variant recursive_duplicate(bool p_deep, ResourceDeepDuplicateMode p_deep_subresources_mode, int recursion_count) const;
+ Variant recursive_duplicate(bool p_deep, ResourceDeepDuplicateMode p_deep_subresources_mode, int p_recursion_count) const;
/* Built-In Methods */
- typedef void (*ValidatedBuiltInMethod)(Variant *base, const Variant **p_args, int p_argcount, Variant *r_ret);
+ typedef void (*ValidatedBuiltInMethod)(Variant *p_base, const Variant **p_args, int p_argcount, Variant *r_ret);
typedef void (*PTRBuiltInMethod)(void *p_base, const void **p_args, void *r_ret, int p_argcount);
static bool has_builtin_method(Variant::Type p_type, const StringName &p_method);
@@ -668,9 +668,9 @@ public:
void call_const(const StringName &p_method, const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error);
static void call_static(Variant::Type p_type, const StringName &p_method, const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error);
- static String get_call_error_text(const StringName &p_method, const Variant **p_argptrs, int p_argcount, const Callable::CallError &ce);
- static String get_call_error_text(Object *p_base, const StringName &p_method, const Variant **p_argptrs, int p_argcount, const Callable::CallError &ce);
- static String get_callable_error_text(const Callable &p_callable, const Variant **p_argptrs, int p_argcount, const Callable::CallError &ce);
+ static String get_call_error_text(const StringName &p_method, const Variant **p_argptrs, int p_argcount, const Callable::CallError &p_ce);
+ static String get_call_error_text(Object *p_base, const StringName &p_method, const Variant **p_argptrs, int p_argcount, const Callable::CallError &p_ce);
+ static String get_callable_error_text(const Callable &p_callable, const Variant **p_argptrs, int p_argcount, const Callable::CallError &p_ce);
//dynamic (includes Object)
void get_method_list(List<MethodInfo> *p_list) const;
@@ -679,7 +679,7 @@ public:
/* Constructors */
typedef void (*ValidatedConstructor)(Variant *r_base, const Variant **p_args);
- typedef void (*PTRConstructor)(void *base, const void **p_args);
+ typedef void (*PTRConstructor)(void *r_base, const void **p_args);
static int get_constructor_count(Variant::Type p_type);
static ValidatedConstructor get_validated_constructor(Variant::Type p_type, int p_constructor);
@@ -687,14 +687,14 @@ public:
static int get_constructor_argument_count(Variant::Type p_type, int p_constructor);
static Variant::Type get_constructor_argument_type(Variant::Type p_type, int p_constructor, int p_argument);
static String get_constructor_argument_name(Variant::Type p_type, int p_constructor, int p_argument);
- static void construct(Variant::Type, Variant &base, const Variant **p_args, int p_argcount, Callable::CallError &r_error);
+ static void construct(Variant::Type p_type, Variant &r_base, const Variant **p_args, int p_argcount, Callable::CallError &r_error);
static void get_constructor_list(Type p_type, List<MethodInfo> *r_list); //convenience
/* Destructors */
// Only ptrcall is available.
- typedef void (*PTRDestructor)(void *base);
+ typedef void (*PTRDestructor)(void *r_base);
static PTRDestructor get_ptr_destructor(Variant::Type p_type);
static bool has_destructor(Variant::Type p_type);
@@ -704,8 +704,8 @@ public:
void set_named(const StringName &p_member, const Variant &p_value, bool &r_valid);
Variant get_named(const StringName &p_member, bool &r_valid) const;
- typedef void (*ValidatedSetter)(Variant *base, const Variant *value);
- typedef void (*ValidatedGetter)(const Variant *base, Variant *value);
+ typedef void (*ValidatedSetter)(Variant *r_base, const Variant *p_value);
+ typedef void (*ValidatedGetter)(const Variant *p_base, Variant *r_value);
static bool has_member(Variant::Type p_type, const StringName &p_member);
static Variant::Type get_member_type(Variant::Type p_type, const StringName &p_member);
@@ -715,8 +715,8 @@ public:
static ValidatedSetter get_member_validated_setter(Variant::Type p_type, const StringName &p_member);
static ValidatedGetter get_member_validated_getter(Variant::Type p_type, const StringName &p_member);
- typedef void (*PTRSetter)(void *base, const void *value);
- typedef void (*PTRGetter)(const void *base, void *value);
+ typedef void (*PTRSetter)(void *r_base, const void *p_value);
+ typedef void (*PTRGetter)(const void *p_base, void *r_value);
static PTRSetter get_member_ptr_setter(Variant::Type p_type, const StringName &p_member);
static PTRGetter get_member_ptr_getter(Variant::Type p_type, const StringName &p_member);
@@ -727,14 +727,14 @@ public:
static Variant::Type get_indexed_element_type(Variant::Type p_type);
static uint32_t get_indexed_element_usage(Variant::Type p_type);
- typedef void (*ValidatedIndexedSetter)(Variant *base, int64_t index, const Variant *value, bool *oob);
- typedef void (*ValidatedIndexedGetter)(const Variant *base, int64_t index, Variant *value, bool *oob);
+ typedef void (*ValidatedIndexedSetter)(Variant *r_base, int64_t p_index, const Variant *p_value, bool *r_oob);
+ typedef void (*ValidatedIndexedGetter)(const Variant *p_base, int64_t p_index, Variant *r_value, bool *r_oob);
static ValidatedIndexedSetter get_member_validated_indexed_setter(Variant::Type p_type);
static ValidatedIndexedGetter get_member_validated_indexed_getter(Variant::Type p_type);
- typedef void (*PTRIndexedSetter)(void *base, int64_t index, const void *value);
- typedef void (*PTRIndexedGetter)(const void *base, int64_t index, void *value);
+ typedef void (*PTRIndexedSetter)(void *r_base, int64_t p_index, const void *p_value);
+ typedef void (*PTRIndexedGetter)(const void *p_base, int64_t p_index, void *r_value);
static PTRIndexedSetter get_member_ptr_indexed_setter(Variant::Type p_type);
static PTRIndexedGetter get_member_ptr_indexed_getter(Variant::Type p_type);
@@ -748,17 +748,17 @@ public:
static bool is_keyed(Variant::Type p_type);
- typedef void (*ValidatedKeyedSetter)(Variant *base, const Variant *key, const Variant *value, bool *valid);
- typedef void (*ValidatedKeyedGetter)(const Variant *base, const Variant *key, Variant *value, bool *valid);
- typedef bool (*ValidatedKeyedChecker)(const Variant *base, const Variant *key, bool *valid);
+ typedef void (*ValidatedKeyedSetter)(Variant *p_base, const Variant *p_key, const Variant *p_value, bool *r_valid);
+ typedef void (*ValidatedKeyedGetter)(const Variant *p_base, const Variant *p_key, Variant *p_value, bool *r_valid);
+ typedef bool (*ValidatedKeyedChecker)(const Variant *p_base, const Variant *p_key, bool *r_valid);
static ValidatedKeyedSetter get_member_validated_keyed_setter(Variant::Type p_type);
static ValidatedKeyedGetter get_member_validated_keyed_getter(Variant::Type p_type);
static ValidatedKeyedChecker get_member_validated_keyed_checker(Variant::Type p_type);
- typedef void (*PTRKeyedSetter)(void *base, const void *key, const void *value);
- typedef void (*PTRKeyedGetter)(const void *base, const void *key, void *value);
- typedef uint32_t (*PTRKeyedChecker)(const void *base, const void *key);
+ typedef void (*PTRKeyedSetter)(void *p_base, const void *p_key, const void *p_value);
+ typedef void (*PTRKeyedGetter)(const void *p_base, const void *p_key, void *r_value);
+ typedef uint32_t (*PTRKeyedChecker)(const void *p_base, const void *p_key);
static PTRKeyedSetter get_member_ptr_keyed_setter(Variant::Type p_type);
static PTRKeyedGetter get_member_ptr_keyed_getter(Variant::Type p_type);
@@ -781,8 +781,8 @@ public:
GET_NAMED_ERR,
GET_INDEXED_ERR
};
- void set(const Variant &p_index, const Variant &p_value, bool *r_valid = nullptr, VariantSetError *err_code = nullptr);
- Variant get(const Variant &p_index, bool *r_valid = nullptr, VariantGetError *err_code = nullptr) const;
+ void set(const Variant &p_index, const Variant &p_value, bool *r_valid = nullptr, VariantSetError *r_err_code = nullptr);
+ Variant get(const Variant &p_index, bool *r_valid = nullptr, VariantGetError *r_err_code = nullptr) const;
bool in(const Variant &p_index, bool *r_valid = nullptr) const;
bool iter_init(Variant &r_iter, bool &r_valid) const;
@@ -828,13 +828,13 @@ public:
[[nodiscard]] _ALWAYS_INLINE_ bool operator>=(const Variant &p_variant) const { return !(*this < p_variant); }
uint32_t hash() const;
- uint32_t recursive_hash(int recursion_count) const;
+ uint32_t recursive_hash(int p_recursion_count) const;
// Performs a semantic comparison (where NaN == NaN). Falls back to normal equality comparison (OP_EQUAL) when no special handling is needed.
- bool hash_compare(const Variant &p_variant, int recursion_count = 0, bool semantic_comparison = true) const;
+ bool hash_compare(const Variant &p_variant, int p_recursion_count = 0, bool p_semantic_comparison = true) const;
bool identity_compare(const Variant &p_variant) const;
bool booleanize() const;
- String stringify(int recursion_count = 0) const;
+ String stringify(int p_recursion_count = 0) const;
String to_json_string() const;
static void get_constants_for_type(Variant::Type p_type, List<StringName> *p_constants);
@@ -848,8 +848,8 @@ public:
static bool has_enum(Variant::Type p_type, const StringName &p_enum_name);
static StringName get_enum_for_enumeration(Variant::Type p_type, const StringName &p_enumeration);
- typedef String (*ObjectDeConstruct)(const Variant &p_object, void *ud);
- typedef void (*ObjectConstruct)(const String &p_text, void *ud, Variant &r_value);
+ typedef String (*ObjectDeConstruct)(const Variant &p_object, void *p_ud);
+ typedef void (*ObjectConstruct)(const String &p_text, void *p_ud, Variant &r_value);
String get_construct_string() const;
static void construct_from_string(const String &p_string, Variant &r_value, ObjectConstruct p_obj_construct = nullptr, void *p_construct_ud = nullptr);
diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp
index c4904d1a87c..5b61ee5ce72 100644
--- a/core/variant/variant_call.cpp
+++ b/core/variant/variant_call.cpp
@@ -43,339 +43,339 @@ typedef void (*VariantFunc)(Variant &r_ret, Variant &p_self, const Variant **p_a
typedef void (*VariantConstructFunc)(Variant &r_ret, const Variant **p_args);
template <typename R, typename... P>
-static _FORCE_INLINE_ void vc_static_method_call(R (*method)(P...), const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
- call_with_variant_args_static_ret_dv(method, p_args, p_argcount, r_ret, r_error, p_defvals);
+static _FORCE_INLINE_ void vc_static_method_call(R (*p_method)(P...), const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
+ call_with_variant_args_static_ret_dv(p_method, p_args, p_argcount, r_ret, r_error, p_defvals);
}
template <typename... P>
-static _FORCE_INLINE_ void vc_static_method_call(void (*method)(P...), const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
- call_with_variant_args_static_dv(method, p_args, p_argcount, r_error, p_defvals);
+static _FORCE_INLINE_ void vc_static_method_call(void (*p_method)(P...), const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
+ call_with_variant_args_static_dv(p_method, p_args, p_argcount, r_error, p_defvals);
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ void vc_method_call(R (T::*method)(P...), Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
- call_with_variant_args_ret_dv(&VariantInternalAccessor<T>::get(base), method, p_args, p_argcount, r_ret, r_error, p_defvals);
+static _FORCE_INLINE_ void vc_method_call(R (T::*p_method)(P...), Variant *p_base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
+ call_with_variant_args_ret_dv(&VariantInternalAccessor<T>::get(p_base), p_method, p_args, p_argcount, r_ret, r_error, p_defvals);
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ void vc_method_call(R (T::*method)(P...) const, Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
- call_with_variant_args_retc_dv(&VariantInternalAccessor<T>::get(base), method, p_args, p_argcount, r_ret, r_error, p_defvals);
+static _FORCE_INLINE_ void vc_method_call(R (T::*p_method)(P...) const, Variant *p_base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
+ call_with_variant_args_retc_dv(&VariantInternalAccessor<T>::get(p_base), p_method, p_args, p_argcount, r_ret, r_error, p_defvals);
}
template <typename T, typename... P>
-static _FORCE_INLINE_ void vc_method_call(void (T::*method)(P...), Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
+static _FORCE_INLINE_ void vc_method_call(void (T::*p_method)(P...), Variant *p_base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
VariantInternal::clear(&r_ret);
- call_with_variant_args_dv(&VariantInternalAccessor<T>::get(base), method, p_args, p_argcount, r_error, p_defvals);
+ call_with_variant_args_dv(&VariantInternalAccessor<T>::get(p_base), p_method, p_args, p_argcount, r_error, p_defvals);
}
template <typename T, typename... P>
-static _FORCE_INLINE_ void vc_method_call(void (T::*method)(P...) const, Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
+static _FORCE_INLINE_ void vc_method_call(void (T::*p_method)(P...) const, Variant *p_base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
VariantInternal::clear(&r_ret);
- call_with_variant_argsc_dv(&VariantInternalAccessor<T>::get(base), method, p_args, p_argcount, r_error, p_defvals);
+ call_with_variant_argsc_dv(&VariantInternalAccessor<T>::get(p_base), p_method, p_args, p_argcount, r_error, p_defvals);
}
template <typename From, typename R, typename T, typename... P>
-static _FORCE_INLINE_ void vc_convert_method_call(R (T::*method)(P...), Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
- T converted(static_cast<T>(VariantInternalAccessor<From>::get(base)));
- call_with_variant_args_ret_dv(&converted, method, p_args, p_argcount, r_ret, r_error, p_defvals);
+static _FORCE_INLINE_ void vc_convert_method_call(R (T::*p_method)(P...), Variant *p_base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
+ T converted(static_cast<T>(VariantInternalAccessor<From>::get(p_base)));
+ call_with_variant_args_ret_dv(&converted, p_method, p_args, p_argcount, r_ret, r_error, p_defvals);
}
template <typename From, typename R, typename T, typename... P>
-static _FORCE_INLINE_ void vc_convert_method_call(R (T::*method)(P...) const, Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
- T converted(static_cast<T>(VariantInternalAccessor<From>::get(base)));
- call_with_variant_args_retc_dv(&converted, method, p_args, p_argcount, r_ret, r_error, p_defvals);
+static _FORCE_INLINE_ void vc_convert_method_call(R (T::*p_method)(P...) const, Variant *p_base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
+ T converted(static_cast<T>(VariantInternalAccessor<From>::get(p_base)));
+ call_with_variant_args_retc_dv(&converted, p_method, p_args, p_argcount, r_ret, r_error, p_defvals);
}
template <typename From, typename T, typename... P>
-static _FORCE_INLINE_ void vc_convert_method_call(void (T::*method)(P...), Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
- T converted(static_cast<T>(VariantInternalAccessor<From>::get(base)));
- call_with_variant_args_dv(&converted, method, p_args, p_argcount, r_error, p_defvals);
+static _FORCE_INLINE_ void vc_convert_method_call(void (T::*p_method)(P...), Variant *p_base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
+ T converted(static_cast<T>(VariantInternalAccessor<From>::get(p_base)));
+ call_with_variant_args_dv(&converted, p_method, p_args, p_argcount, r_error, p_defvals);
}
template <typename From, typename T, typename... P>
-static _FORCE_INLINE_ void vc_convert_method_call(void (T::*method)(P...) const, Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
- T converted(static_cast<T>(VariantInternalAccessor<From>::get(base)));
- call_with_variant_argsc_dv(&converted, method, p_args, p_argcount, r_error, p_defvals);
+static _FORCE_INLINE_ void vc_convert_method_call(void (T::*p_method)(P...) const, Variant *p_base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
+ T converted(static_cast<T>(VariantInternalAccessor<From>::get(p_base)));
+ call_with_variant_argsc_dv(&converted, p_method, p_args, p_argcount, r_error, p_defvals);
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ void vc_method_call_static(R (*method)(T *, P...), Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
- call_with_variant_args_retc_static_helper_dv(&VariantInternalAccessor<T>::get(base), method, p_args, p_argcount, r_ret, p_defvals, r_error);
+static _FORCE_INLINE_ void vc_method_call_static(R (*p_method)(T *, P...), Variant *p_base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
+ call_with_variant_args_retc_static_helper_dv(&VariantInternalAccessor<T>::get(p_base), p_method, p_args, p_argcount, r_ret, p_defvals, r_error);
}
template <typename T, typename... P>
-static _FORCE_INLINE_ void vc_method_call_static(void (*method)(T *, P...), Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
- call_with_variant_args_static_helper_dv(&VariantInternalAccessor<T>::get(base), method, p_args, p_argcount, p_defvals, r_error);
+static _FORCE_INLINE_ void vc_method_call_static(void (*p_method)(T *, P...), Variant *p_base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
+ call_with_variant_args_static_helper_dv(&VariantInternalAccessor<T>::get(p_base), p_method, p_args, p_argcount, p_defvals, r_error);
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ void vc_validated_call(R (T::*method)(P...), Variant *base, const Variant **p_args, Variant *r_ret) {
- call_with_validated_variant_args_ret(base, method, p_args, r_ret);
+static _FORCE_INLINE_ void vc_validated_call(R (T::*p_method)(P...), Variant *p_base, const Variant **p_args, Variant *r_ret) {
+ call_with_validated_variant_args_ret(p_base, p_method, p_args, r_ret);
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ void vc_validated_call(R (T::*method)(P...) const, Variant *base, const Variant **p_args, Variant *r_ret) {
- call_with_validated_variant_args_retc(base, method, p_args, r_ret);
+static _FORCE_INLINE_ void vc_validated_call(R (T::*p_method)(P...) const, Variant *p_base, const Variant **p_args, Variant *r_ret) {
+ call_with_validated_variant_args_retc(p_base, p_method, p_args, r_ret);
}
template <typename T, typename... P>
-static _FORCE_INLINE_ void vc_validated_call(void (T::*method)(P...), Variant *base, const Variant **p_args, Variant *r_ret) {
- call_with_validated_variant_args(base, method, p_args);
+static _FORCE_INLINE_ void vc_validated_call(void (T::*p_method)(P...), Variant *p_base, const Variant **p_args, Variant *r_ret) {
+ call_with_validated_variant_args(p_base, p_method, p_args);
}
template <typename T, typename... P>
-static _FORCE_INLINE_ void vc_validated_call(void (T::*method)(P...) const, Variant *base, const Variant **p_args, Variant *r_ret) {
- call_with_validated_variant_argsc(base, method, p_args);
+static _FORCE_INLINE_ void vc_validated_call(void (T::*p_method)(P...) const, Variant *p_base, const Variant **p_args, Variant *r_ret) {
+ call_with_validated_variant_argsc(p_base, p_method, p_args);
}
template <typename From, typename R, typename T, typename... P>
-static _FORCE_INLINE_ void vc_convert_validated_call(R (T::*method)(P...), Variant *base, const Variant **p_args, Variant *r_ret) {
- T converted(static_cast<T>(VariantInternalAccessor<From>::get(base)));
- call_with_validated_variant_args_ret_helper<T, R, P...>(&converted, method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
+static _FORCE_INLINE_ void vc_convert_validated_call(R (T::*p_method)(P...), Variant *p_base, const Variant **p_args, Variant *r_ret) {
+ T converted(static_cast<T>(VariantInternalAccessor<From>::get(p_base)));
+ call_with_validated_variant_args_ret_helper<T, R, P...>(&converted, p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
}
template <typename From, typename R, typename T, typename... P>
-static _FORCE_INLINE_ void vc_convert_validated_call(R (T::*method)(P...) const, Variant *base, const Variant **p_args, Variant *r_ret) {
- T converted(static_cast<T>(VariantInternalAccessor<From>::get(base)));
- call_with_validated_variant_args_retc_helper<T, R, P...>(&converted, method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
+static _FORCE_INLINE_ void vc_convert_validated_call(R (T::*p_method)(P...) const, Variant *p_base, const Variant **p_args, Variant *r_ret) {
+ T converted(static_cast<T>(VariantInternalAccessor<From>::get(p_base)));
+ call_with_validated_variant_args_retc_helper<T, R, P...>(&converted, p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
}
template <typename From, typename T, typename... P>
-static _FORCE_INLINE_ void vc_convert_validated_call(void (T::*method)(P...), Variant *base, const Variant **p_args, Variant *r_ret) {
- T converted(static_cast<T>(VariantInternalAccessor<From>::get(base)));
- call_with_validated_variant_args_helper<T, P...>(&converted, method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
+static _FORCE_INLINE_ void vc_convert_validated_call(void (T::*p_method)(P...), Variant *p_base, const Variant **p_args, Variant *r_ret) {
+ T converted(static_cast<T>(VariantInternalAccessor<From>::get(p_base)));
+ call_with_validated_variant_args_helper<T, P...>(&converted, p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
}
template <typename From, typename T, typename... P>
-static _FORCE_INLINE_ void vc_convert_validated_call(void (T::*method)(P...) const, Variant *base, const Variant **p_args, Variant *r_ret) {
- T converted(static_cast<T>(VariantInternalAccessor<From>::get(base)));
- call_with_validated_variant_argsc_helper<T, P...>(&converted, method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
+static _FORCE_INLINE_ void vc_convert_validated_call(void (T::*p_method)(P...) const, Variant *p_base, const Variant **p_args, Variant *r_ret) {
+ T converted(static_cast<T>(VariantInternalAccessor<From>::get(p_base)));
+ call_with_validated_variant_argsc_helper<T, P...>(&converted, p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ void vc_validated_call_static(R (*method)(T *, P...), Variant *base, const Variant **p_args, Variant *r_ret) {
- call_with_validated_variant_args_static_retc(base, method, p_args, r_ret);
+static _FORCE_INLINE_ void vc_validated_call_static(R (*p_method)(T *, P...), Variant *p_base, const Variant **p_args, Variant *r_ret) {
+ call_with_validated_variant_args_static_retc(p_base, p_method, p_args, r_ret);
}
template <typename T, typename... P>
-static _FORCE_INLINE_ void vc_validated_call_static(void (*method)(T *, P...), Variant *base, const Variant **p_args, Variant *r_ret) {
- call_with_validated_variant_args_static(base, method, p_args);
+static _FORCE_INLINE_ void vc_validated_call_static(void (*p_method)(T *, P...), Variant *p_base, const Variant **p_args, Variant *r_ret) {
+ call_with_validated_variant_args_static(p_base, p_method, p_args);
}
template <typename R, typename... P>
-static _FORCE_INLINE_ void vc_validated_static_call(R (*method)(P...), const Variant **p_args, Variant *r_ret) {
- call_with_validated_variant_args_static_method_ret(method, p_args, r_ret);
+static _FORCE_INLINE_ void vc_validated_static_call(R (*p_method)(P...), const Variant **p_args, Variant *r_ret) {
+ call_with_validated_variant_args_static_method_ret(p_method, p_args, r_ret);
}
template <typename... P>
-static _FORCE_INLINE_ void vc_validated_static_call(void (*method)(P...), const Variant **p_args, Variant *r_ret) {
- call_with_validated_variant_args_static_method(method, p_args);
+static _FORCE_INLINE_ void vc_validated_static_call(void (*p_method)(P...), const Variant **p_args, Variant *r_ret) {
+ call_with_validated_variant_args_static_method(p_method, p_args);
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ void vc_ptrcall(R (T::*method)(P...), void *p_base, const void **p_args, void *r_ret) {
- call_with_ptr_args_ret(reinterpret_cast<T *>(p_base), method, p_args, r_ret);
+static _FORCE_INLINE_ void vc_ptrcall(R (T::*p_method)(P...), void *p_base, const void **p_args, void *r_ret) {
+ call_with_ptr_args_ret(reinterpret_cast<T *>(p_base), p_method, p_args, r_ret);
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ void vc_ptrcall(R (T::*method)(P...) const, void *p_base, const void **p_args, void *r_ret) {
- call_with_ptr_args_retc(reinterpret_cast<T *>(p_base), method, p_args, r_ret);
+static _FORCE_INLINE_ void vc_ptrcall(R (T::*p_method)(P...) const, void *p_base, const void **p_args, void *r_ret) {
+ call_with_ptr_args_retc(reinterpret_cast<T *>(p_base), p_method, p_args, r_ret);
}
template <typename T, typename... P>
-static _FORCE_INLINE_ void vc_ptrcall(void (T::*method)(P...), void *p_base, const void **p_args, void *r_ret) {
- call_with_ptr_args(reinterpret_cast<T *>(p_base), method, p_args);
+static _FORCE_INLINE_ void vc_ptrcall(void (T::*p_method)(P...), void *p_base, const void **p_args, void *r_ret) {
+ call_with_ptr_args(reinterpret_cast<T *>(p_base), p_method, p_args);
}
template <typename T, typename... P>
-static _FORCE_INLINE_ void vc_ptrcall(void (T::*method)(P...) const, void *p_base, const void **p_args, void *r_ret) {
- call_with_ptr_argsc(reinterpret_cast<T *>(p_base), method, p_args);
+static _FORCE_INLINE_ void vc_ptrcall(void (T::*p_method)(P...) const, void *p_base, const void **p_args, void *r_ret) {
+ call_with_ptr_argsc(reinterpret_cast<T *>(p_base), p_method, p_args);
}
template <typename From, typename R, typename T, typename... P>
-static _FORCE_INLINE_ void vc_convert_ptrcall(R (T::*method)(P...), void *p_base, const void **p_args, void *r_ret) {
+static _FORCE_INLINE_ void vc_convert_ptrcall(R (T::*p_method)(P...), void *p_base, const void **p_args, void *r_ret) {
T converted(*reinterpret_cast<From *>(p_base));
- call_with_ptr_args_ret(&converted, method, p_args, r_ret);
+ call_with_ptr_args_ret(&converted, p_method, p_args, r_ret);
}
template <typename From, typename R, typename T, typename... P>
-static _FORCE_INLINE_ void vc_convert_ptrcall(R (T::*method)(P...) const, void *p_base, const void **p_args, void *r_ret) {
+static _FORCE_INLINE_ void vc_convert_ptrcall(R (T::*p_method)(P...) const, void *p_base, const void **p_args, void *r_ret) {
T converted(*reinterpret_cast<From *>(p_base));
- call_with_ptr_args_retc(&converted, method, p_args, r_ret);
+ call_with_ptr_args_retc(&converted, p_method, p_args, r_ret);
}
template <typename From, typename T, typename... P>
-static _FORCE_INLINE_ void vc_convert_ptrcall(void (T::*method)(P...), void *p_base, const void **p_args, void *r_ret) {
+static _FORCE_INLINE_ void vc_convert_ptrcall(void (T::*p_method)(P...), void *p_base, const void **p_args, void *r_ret) {
T converted(*reinterpret_cast<From *>(p_base));
- call_with_ptr_args(&converted, method, p_args);
+ call_with_ptr_args(&converted, p_method, p_args);
}
template <typename From, typename T, typename... P>
-static _FORCE_INLINE_ void vc_convert_ptrcall(void (T::*method)(P...) const, void *p_base, const void **p_args, void *r_ret) {
+static _FORCE_INLINE_ void vc_convert_ptrcall(void (T::*p_method)(P...) const, void *p_base, const void **p_args, void *r_ret) {
T converted(*reinterpret_cast<From *>(p_base));
- call_with_ptr_argsc(&converted, method, p_args);
+ call_with_ptr_argsc(&converted, p_method, p_args);
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ int vc_get_argument_count(R (T::*method)(P...)) {
+static _FORCE_INLINE_ int vc_get_argument_count(R (T::*p_method)(P...)) {
return sizeof...(P);
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ int vc_get_argument_count(R (T::*method)(P...) const) {
+static _FORCE_INLINE_ int vc_get_argument_count(R (T::*p_method)(P...) const) {
return sizeof...(P);
}
template <typename T, typename... P>
-static _FORCE_INLINE_ int vc_get_argument_count(void (T::*method)(P...)) {
+static _FORCE_INLINE_ int vc_get_argument_count(void (T::*p_method)(P...)) {
return sizeof...(P);
}
template <typename T, typename... P>
-static _FORCE_INLINE_ int vc_get_argument_count(void (T::*method)(P...) const) {
+static _FORCE_INLINE_ int vc_get_argument_count(void (T::*p_method)(P...) const) {
return sizeof...(P);
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ int vc_get_argument_count(R (*method)(T *, P...)) {
+static _FORCE_INLINE_ int vc_get_argument_count(R (*p_method)(T *, P...)) {
return sizeof...(P);
}
template <typename R, typename... P>
-static _FORCE_INLINE_ int vc_get_argument_count_static(R (*method)(P...)) {
+static _FORCE_INLINE_ int vc_get_argument_count_static(R (*p_method)(P...)) {
return sizeof...(P);
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ Variant::Type vc_get_argument_type(R (T::*method)(P...), int p_arg) {
+static _FORCE_INLINE_ Variant::Type vc_get_argument_type(R (T::*p_method)(P...), int p_arg) {
return call_get_argument_type<P...>(p_arg);
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ Variant::Type vc_get_argument_type(R (T::*method)(P...) const, int p_arg) {
+static _FORCE_INLINE_ Variant::Type vc_get_argument_type(R (T::*p_method)(P...) const, int p_arg) {
return call_get_argument_type<P...>(p_arg);
}
template <typename T, typename... P>
-static _FORCE_INLINE_ Variant::Type vc_get_argument_type(void (T::*method)(P...), int p_arg) {
+static _FORCE_INLINE_ Variant::Type vc_get_argument_type(void (T::*p_method)(P...), int p_arg) {
return call_get_argument_type<P...>(p_arg);
}
template <typename T, typename... P>
-static _FORCE_INLINE_ Variant::Type vc_get_argument_type(void (T::*method)(P...) const, int p_arg) {
+static _FORCE_INLINE_ Variant::Type vc_get_argument_type(void (T::*p_method)(P...) const, int p_arg) {
return call_get_argument_type<P...>(p_arg);
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ Variant::Type vc_get_argument_type(R (*method)(T *, P...), int p_arg) {
+static _FORCE_INLINE_ Variant::Type vc_get_argument_type(R (*p_method)(T *, P...), int p_arg) {
return call_get_argument_type<P...>(p_arg);
}
template <typename R, typename... P>
-static _FORCE_INLINE_ Variant::Type vc_get_argument_type_static(R (*method)(P...), int p_arg) {
+static _FORCE_INLINE_ Variant::Type vc_get_argument_type_static(R (*p_method)(P...), int p_arg) {
return call_get_argument_type<P...>(p_arg);
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ Variant::Type vc_get_return_type(R (T::*method)(P...)) {
+static _FORCE_INLINE_ Variant::Type vc_get_return_type(R (T::*p_method)(P...)) {
return GetTypeInfo<R>::VARIANT_TYPE;
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ Variant::Type vc_get_return_type(R (T::*method)(P...) const) {
+static _FORCE_INLINE_ Variant::Type vc_get_return_type(R (T::*p_method)(P...) const) {
return GetTypeInfo<R>::VARIANT_TYPE;
}
template <typename T, typename... P>
-static _FORCE_INLINE_ Variant::Type vc_get_return_type(void (T::*method)(P...)) {
+static _FORCE_INLINE_ Variant::Type vc_get_return_type(void (T::*p_method)(P...)) {
return Variant::NIL;
}
template <typename T, typename... P>
-static _FORCE_INLINE_ Variant::Type vc_get_return_type(void (T::*method)(P...) const) {
+static _FORCE_INLINE_ Variant::Type vc_get_return_type(void (T::*p_method)(P...) const) {
return Variant::NIL;
}
template <typename R, typename... P>
-static _FORCE_INLINE_ Variant::Type vc_get_return_type(R (*method)(P...)) {
+static _FORCE_INLINE_ Variant::Type vc_get_return_type(R (*p_method)(P...)) {
return GetTypeInfo<R>::VARIANT_TYPE;
}
template <typename... P>
-static _FORCE_INLINE_ Variant::Type vc_get_return_type(void (*method)(P...)) {
+static _FORCE_INLINE_ Variant::Type vc_get_return_type(void (*p_method)(P...)) {
return Variant::NIL;
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ bool vc_has_return_type(R (T::*method)(P...)) {
+static _FORCE_INLINE_ bool vc_has_return_type(R (T::*p_method)(P...)) {
return true;
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ bool vc_has_return_type(R (T::*method)(P...) const) {
+static _FORCE_INLINE_ bool vc_has_return_type(R (T::*p_method)(P...) const) {
return true;
}
template <typename T, typename... P>
-static _FORCE_INLINE_ bool vc_has_return_type(void (T::*method)(P...)) {
+static _FORCE_INLINE_ bool vc_has_return_type(void (T::*p_method)(P...)) {
return false;
}
template <typename T, typename... P>
-static _FORCE_INLINE_ bool vc_has_return_type(void (T::*method)(P...) const) {
+static _FORCE_INLINE_ bool vc_has_return_type(void (T::*p_method)(P...) const) {
return false;
}
template <typename... P>
-static _FORCE_INLINE_ bool vc_has_return_type_static(void (*method)(P...)) {
+static _FORCE_INLINE_ bool vc_has_return_type_static(void (*p_method)(P...)) {
return false;
}
template <typename R, typename... P>
-static _FORCE_INLINE_ bool vc_has_return_type_static(R (*method)(P...)) {
+static _FORCE_INLINE_ bool vc_has_return_type_static(R (*p_method)(P...)) {
return true;
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ bool vc_is_const(R (T::*method)(P...)) {
+static _FORCE_INLINE_ bool vc_is_const(R (T::*p_method)(P...)) {
return false;
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ bool vc_is_const(R (T::*method)(P...) const) {
+static _FORCE_INLINE_ bool vc_is_const(R (T::*p_method)(P...) const) {
return true;
}
template <typename T, typename... P>
-static _FORCE_INLINE_ bool vc_is_const(void (T::*method)(P...)) {
+static _FORCE_INLINE_ bool vc_is_const(void (T::*p_method)(P...)) {
return false;
}
template <typename T, typename... P>
-static _FORCE_INLINE_ bool vc_is_const(void (T::*method)(P...) const) {
+static _FORCE_INLINE_ bool vc_is_const(void (T::*p_method)(P...) const) {
return true;
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ Variant::Type vc_get_base_type(R (T::*method)(P...)) {
+static _FORCE_INLINE_ Variant::Type vc_get_base_type(R (T::*p_method)(P...)) {
return GetTypeInfo<T>::VARIANT_TYPE;
}
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ Variant::Type vc_get_base_type(R (T::*method)(P...) const) {
+static _FORCE_INLINE_ Variant::Type vc_get_base_type(R (T::*p_method)(P...) const) {
return GetTypeInfo<T>::VARIANT_TYPE;
}
template <typename T, typename... P>
-static _FORCE_INLINE_ Variant::Type vc_get_base_type(void (T::*method)(P...)) {
+static _FORCE_INLINE_ Variant::Type vc_get_base_type(void (T::*p_method)(P...)) {
return GetTypeInfo<T>::VARIANT_TYPE;
}
template <typename T, typename... P>
-static _FORCE_INLINE_ Variant::Type vc_get_base_type(void (T::*method)(P...) const) {
+static _FORCE_INLINE_ Variant::Type vc_get_base_type(void (T::*p_method)(P...) const) {
return GetTypeInfo<T>::VARIANT_TYPE;
}
#define METHOD_CLASS(m_class, m_exposed_name, m_method_name, m_method_ptr) \
struct Method_##m_class##_##m_method_name { \
- static void call(Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) { \
- vc_method_call(m_method_ptr, base, p_args, p_argcount, r_ret, p_defvals, r_error); \
+ static void call(Variant *p_base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) { \
+ vc_method_call(m_method_ptr, p_base, p_args, p_argcount, r_ret, p_defvals, r_error); \
} \
- static void validated_call(Variant *base, const Variant **p_args, int p_argcount, Variant *r_ret) { \
- vc_validated_call(m_method_ptr, base, p_args, r_ret); \
+ static void validated_call(Variant *p_base, const Variant **p_args, int p_argcount, Variant *r_ret) { \
+ vc_validated_call(m_method_ptr, p_base, p_args, r_ret); \
} \
static void ptrcall(void *p_base, const void **p_args, void *r_ret, int p_argcount) { \
vc_ptrcall(m_method_ptr, p_base, p_args, r_ret); \
@@ -411,11 +411,11 @@ static _FORCE_INLINE_ Variant::Type vc_get_base_type(void (T::*method)(P...) con
#define CONVERT_METHOD_CLASS(m_class, m_exposed_name, m_method_name, m_method_ptr) \
struct Method_##m_class##_##m_method_name { \
- static void call(Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) { \
- vc_convert_method_call<m_class>(m_method_ptr, base, p_args, p_argcount, r_ret, p_defvals, r_error); \
+ static void call(Variant *p_base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) { \
+ vc_convert_method_call<m_class>(m_method_ptr, p_base, p_args, p_argcount, r_ret, p_defvals, r_error); \
} \
- static void validated_call(Variant *base, const Variant **p_args, int p_argcount, Variant *r_ret) { \
- vc_convert_validated_call<m_class>(m_method_ptr, base, p_args, r_ret); \
+ static void validated_call(Variant *p_base, const Variant **p_args, int p_argcount, Variant *r_ret) { \
+ vc_convert_validated_call<m_class>(m_method_ptr, p_base, p_args, r_ret); \
} \
static void ptrcall(void *p_base, const void **p_args, void *r_ret, int p_argcount) { \
vc_convert_ptrcall<m_class>(m_method_ptr, p_base, p_args, r_ret); \
@@ -450,21 +450,21 @@ static _FORCE_INLINE_ Variant::Type vc_get_base_type(void (T::*method)(P...) con
};
template <typename R, typename... P>
-static _FORCE_INLINE_ void vc_static_ptrcall(R (*method)(P...), const void **p_args, void *r_ret) {
- call_with_ptr_args_static_method_ret<R, P...>(method, p_args, r_ret);
+static _FORCE_INLINE_ void vc_static_ptrcall(R (*p_method)(P...), const void **p_args, void *r_ret) {
+ call_with_ptr_args_static_method_ret<R, P...>(p_method, p_args, r_ret);
}
template <typename... P>
-static _FORCE_INLINE_ void vc_static_ptrcall(void (*method)(P...), const void **p_args, void *r_ret) {
- call_with_ptr_args_static_method<P...>(method, p_args);
+static _FORCE_INLINE_ void vc_static_ptrcall(void (*p_method)(P...), const void **p_args, void *r_ret) {
+ call_with_ptr_args_static_method<P...>(p_method, p_args);
}
#define STATIC_METHOD_CLASS(m_class, m_exposed_name, m_method_name, m_method_ptr) \
struct Method_##m_class##_##m_method_name { \
- static void call(Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) { \
+ static void call(Variant *p_base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) { \
vc_static_method_call(m_method_ptr, p_args, p_argcount, r_ret, p_defvals, r_error); \
} \
- static void validated_call(Variant *base, const Variant **p_args, int p_argcount, Variant *r_ret) { \
+ static void validated_call(Variant *p_base, const Variant **p_args, int p_argcount, Variant *r_ret) { \
vc_validated_static_call(m_method_ptr, p_args, r_ret); \
} \
static void ptrcall(void *p_base, const void **p_args, void *r_ret, int p_argcount) { \
@@ -500,22 +500,22 @@ static _FORCE_INLINE_ void vc_static_ptrcall(void (*method)(P...), const void **
};
template <typename R, typename T, typename... P>
-static _FORCE_INLINE_ void vc_ptrcall(R (*method)(T *, P...), void *p_base, const void **p_args, void *r_ret) {
- call_with_ptr_args_static_retc<T, R, P...>(reinterpret_cast<T *>(p_base), method, p_args, r_ret);
+static _FORCE_INLINE_ void vc_ptrcall(R (*p_method)(T *, P...), void *p_base, const void **p_args, void *r_ret) {
+ call_with_ptr_args_static_retc<T, R, P...>(reinterpret_cast<T *>(p_base), p_method, p_args, r_ret);
}
template <typename T, typename... P>
-static _FORCE_INLINE_ void vc_ptrcall(void (*method)(T *, P...), void *p_base, const void **p_args, void *r_ret) {
- call_with_ptr_args_static<T, P...>(reinterpret_cast<T *>(p_base), method, p_args);
+static _FORCE_INLINE_ void vc_ptrcall(void (*p_method)(T *, P...), void *p_base, const void **p_args, void *r_ret) {
+ call_with_ptr_args_static<T, P...>(reinterpret_cast<T *>(p_base), p_method, p_args);
}
#define FUNCTION_CLASS(m_class, m_exposed_name, m_method_name, m_method_ptr, m_const) \
struct Method_##m_class##_##m_method_name { \
- static void call(Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) { \
- vc_method_call_static(m_method_ptr, base, p_args, p_argcount, r_ret, p_defvals, r_error); \
+ static void call(Variant *p_base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) { \
+ vc_method_call_static(m_method_ptr, p_base, p_args, p_argcount, r_ret, p_defvals, r_error); \
} \
- static void validated_call(Variant *base, const Variant **p_args, int p_argcount, Variant *r_ret) { \
- vc_validated_call_static(m_method_ptr, base, p_args, r_ret); \
+ static void validated_call(Variant *p_base, const Variant **p_args, int p_argcount, Variant *r_ret) { \
+ vc_validated_call_static(m_method_ptr, p_base, p_args, r_ret); \
} \
static void ptrcall(void *p_base, const void **p_args, void *r_ret, int p_argcount) { \
vc_ptrcall(m_method_ptr, p_base, p_args, r_ret); \
@@ -551,12 +551,12 @@ static _FORCE_INLINE_ void vc_ptrcall(void (*method)(T *, P...), void *p_base, c
#define VARARG_CLASS(m_class, m_exposed_name, m_method_name, m_method_ptr, m_has_return, m_return_type) \
struct Method_##m_class##_##m_method_name { \
- static void call(Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) { \
- m_method_ptr(base, p_args, p_argcount, r_ret, r_error); \
+ static void call(Variant *p_base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) { \
+ m_method_ptr(p_base, p_args, p_argcount, r_ret, r_error); \
} \
- static void validated_call(Variant *base, const Variant **p_args, int p_argcount, Variant *r_ret) { \
+ static void validated_call(Variant *p_base, const Variant **p_args, int p_argcount, Variant *r_ret) { \
Callable::CallError ce; \
- m_method_ptr(base, p_args, p_argcount, *r_ret, ce); \
+ m_method_ptr(p_base, p_args, p_argcount, *r_ret, ce); \
} \
static void ptrcall(void *p_base, const void **p_args, void *r_ret, int p_argcount) { \
LocalVector<Variant> vars; \
@@ -607,12 +607,12 @@ static _FORCE_INLINE_ void vc_ptrcall(void (*method)(T *, P...), void *p_base, c
#define VARARG_CLASS1(m_class, m_exposed_name, m_method_name, m_method_ptr, m_arg_type) \
struct Method_##m_class##_##m_method_name { \
- static void call(Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) { \
- m_method_ptr(base, p_args, p_argcount, r_ret, r_error); \
+ static void call(Variant *p_base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) { \
+ m_method_ptr(p_base, p_args, p_argcount, r_ret, r_error); \
} \
- static void validated_call(Variant *base, const Variant **p_args, int p_argcount, Variant *r_ret) { \
+ static void validated_call(Variant *p_base, const Variant **p_args, int p_argcount, Variant *r_ret) { \
Callable::CallError ce; \
- m_method_ptr(base, p_args, p_argcount, *r_ret, ce); \
+ m_method_ptr(p_base, p_args, p_argcount, *r_ret, ce); \
} \
static void ptrcall(void *p_base, const void **p_args, void *r_ret, int p_argcount) { \
LocalVector<Variant> vars; \
@@ -1167,22 +1167,22 @@ struct _VariantCall {
return ret;
}
- static void func_Callable_call(Variant *v, const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error) {
- Callable *callable = &VariantInternalAccessor<Callable>::get(v);
+ static void func_Callable_call(Variant *p_variant, const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error) {
+ Callable *callable = &VariantInternalAccessor<Callable>::get(p_variant);
callable->callp(p_args, p_argcount, r_ret, r_error);
}
- static void func_Callable_call_deferred(Variant *v, const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error) {
- Callable *callable = &VariantInternalAccessor<Callable>::get(v);
+ static void func_Callable_call_deferred(Variant *p_variant, const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error) {
+ Callable *callable = &VariantInternalAccessor<Callable>::get(p_variant);
callable->call_deferredp(p_args, p_argcount);
}
- static void func_Callable_rpc(Variant *v, const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error) {
- Callable *callable = &VariantInternalAccessor<Callable>::get(v);
+ static void func_Callable_rpc(Variant *p_variant, const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error) {
+ Callable *callable = &VariantInternalAccessor<Callable>::get(p_variant);
callable->rpcp(0, p_args, p_argcount, r_error);
}
- static void func_Callable_rpc_id(Variant *v, const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error) {
+ static void func_Callable_rpc_id(Variant *p_variant, const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error) {
if (p_argcount == 0) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
r_error.expected = 1;
@@ -1191,13 +1191,13 @@ struct _VariantCall {
r_error.argument = 0;
r_error.expected = Variant::INT;
} else {
- Callable *callable = &VariantInternalAccessor<Callable>::get(v);
+ Callable *callable = &VariantInternalAccessor<Callable>::get(p_variant);
callable->rpcp(*p_args[0], &p_args[1], p_argcount - 1, r_error);
}
}
- static void func_Callable_bind(Variant *v, const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error) {
- Callable *callable = &VariantInternalAccessor<Callable>::get(v);
+ static void func_Callable_bind(Variant *p_variant, const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error) {
+ Callable *callable = &VariantInternalAccessor<Callable>::get(p_variant);
r_ret = callable->bindp(p_args, p_argcount);
}
@@ -1205,8 +1205,8 @@ struct _VariantCall {
return p_callable->get_argument_count();
}
- static void func_Signal_emit(Variant *v, const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error) {
- Signal *signal = &VariantInternalAccessor<Signal>::get(v);
+ static void func_Signal_emit(Variant *p_variant, const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error) {
+ Signal *signal = &VariantInternalAccessor<Signal>::get(p_variant);
signal->emit(p_args, p_argcount);
}
@@ -1252,7 +1252,7 @@ struct _VariantCall {
HashMap<StringName, Variant> *_VariantCall::variant_constants = nullptr;
struct VariantBuiltInMethodInfo {
- void (*call)(Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) = nullptr;
+ void (*call)(Variant *p_base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) = nullptr;
Variant::ValidatedBuiltInMethod validated_call = nullptr;
Variant::PTRBuiltInMethod ptrcall = nullptr;
diff --git a/core/variant/variant_construct.cpp b/core/variant/variant_construct.cpp
index 8182055a10d..f024a8e3216 100644
--- a/core/variant/variant_construct.cpp
+++ b/core/variant/variant_construct.cpp
@@ -42,8 +42,8 @@ struct VariantConstructData {
static LocalVector<VariantConstructData> construct_data[Variant::VARIANT_MAX];
template <typename T>
-static void add_constructor(const Vector<String> &arg_names) {
- ERR_FAIL_COND_MSG(arg_names.size() != T::get_argument_count(), vformat("Argument names size mismatch for '%s'.", Variant::get_type_name(T::get_base_type())));
+static void add_constructor(const Vector<String> &p_arg_names) {
+ ERR_FAIL_COND_MSG(p_arg_names.size() != T::get_argument_count(), vformat("Argument names size mismatch for '%s'.", Variant::get_type_name(T::get_base_type())));
VariantConstructData cd;
cd.construct = T::construct;
@@ -51,7 +51,7 @@ static void add_constructor(const Vector<String> &arg_names) {
cd.ptr_construct = T::ptr_construct;
cd.get_argument_type = T::get_argument_type;
cd.argument_count = T::get_argument_count();
- cd.arg_names = arg_names;
+ cd.arg_names = p_arg_names;
construct_data[T::get_base_type()].push_back(cd);
}
@@ -261,7 +261,7 @@ void Variant::_unregister_variant_constructors() {
}
}
-void Variant::construct(Variant::Type p_type, Variant &base, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
+void Variant::construct(Variant::Type p_type, Variant &p_base, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
ERR_FAIL_INDEX(p_type, Variant::VARIANT_MAX);
uint32_t s = construct_data[p_type].size();
for (uint32_t i = 0; i < s; i++) {
@@ -281,7 +281,7 @@ void Variant::construct(Variant::Type p_type, Variant &base, const Variant **p_a
continue;
}
- construct_data[p_type][i].construct(base, p_args, r_error);
+ construct_data[p_type][i].construct(p_base, p_args, r_error);
return;
}
diff --git a/core/variant/variant_construct.h b/core/variant/variant_construct.h
index a906e1a3944..559662243ec 100644
--- a/core/variant/variant_construct.h
+++ b/core/variant/variant_construct.h
@@ -96,24 +96,24 @@ MAKE_PTRCONSTRUCT(Variant);
template <typename T, typename... P>
class VariantConstructor {
template <size_t... Is>
- static _FORCE_INLINE_ void construct_helper(T &base, const Variant **p_args, Callable::CallError &r_error, IndexSequence<Is...>) {
+ static _FORCE_INLINE_ void construct_helper(T &r_base, const Variant **p_args, Callable::CallError &r_error, IndexSequence<Is...>) {
r_error.error = Callable::CallError::CALL_OK;
#ifdef DEBUG_ENABLED
- base = T(VariantCasterAndValidate<P>::cast(p_args, Is, r_error)...);
+ r_base = T(VariantCasterAndValidate<P>::cast(p_args, Is, r_error)...);
#else
- base = T(VariantCaster<P>::cast(*p_args[Is])...);
+ r_base = T(VariantCaster<P>::cast(*p_args[Is])...);
#endif // DEBUG_ENABLED
}
template <size_t... Is>
- static _FORCE_INLINE_ void validated_construct_helper(T &base, const Variant **p_args, IndexSequence<Is...>) {
- base = T((VariantInternalAccessor<P>::get(p_args[Is]))...);
+ static _FORCE_INLINE_ void validated_construct_helper(T &r_base, const Variant **p_args, IndexSequence<Is...>) {
+ r_base = T((VariantInternalAccessor<P>::get(p_args[Is]))...);
}
template <size_t... Is>
- static _FORCE_INLINE_ void ptr_construct_helper(void *base, const void **p_args, IndexSequence<Is...>) {
- PtrConstruct<T>::construct(T(PtrToArg<P>::convert(p_args[Is])...), base);
+ static _FORCE_INLINE_ void ptr_construct_helper(void *p_base, const void **p_args, IndexSequence<Is...>) {
+ PtrConstruct<T>::construct(T(PtrToArg<P>::convert(p_args[Is])...), p_base);
}
public:
@@ -127,8 +127,8 @@ public:
VariantTypeChanger<T>::change(r_ret);
validated_construct_helper(VariantInternalAccessor<T>::get(r_ret), p_args, BuildIndexSequence<sizeof...(P)>{});
}
- static void ptr_construct(void *base, const void **p_args) {
- ptr_construct_helper(base, p_args, BuildIndexSequence<sizeof...(P)>{});
+ static void ptr_construct(void *p_base, const void **p_args) {
+ ptr_construct_helper(p_base, p_args, BuildIndexSequence<sizeof...(P)>{});
}
static int get_argument_count() {
@@ -168,8 +168,8 @@ public:
VariantTypeChanger<Object *>::change(r_ret);
VariantInternal::object_assign(r_ret, p_args[0]);
}
- static void ptr_construct(void *base, const void **p_args) {
- PtrConstruct<Object *>::construct(PtrToArg<Object *>::convert(p_args[0]), base);
+ static void ptr_construct(void *p_base, const void **p_args) {
+ PtrConstruct<Object *>::construct(PtrToArg<Object *>::convert(p_args[0]), p_base);
}
static int get_argument_count() {
@@ -204,8 +204,8 @@ public:
VariantTypeChanger<Object *>::change(r_ret);
VariantInternal::object_reset_data(r_ret);
}
- static void ptr_construct(void *base, const void **p_args) {
- PtrConstruct<Object *>::construct(nullptr, base);
+ static void ptr_construct(void *p_base, const void **p_args) {
+ PtrConstruct<Object *>::construct(nullptr, p_base);
}
static int get_argument_count() {
@@ -254,7 +254,7 @@ public:
*r_ret = ret;
}
- static void ptr_construct(void *base, const void **p_args) {
+ static void ptr_construct(void *p_base, const void **p_args) {
String src_str = PtrToArg<String>::convert(p_args[0]);
T dst_var = Variant();
Variant type_test = Variant(dst_var);
@@ -263,7 +263,7 @@ public:
} else if (type_test.get_type() == Variant::Type::FLOAT) {
dst_var = src_str.to_float();
}
- PtrConstruct<T>::construct(dst_var, base);
+ PtrConstruct<T>::construct(dst_var, p_base);
}
static int get_argument_count() {
@@ -315,8 +315,8 @@ public:
VariantTypeChanger<Callable>::change(r_ret);
VariantInternalAccessor<Callable>::get(r_ret) = Callable(VariantInternal::get_object_id(p_args[0]), VariantInternalAccessor<StringName>::get(p_args[1]));
}
- static void ptr_construct(void *base, const void **p_args) {
- PtrConstruct<Callable>::construct(Callable(PtrToArg<Object *>::convert(p_args[0]), PtrToArg<StringName>::convert(p_args[1])), base);
+ static void ptr_construct(void *p_base, const void **p_args) {
+ PtrConstruct<Callable>::construct(Callable(PtrToArg<Object *>::convert(p_args[0]), PtrToArg<StringName>::convert(p_args[1])), p_base);
}
static int get_argument_count() {
@@ -372,8 +372,8 @@ public:
VariantTypeChanger<Signal>::change(r_ret);
VariantInternalAccessor<Signal>::get(r_ret) = Signal(VariantInternal::get_object_id(p_args[0]), VariantInternalAccessor<StringName>::get(p_args[1]));
}
- static void ptr_construct(void *base, const void **p_args) {
- PtrConstruct<Signal>::construct(Signal(PtrToArg<Object *>::convert(p_args[0]), PtrToArg<StringName>::convert(p_args[1])), base);
+ static void ptr_construct(void *p_base, const void **p_args) {
+ PtrConstruct<Signal>::construct(Signal(PtrToArg<Object *>::convert(p_args[0]), PtrToArg<StringName>::convert(p_args[1])), p_base);
}
static int get_argument_count() {
@@ -448,7 +448,7 @@ public:
*r_ret = Dictionary(base_dict, key_type, key_class_name, *p_args[3], value_type, value_class_name, *p_args[6]);
}
- static void ptr_construct(void *base, const void **p_args) {
+ static void ptr_construct(void *p_base, const void **p_args) {
const Dictionary &base_dict = PtrToArg<Dictionary>::convert(p_args[0]);
const uint32_t key_type = PtrToArg<uint32_t>::convert(p_args[1]);
const StringName &key_class_name = PtrToArg<StringName>::convert(p_args[2]);
@@ -458,7 +458,7 @@ public:
const Variant &value_script = PtrToArg<Variant>::convert(p_args[6]);
Dictionary dst_arr = Dictionary(base_dict, key_type, key_class_name, key_script, value_type, value_class_name, value_script);
- PtrConstruct<Dictionary>::construct(dst_arr, base);
+ PtrConstruct<Dictionary>::construct(dst_arr, p_base);
}
static int get_argument_count() {
@@ -535,14 +535,14 @@ public:
*r_ret = Array(base_arr, type, class_name, *p_args[3]);
}
- static void ptr_construct(void *base, const void **p_args) {
+ static void ptr_construct(void *p_base, const void **p_args) {
const Array &base_arr = PtrToArg<Array>::convert(p_args[0]);
const uint32_t type = PtrToArg<uint32_t>::convert(p_args[1]);
const StringName &class_name = PtrToArg<StringName>::convert(p_args[2]);
const Variant &script = PtrToArg<Variant>::convert(p_args[3]);
Array dst_arr = Array(base_arr, type, class_name, script);
- PtrConstruct<Array>::construct(dst_arr, base);
+ PtrConstruct<Array>::construct(dst_arr, p_base);
}
static int get_argument_count() {
@@ -607,7 +607,7 @@ public:
dst_arr[i] = src_arr[i];
}
}
- static void ptr_construct(void *base, const void **p_args) {
+ static void ptr_construct(void *p_base, const void **p_args) {
Array dst_arr;
T src_arr = PtrToArg<T>::convert(p_args[0]);
@@ -617,7 +617,7 @@ public:
dst_arr[i] = src_arr[i];
}
- PtrConstruct<Array>::construct(dst_arr, base);
+ PtrConstruct<Array>::construct(dst_arr, p_base);
}
static int get_argument_count() {
@@ -666,7 +666,7 @@ public:
dst_arr.write[i] = src_arr[i];
}
}
- static void ptr_construct(void *base, const void **p_args) {
+ static void ptr_construct(void *p_base, const void **p_args) {
Array src_arr = PtrToArg<Array>::convert(p_args[0]);
T dst_arr;
@@ -676,7 +676,7 @@ public:
dst_arr.write[i] = src_arr[i];
}
- PtrConstruct<T>::construct(dst_arr, base);
+ PtrConstruct<T>::construct(dst_arr, p_base);
}
static int get_argument_count() {
@@ -709,8 +709,8 @@ public:
static inline void validated_construct(Variant *r_ret, const Variant **p_args) {
VariantInternal::clear(r_ret);
}
- static void ptr_construct(void *base, const void **p_args) {
- PtrConstruct<Variant>::construct(Variant(), base);
+ static void ptr_construct(void *p_base, const void **p_args) {
+ PtrConstruct<Variant>::construct(Variant(), p_base);
}
static int get_argument_count() {
@@ -737,8 +737,8 @@ public:
static inline void validated_construct(Variant *r_ret, const Variant **p_args) {
VariantTypeChanger<T>::change_and_reset(r_ret);
}
- static void ptr_construct(void *base, const void **p_args) {
- PtrConstruct<T>::construct(T(), base);
+ static void ptr_construct(void *p_base, const void **p_args) {
+ PtrConstruct<T>::construct(T(), p_base);
}
static int get_argument_count() {
@@ -764,7 +764,7 @@ public:
static inline void validated_construct(Variant *r_ret, const Variant **p_args) {
VariantInternal::clear(r_ret);
}
- static void ptr_construct(void *base, const void **p_args) {
+ static void ptr_construct(void *p_base, const void **p_args) {
ERR_FAIL_MSG("Cannot ptrcall nil constructor");
}
@@ -791,8 +791,8 @@ public:
static inline void validated_construct(Variant *r_ret, const Variant **p_args) {
*r_ret = (Object *)nullptr; // Must construct a TYPE_OBJECT containing nullptr.
}
- static void ptr_construct(void *base, const void **p_args) {
- PtrConstruct<Object *>::construct(nullptr, base);
+ static void ptr_construct(void *p_base, const void **p_args) {
+ PtrConstruct<Object *>::construct(nullptr, p_base);
}
static int get_argument_count() {
diff --git a/core/variant/variant_internal.h b/core/variant/variant_internal.h
index 6ce3596f10e..c6b266ab0b2 100644
--- a/core/variant/variant_internal.h
+++ b/core/variant/variant_internal.h
@@ -48,89 +48,89 @@ class VariantInternal {
public:
// Set type.
- _FORCE_INLINE_ static void set_type(Variant &v, Variant::Type p_type) {
- v.type = p_type;
+ _FORCE_INLINE_ static void set_type(Variant &r_variant, Variant::Type p_type) {
+ r_variant.type = p_type;
}
- _FORCE_INLINE_ static void initialize(Variant *v, Variant::Type p_type) {
- v->clear();
- v->type = p_type;
+ _FORCE_INLINE_ static void initialize(Variant *r_variant, Variant::Type p_type) {
+ r_variant->clear();
+ r_variant->type = p_type;
switch (p_type) {
case Variant::STRING:
- init_string(v);
+ init_string(r_variant);
break;
case Variant::TRANSFORM2D:
- init_transform2d(v);
+ init_transform2d(r_variant);
break;
case Variant::QUATERNION:
- init_quaternion(v);
+ init_quaternion(r_variant);
break;
case Variant::AABB:
- init_aabb(v);
+ init_aabb(r_variant);
break;
case Variant::BASIS:
- init_basis(v);
+ init_basis(r_variant);
break;
case Variant::TRANSFORM3D:
- init_transform3d(v);
+ init_transform3d(r_variant);
break;
case Variant::PROJECTION:
- init_projection(v);
+ init_projection(r_variant);
break;
case Variant::COLOR:
- init_color(v);
+ init_color(r_variant);
break;
case Variant::STRING_NAME:
- init_string_name(v);
+ init_string_name(r_variant);
break;
case Variant::NODE_PATH:
- init_node_path(v);
+ init_node_path(r_variant);
break;
case Variant::CALLABLE:
- init_callable(v);
+ init_callable(r_variant);
break;
case Variant::SIGNAL:
- init_signal(v);
+ init_signal(r_variant);
break;
case Variant::DICTIONARY:
- init_dictionary(v);
+ init_dictionary(r_variant);
break;
case Variant::ARRAY:
- init_array(v);
+ init_array(r_variant);
break;
case Variant::PACKED_BYTE_ARRAY:
- init_byte_array(v);
+ init_byte_array(r_variant);
break;
case Variant::PACKED_INT32_ARRAY:
- init_int32_array(v);
+ init_int32_array(r_variant);
break;
case Variant::PACKED_INT64_ARRAY:
- init_int64_array(v);
+ init_int64_array(r_variant);
break;
case Variant::PACKED_FLOAT32_ARRAY:
- init_float32_array(v);
+ init_float32_array(r_variant);
break;
case Variant::PACKED_FLOAT64_ARRAY:
- init_float64_array(v);
+ init_float64_array(r_variant);
break;
case Variant::PACKED_STRING_ARRAY:
- init_string_array(v);
+ init_string_array(r_variant);
break;
case Variant::PACKED_VECTOR2_ARRAY:
- init_vector2_array(v);
+ init_vector2_array(r_variant);
break;
case Variant::PACKED_VECTOR3_ARRAY:
- init_vector3_array(v);
+ init_vector3_array(r_variant);
break;
case Variant::PACKED_COLOR_ARRAY:
- init_color_array(v);
+ init_color_array(r_variant);
break;
case Variant::PACKED_VECTOR4_ARRAY:
- init_vector4_array(v);
+ init_vector4_array(r_variant);
break;
case Variant::OBJECT:
- init_object(v);
+ init_object(r_variant);
break;
default:
break;
@@ -138,415 +138,415 @@ public:
}
// Atomic types.
- _FORCE_INLINE_ static bool *get_bool(Variant *v) { return &v->_data._bool; }
- _FORCE_INLINE_ static const bool *get_bool(const Variant *v) { return &v->_data._bool; }
- _FORCE_INLINE_ static int64_t *get_int(Variant *v) { return &v->_data._int; }
- _FORCE_INLINE_ static const int64_t *get_int(const Variant *v) { return &v->_data._int; }
- _FORCE_INLINE_ static double *get_float(Variant *v) { return &v->_data._float; }
- _FORCE_INLINE_ static const double *get_float(const Variant *v) { return &v->_data._float; }
- _FORCE_INLINE_ static String *get_string(Variant *v) { return reinterpret_cast<String *>(v->_data._mem); }
- _FORCE_INLINE_ static const String *get_string(const Variant *v) { return reinterpret_cast<const String *>(v->_data._mem); }
+ _FORCE_INLINE_ static bool *get_bool(Variant *p_variant) { return &p_variant->_data._bool; }
+ _FORCE_INLINE_ static const bool *get_bool(const Variant *p_variant) { return &p_variant->_data._bool; }
+ _FORCE_INLINE_ static int64_t *get_int(Variant *p_variant) { return &p_variant->_data._int; }
+ _FORCE_INLINE_ static const int64_t *get_int(const Variant *p_variant) { return &p_variant->_data._int; }
+ _FORCE_INLINE_ static double *get_float(Variant *p_variant) { return &p_variant->_data._float; }
+ _FORCE_INLINE_ static const double *get_float(const Variant *p_variant) { return &p_variant->_data._float; }
+ _FORCE_INLINE_ static String *get_string(Variant *p_variant) { return reinterpret_cast<String *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const String *get_string(const Variant *p_variant) { return reinterpret_cast<const String *>(p_variant->_data._mem); }
// Math types.
- _FORCE_INLINE_ static Vector2 *get_vector2(Variant *v) { return reinterpret_cast<Vector2 *>(v->_data._mem); }
- _FORCE_INLINE_ static const Vector2 *get_vector2(const Variant *v) { return reinterpret_cast<const Vector2 *>(v->_data._mem); }
- _FORCE_INLINE_ static Vector2i *get_vector2i(Variant *v) { return reinterpret_cast<Vector2i *>(v->_data._mem); }
- _FORCE_INLINE_ static const Vector2i *get_vector2i(const Variant *v) { return reinterpret_cast<const Vector2i *>(v->_data._mem); }
- _FORCE_INLINE_ static Rect2 *get_rect2(Variant *v) { return reinterpret_cast<Rect2 *>(v->_data._mem); }
- _FORCE_INLINE_ static const Rect2 *get_rect2(const Variant *v) { return reinterpret_cast<const Rect2 *>(v->_data._mem); }
- _FORCE_INLINE_ static Rect2i *get_rect2i(Variant *v) { return reinterpret_cast<Rect2i *>(v->_data._mem); }
- _FORCE_INLINE_ static const Rect2i *get_rect2i(const Variant *v) { return reinterpret_cast<const Rect2i *>(v->_data._mem); }
- _FORCE_INLINE_ static Vector3 *get_vector3(Variant *v) { return reinterpret_cast<Vector3 *>(v->_data._mem); }
- _FORCE_INLINE_ static const Vector3 *get_vector3(const Variant *v) { return reinterpret_cast<const Vector3 *>(v->_data._mem); }
- _FORCE_INLINE_ static Vector3i *get_vector3i(Variant *v) { return reinterpret_cast<Vector3i *>(v->_data._mem); }
- _FORCE_INLINE_ static const Vector3i *get_vector3i(const Variant *v) { return reinterpret_cast<const Vector3i *>(v->_data._mem); }
- _FORCE_INLINE_ static Vector4 *get_vector4(Variant *v) { return reinterpret_cast<Vector4 *>(v->_data._mem); }
- _FORCE_INLINE_ static const Vector4 *get_vector4(const Variant *v) { return reinterpret_cast<const Vector4 *>(v->_data._mem); }
- _FORCE_INLINE_ static Vector4i *get_vector4i(Variant *v) { return reinterpret_cast<Vector4i *>(v->_data._mem); }
- _FORCE_INLINE_ static const Vector4i *get_vector4i(const Variant *v) { return reinterpret_cast<const Vector4i *>(v->_data._mem); }
- _FORCE_INLINE_ static Transform2D *get_transform2d(Variant *v) { return v->_data._transform2d; }
- _FORCE_INLINE_ static const Transform2D *get_transform2d(const Variant *v) { return v->_data._transform2d; }
- _FORCE_INLINE_ static Plane *get_plane(Variant *v) { return reinterpret_cast<Plane *>(v->_data._mem); }
- _FORCE_INLINE_ static const Plane *get_plane(const Variant *v) { return reinterpret_cast<const Plane *>(v->_data._mem); }
- _FORCE_INLINE_ static Quaternion *get_quaternion(Variant *v) { return reinterpret_cast<Quaternion *>(v->_data._mem); }
- _FORCE_INLINE_ static const Quaternion *get_quaternion(const Variant *v) { return reinterpret_cast<const Quaternion *>(v->_data._mem); }
- _FORCE_INLINE_ static ::AABB *get_aabb(Variant *v) { return v->_data._aabb; }
- _FORCE_INLINE_ static const ::AABB *get_aabb(const Variant *v) { return v->_data._aabb; }
- _FORCE_INLINE_ static Basis *get_basis(Variant *v) { return v->_data._basis; }
- _FORCE_INLINE_ static const Basis *get_basis(const Variant *v) { return v->_data._basis; }
- _FORCE_INLINE_ static Transform3D *get_transform(Variant *v) { return v->_data._transform3d; }
- _FORCE_INLINE_ static const Transform3D *get_transform(const Variant *v) { return v->_data._transform3d; }
- _FORCE_INLINE_ static Projection *get_projection(Variant *v) { return v->_data._projection; }
- _FORCE_INLINE_ static const Projection *get_projection(const Variant *v) { return v->_data._projection; }
+ _FORCE_INLINE_ static Vector2 *get_vector2(Variant *p_variant) { return reinterpret_cast<Vector2 *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const Vector2 *get_vector2(const Variant *p_variant) { return reinterpret_cast<const Vector2 *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static Vector2i *get_vector2i(Variant *p_variant) { return reinterpret_cast<Vector2i *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const Vector2i *get_vector2i(const Variant *p_variant) { return reinterpret_cast<const Vector2i *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static Rect2 *get_rect2(Variant *p_variant) { return reinterpret_cast<Rect2 *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const Rect2 *get_rect2(const Variant *p_variant) { return reinterpret_cast<const Rect2 *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static Rect2i *get_rect2i(Variant *p_variant) { return reinterpret_cast<Rect2i *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const Rect2i *get_rect2i(const Variant *p_variant) { return reinterpret_cast<const Rect2i *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static Vector3 *get_vector3(Variant *p_variant) { return reinterpret_cast<Vector3 *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const Vector3 *get_vector3(const Variant *p_variant) { return reinterpret_cast<const Vector3 *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static Vector3i *get_vector3i(Variant *p_variant) { return reinterpret_cast<Vector3i *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const Vector3i *get_vector3i(const Variant *p_variant) { return reinterpret_cast<const Vector3i *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static Vector4 *get_vector4(Variant *p_variant) { return reinterpret_cast<Vector4 *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const Vector4 *get_vector4(const Variant *p_variant) { return reinterpret_cast<const Vector4 *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static Vector4i *get_vector4i(Variant *p_variant) { return reinterpret_cast<Vector4i *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const Vector4i *get_vector4i(const Variant *p_variant) { return reinterpret_cast<const Vector4i *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static Transform2D *get_transform2d(Variant *p_variant) { return p_variant->_data._transform2d; }
+ _FORCE_INLINE_ static const Transform2D *get_transform2d(const Variant *p_variant) { return p_variant->_data._transform2d; }
+ _FORCE_INLINE_ static Plane *get_plane(Variant *p_variant) { return reinterpret_cast<Plane *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const Plane *get_plane(const Variant *p_variant) { return reinterpret_cast<const Plane *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static Quaternion *get_quaternion(Variant *p_variant) { return reinterpret_cast<Quaternion *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const Quaternion *get_quaternion(const Variant *p_variant) { return reinterpret_cast<const Quaternion *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static ::AABB *get_aabb(Variant *p_variant) { return p_variant->_data._aabb; }
+ _FORCE_INLINE_ static const ::AABB *get_aabb(const Variant *p_variant) { return p_variant->_data._aabb; }
+ _FORCE_INLINE_ static Basis *get_basis(Variant *p_variant) { return p_variant->_data._basis; }
+ _FORCE_INLINE_ static const Basis *get_basis(const Variant *p_variant) { return p_variant->_data._basis; }
+ _FORCE_INLINE_ static Transform3D *get_transform(Variant *p_variant) { return p_variant->_data._transform3d; }
+ _FORCE_INLINE_ static const Transform3D *get_transform(const Variant *p_variant) { return p_variant->_data._transform3d; }
+ _FORCE_INLINE_ static Projection *get_projection(Variant *p_variant) { return p_variant->_data._projection; }
+ _FORCE_INLINE_ static const Projection *get_projection(const Variant *p_variant) { return p_variant->_data._projection; }
// Misc types.
- _FORCE_INLINE_ static Color *get_color(Variant *v) { return reinterpret_cast<Color *>(v->_data._mem); }
- _FORCE_INLINE_ static const Color *get_color(const Variant *v) { return reinterpret_cast<const Color *>(v->_data._mem); }
- _FORCE_INLINE_ static StringName *get_string_name(Variant *v) { return reinterpret_cast<StringName *>(v->_data._mem); }
- _FORCE_INLINE_ static const StringName *get_string_name(const Variant *v) { return reinterpret_cast<const StringName *>(v->_data._mem); }
- _FORCE_INLINE_ static NodePath *get_node_path(Variant *v) { return reinterpret_cast<NodePath *>(v->_data._mem); }
- _FORCE_INLINE_ static const NodePath *get_node_path(const Variant *v) { return reinterpret_cast<const NodePath *>(v->_data._mem); }
- _FORCE_INLINE_ static ::RID *get_rid(Variant *v) { return reinterpret_cast<::RID *>(v->_data._mem); }
- _FORCE_INLINE_ static const ::RID *get_rid(const Variant *v) { return reinterpret_cast<const ::RID *>(v->_data._mem); }
- _FORCE_INLINE_ static Callable *get_callable(Variant *v) { return reinterpret_cast<Callable *>(v->_data._mem); }
- _FORCE_INLINE_ static const Callable *get_callable(const Variant *v) { return reinterpret_cast<const Callable *>(v->_data._mem); }
- _FORCE_INLINE_ static Signal *get_signal(Variant *v) { return reinterpret_cast<Signal *>(v->_data._mem); }
- _FORCE_INLINE_ static const Signal *get_signal(const Variant *v) { return reinterpret_cast<const Signal *>(v->_data._mem); }
- _FORCE_INLINE_ static Dictionary *get_dictionary(Variant *v) { return reinterpret_cast<Dictionary *>(v->_data._mem); }
- _FORCE_INLINE_ static const Dictionary *get_dictionary(const Variant *v) { return reinterpret_cast<const Dictionary *>(v->_data._mem); }
- _FORCE_INLINE_ static Array *get_array(Variant *v) { return reinterpret_cast<Array *>(v->_data._mem); }
- _FORCE_INLINE_ static const Array *get_array(const Variant *v) { return reinterpret_cast<const Array *>(v->_data._mem); }
+ _FORCE_INLINE_ static Color *get_color(Variant *p_variant) { return reinterpret_cast<Color *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const Color *get_color(const Variant *p_variant) { return reinterpret_cast<const Color *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static StringName *get_string_name(Variant *p_variant) { return reinterpret_cast<StringName *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const StringName *get_string_name(const Variant *p_variant) { return reinterpret_cast<const StringName *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static NodePath *get_node_path(Variant *p_variant) { return reinterpret_cast<NodePath *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const NodePath *get_node_path(const Variant *p_variant) { return reinterpret_cast<const NodePath *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static ::RID *get_rid(Variant *p_variant) { return reinterpret_cast<::RID *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const ::RID *get_rid(const Variant *p_variant) { return reinterpret_cast<const ::RID *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static Callable *get_callable(Variant *p_variant) { return reinterpret_cast<Callable *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const Callable *get_callable(const Variant *p_variant) { return reinterpret_cast<const Callable *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static Signal *get_signal(Variant *p_variant) { return reinterpret_cast<Signal *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const Signal *get_signal(const Variant *p_variant) { return reinterpret_cast<const Signal *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static Dictionary *get_dictionary(Variant *p_variant) { return reinterpret_cast<Dictionary *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const Dictionary *get_dictionary(const Variant *p_variant) { return reinterpret_cast<const Dictionary *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static Array *get_array(Variant *p_variant) { return reinterpret_cast<Array *>(p_variant->_data._mem); }
+ _FORCE_INLINE_ static const Array *get_array(const Variant *p_variant) { return reinterpret_cast<const Array *>(p_variant->_data._mem); }
// Typed arrays.
- _FORCE_INLINE_ static PackedByteArray *get_byte_array(Variant *v) { return &static_cast<Variant::PackedArrayRef<uint8_t> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static const PackedByteArray *get_byte_array(const Variant *v) { return &static_cast<const Variant::PackedArrayRef<uint8_t> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static PackedInt32Array *get_int32_array(Variant *v) { return &static_cast<Variant::PackedArrayRef<int32_t> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static const PackedInt32Array *get_int32_array(const Variant *v) { return &static_cast<const Variant::PackedArrayRef<int32_t> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static PackedInt64Array *get_int64_array(Variant *v) { return &static_cast<Variant::PackedArrayRef<int64_t> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static const PackedInt64Array *get_int64_array(const Variant *v) { return &static_cast<const Variant::PackedArrayRef<int64_t> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static PackedFloat32Array *get_float32_array(Variant *v) { return &static_cast<Variant::PackedArrayRef<float> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static const PackedFloat32Array *get_float32_array(const Variant *v) { return &static_cast<const Variant::PackedArrayRef<float> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static PackedFloat64Array *get_float64_array(Variant *v) { return &static_cast<Variant::PackedArrayRef<double> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static const PackedFloat64Array *get_float64_array(const Variant *v) { return &static_cast<const Variant::PackedArrayRef<double> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static PackedStringArray *get_string_array(Variant *v) { return &static_cast<Variant::PackedArrayRef<String> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static const PackedStringArray *get_string_array(const Variant *v) { return &static_cast<const Variant::PackedArrayRef<String> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static PackedVector2Array *get_vector2_array(Variant *v) { return &static_cast<Variant::PackedArrayRef<Vector2> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static const PackedVector2Array *get_vector2_array(const Variant *v) { return &static_cast<const Variant::PackedArrayRef<Vector2> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static PackedVector3Array *get_vector3_array(Variant *v) { return &static_cast<Variant::PackedArrayRef<Vector3> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static const PackedVector3Array *get_vector3_array(const Variant *v) { return &static_cast<const Variant::PackedArrayRef<Vector3> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static PackedColorArray *get_color_array(Variant *v) { return &static_cast<Variant::PackedArrayRef<Color> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static const PackedColorArray *get_color_array(const Variant *v) { return &static_cast<const Variant::PackedArrayRef<Color> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static PackedVector4Array *get_vector4_array(Variant *v) { return &static_cast<Variant::PackedArrayRef<Vector4> *>(v->_data.packed_array)->array; }
- _FORCE_INLINE_ static const PackedVector4Array *get_vector4_array(const Variant *v) { return &static_cast<const Variant::PackedArrayRef<Vector4> *>(v->_data.packed_array)->array; }
-
- _FORCE_INLINE_ static Object **get_object(Variant *v) { return (Object **)&v->_get_obj().obj; }
- _FORCE_INLINE_ static const Object **get_object(const Variant *v) { return (const Object **)&v->_get_obj().obj; }
-
- _FORCE_INLINE_ static const ObjectID get_object_id(const Variant *v) { return v->_get_obj().id; }
+ _FORCE_INLINE_ static PackedByteArray *get_byte_array(Variant *p_variant) { return &static_cast<Variant::PackedArrayRef<uint8_t> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static const PackedByteArray *get_byte_array(const Variant *p_variant) { return &static_cast<const Variant::PackedArrayRef<uint8_t> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static PackedInt32Array *get_int32_array(Variant *p_variant) { return &static_cast<Variant::PackedArrayRef<int32_t> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static const PackedInt32Array *get_int32_array(const Variant *p_variant) { return &static_cast<const Variant::PackedArrayRef<int32_t> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static PackedInt64Array *get_int64_array(Variant *p_variant) { return &static_cast<Variant::PackedArrayRef<int64_t> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static const PackedInt64Array *get_int64_array(const Variant *p_variant) { return &static_cast<const Variant::PackedArrayRef<int64_t> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static PackedFloat32Array *get_float32_array(Variant *p_variant) { return &static_cast<Variant::PackedArrayRef<float> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static const PackedFloat32Array *get_float32_array(const Variant *p_variant) { return &static_cast<const Variant::PackedArrayRef<float> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static PackedFloat64Array *get_float64_array(Variant *p_variant) { return &static_cast<Variant::PackedArrayRef<double> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static const PackedFloat64Array *get_float64_array(const Variant *p_variant) { return &static_cast<const Variant::PackedArrayRef<double> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static PackedStringArray *get_string_array(Variant *p_variant) { return &static_cast<Variant::PackedArrayRef<String> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static const PackedStringArray *get_string_array(const Variant *p_variant) { return &static_cast<const Variant::PackedArrayRef<String> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static PackedVector2Array *get_vector2_array(Variant *p_variant) { return &static_cast<Variant::PackedArrayRef<Vector2> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static const PackedVector2Array *get_vector2_array(const Variant *p_variant) { return &static_cast<const Variant::PackedArrayRef<Vector2> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static PackedVector3Array *get_vector3_array(Variant *p_variant) { return &static_cast<Variant::PackedArrayRef<Vector3> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static const PackedVector3Array *get_vector3_array(const Variant *p_variant) { return &static_cast<const Variant::PackedArrayRef<Vector3> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static PackedColorArray *get_color_array(Variant *p_variant) { return &static_cast<Variant::PackedArrayRef<Color> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static const PackedColorArray *get_color_array(const Variant *p_variant) { return &static_cast<const Variant::PackedArrayRef<Color> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static PackedVector4Array *get_vector4_array(Variant *p_variant) { return &static_cast<Variant::PackedArrayRef<Vector4> *>(p_variant->_data.packed_array)->array; }
+ _FORCE_INLINE_ static const PackedVector4Array *get_vector4_array(const Variant *p_variant) { return &static_cast<const Variant::PackedArrayRef<Vector4> *>(p_variant->_data.packed_array)->array; }
+
+ _FORCE_INLINE_ static Object **get_object(Variant *p_variant) { return (Object **)&p_variant->_get_obj().obj; }
+ _FORCE_INLINE_ static const Object **get_object(const Variant *p_variant) { return (const Object **)&p_variant->_get_obj().obj; }
+
+ _FORCE_INLINE_ static const ObjectID get_object_id(const Variant *p_variant) { return p_variant->_get_obj().id; }
template <typename T>
- _FORCE_INLINE_ static void init_generic(Variant *v) {
- v->type = GetTypeInfo<T>::VARIANT_TYPE;
+ _FORCE_INLINE_ static void init_generic(Variant *r_variant) {
+ r_variant->type = GetTypeInfo<T>::VARIANT_TYPE;
}
// Should be in the same order as Variant::Type for consistency.
// Those primitive and vector types don't need an `init_` method:
// Nil, bool, float, Vector2/i, Rect2/i, Vector3/i, Plane, RID.
// Object is a special case, handled via `object_reset_data`.
- _FORCE_INLINE_ static void init_string(Variant *v) {
- memnew_placement(v->_data._mem, String);
- v->type = Variant::STRING;
- }
- _FORCE_INLINE_ static void init_transform2d(Variant *v) {
- v->_data._transform2d = VariantPools::alloc<Transform2D>();
- memnew_placement(v->_data._transform2d, Transform2D);
- v->type = Variant::TRANSFORM2D;
+ _FORCE_INLINE_ static void init_string(Variant *r_variant) {
+ memnew_placement(r_variant->_data._mem, String);
+ r_variant->type = Variant::STRING;
+ }
+ _FORCE_INLINE_ static void init_transform2d(Variant *r_variant) {
+ r_variant->_data._transform2d = VariantPools::alloc<Transform2D>();
+ memnew_placement(r_variant->_data._transform2d, Transform2D);
+ r_variant->type = Variant::TRANSFORM2D;
}
- _FORCE_INLINE_ static void init_quaternion(Variant *v) {
- memnew_placement(v->_data._mem, Quaternion);
- v->type = Variant::QUATERNION;
+ _FORCE_INLINE_ static void init_quaternion(Variant *r_variant) {
+ memnew_placement(r_variant->_data._mem, Quaternion);
+ r_variant->type = Variant::QUATERNION;
}
- _FORCE_INLINE_ static void init_aabb(Variant *v) {
- v->_data._aabb = VariantPools::alloc<AABB>();
- memnew_placement(v->_data._aabb, AABB);
- v->type = Variant::AABB;
+ _FORCE_INLINE_ static void init_aabb(Variant *r_variant) {
+ r_variant->_data._aabb = VariantPools::alloc<AABB>();
+ memnew_placement(r_variant->_data._aabb, AABB);
+ r_variant->type = Variant::AABB;
}
- _FORCE_INLINE_ static void init_basis(Variant *v) {
- v->_data._basis = VariantPools::alloc<Basis>();
- memnew_placement(v->_data._basis, Basis);
- v->type = Variant::BASIS;
+ _FORCE_INLINE_ static void init_basis(Variant *r_variant) {
+ r_variant->_data._basis = VariantPools::alloc<Basis>();
+ memnew_placement(r_variant->_data._basis, Basis);
+ r_variant->type = Variant::BASIS;
}
- _FORCE_INLINE_ static void init_transform3d(Variant *v) {
- v->_data._transform3d = VariantPools::alloc<Transform3D>();
- memnew_placement(v->_data._transform3d, Transform3D);
- v->type = Variant::TRANSFORM3D;
+ _FORCE_INLINE_ static void init_transform3d(Variant *r_variant) {
+ r_variant->_data._transform3d = VariantPools::alloc<Transform3D>();
+ memnew_placement(r_variant->_data._transform3d, Transform3D);
+ r_variant->type = Variant::TRANSFORM3D;
}
- _FORCE_INLINE_ static void init_projection(Variant *v) {
- v->_data._projection = VariantPools::alloc<Projection>();
- memnew_placement(v->_data._projection, Projection);
- v->type = Variant::PROJECTION;
+ _FORCE_INLINE_ static void init_projection(Variant *r_variant) {
+ r_variant->_data._projection = VariantPools::alloc<Projection>();
+ memnew_placement(r_variant->_data._projection, Projection);
+ r_variant->type = Variant::PROJECTION;
}
- _FORCE_INLINE_ static void init_color(Variant *v) {
- memnew_placement(v->_data._mem, Color);
- v->type = Variant::COLOR;
+ _FORCE_INLINE_ static void init_color(Variant *r_variant) {
+ memnew_placement(r_variant->_data._mem, Color);
+ r_variant->type = Variant::COLOR;
}
- _FORCE_INLINE_ static void init_string_name(Variant *v) {
- memnew_placement(v->_data._mem, StringName);
- v->type = Variant::STRING_NAME;
+ _FORCE_INLINE_ static void init_string_name(Variant *r_variant) {
+ memnew_placement(r_variant->_data._mem, StringName);
+ r_variant->type = Variant::STRING_NAME;
}
- _FORCE_INLINE_ static void init_node_path(Variant *v) {
- memnew_placement(v->_data._mem, NodePath);
- v->type = Variant::NODE_PATH;
+ _FORCE_INLINE_ static void init_node_path(Variant *r_variant) {
+ memnew_placement(r_variant->_data._mem, NodePath);
+ r_variant->type = Variant::NODE_PATH;
}
- _FORCE_INLINE_ static void init_callable(Variant *v) {
- memnew_placement(v->_data._mem, Callable);
- v->type = Variant::CALLABLE;
+ _FORCE_INLINE_ static void init_callable(Variant *r_variant) {
+ memnew_placement(r_variant->_data._mem, Callable);
+ r_variant->type = Variant::CALLABLE;
}
- _FORCE_INLINE_ static void init_signal(Variant *v) {
- memnew_placement(v->_data._mem, Signal);
- v->type = Variant::SIGNAL;
+ _FORCE_INLINE_ static void init_signal(Variant *r_variant) {
+ memnew_placement(r_variant->_data._mem, Signal);
+ r_variant->type = Variant::SIGNAL;
}
- _FORCE_INLINE_ static void init_dictionary(Variant *v) {
- memnew_placement(v->_data._mem, Dictionary);
- v->type = Variant::DICTIONARY;
+ _FORCE_INLINE_ static void init_dictionary(Variant *r_variant) {
+ memnew_placement(r_variant->_data._mem, Dictionary);
+ r_variant->type = Variant::DICTIONARY;
}
- _FORCE_INLINE_ static void init_array(Variant *v) {
- memnew_placement(v->_data._mem, Array);
- v->type = Variant::ARRAY;
+ _FORCE_INLINE_ static void init_array(Variant *r_variant) {
+ memnew_placement(r_variant->_data._mem, Array);
+ r_variant->type = Variant::ARRAY;
}
- _FORCE_INLINE_ static void init_byte_array(Variant *v) {
- v->_data.packed_array = Variant::PackedArrayRef<uint8_t>::create(Vector<uint8_t>());
- v->type = Variant::PACKED_BYTE_ARRAY;
+ _FORCE_INLINE_ static void init_byte_array(Variant *r_variant) {
+ r_variant->_data.packed_array = Variant::PackedArrayRef<uint8_t>::create(Vector<uint8_t>());
+ r_variant->type = Variant::PACKED_BYTE_ARRAY;
}
- _FORCE_INLINE_ static void init_int32_array(Variant *v) {
- v->_data.packed_array = Variant::PackedArrayRef<int32_t>::create(Vector<int32_t>());
- v->type = Variant::PACKED_INT32_ARRAY;
+ _FORCE_INLINE_ static void init_int32_array(Variant *r_variant) {
+ r_variant->_data.packed_array = Variant::PackedArrayRef<int32_t>::create(Vector<int32_t>());
+ r_variant->type = Variant::PACKED_INT32_ARRAY;
}
- _FORCE_INLINE_ static void init_int64_array(Variant *v) {
- v->_data.packed_array = Variant::PackedArrayRef<int64_t>::create(Vector<int64_t>());
- v->type = Variant::PACKED_INT64_ARRAY;
+ _FORCE_INLINE_ static void init_int64_array(Variant *r_variant) {
+ r_variant->_data.packed_array = Variant::PackedArrayRef<int64_t>::create(Vector<int64_t>());
+ r_variant->type = Variant::PACKED_INT64_ARRAY;
}
- _FORCE_INLINE_ static void init_float32_array(Variant *v) {
- v->_data.packed_array = Variant::PackedArrayRef<float>::create(Vector<float>());
- v->type = Variant::PACKED_FLOAT32_ARRAY;
+ _FORCE_INLINE_ static void init_float32_array(Variant *r_variant) {
+ r_variant->_data.packed_array = Variant::PackedArrayRef<float>::create(Vector<float>());
+ r_variant->type = Variant::PACKED_FLOAT32_ARRAY;
}
- _FORCE_INLINE_ static void init_float64_array(Variant *v) {
- v->_data.packed_array = Variant::PackedArrayRef<double>::create(Vector<double>());
- v->type = Variant::PACKED_FLOAT64_ARRAY;
+ _FORCE_INLINE_ static void init_float64_array(Variant *r_variant) {
+ r_variant->_data.packed_array = Variant::PackedArrayRef<double>::create(Vector<double>());
+ r_variant->type = Variant::PACKED_FLOAT64_ARRAY;
}
- _FORCE_INLINE_ static void init_string_array(Variant *v) {
- v->_data.packed_array = Variant::PackedArrayRef<String>::create(Vector<String>());
- v->type = Variant::PACKED_STRING_ARRAY;
+ _FORCE_INLINE_ static void init_string_array(Variant *r_variant) {
+ r_variant->_data.packed_array = Variant::PackedArrayRef<String>::create(Vector<String>());
+ r_variant->type = Variant::PACKED_STRING_ARRAY;
}
- _FORCE_INLINE_ static void init_vector2_array(Variant *v) {
- v->_data.packed_array = Variant::PackedArrayRef<Vector2>::create(Vector<Vector2>());
- v->type = Variant::PACKED_VECTOR2_ARRAY;
+ _FORCE_INLINE_ static void init_vector2_array(Variant *r_variant) {
+ r_variant->_data.packed_array = Variant::PackedArrayRef<Vector2>::create(Vector<Vector2>());
+ r_variant->type = Variant::PACKED_VECTOR2_ARRAY;
}
- _FORCE_INLINE_ static void init_vector3_array(Variant *v) {
- v->_data.packed_array = Variant::PackedArrayRef<Vector3>::create(Vector<Vector3>());
- v->type = Variant::PACKED_VECTOR3_ARRAY;
+ _FORCE_INLINE_ static void init_vector3_array(Variant *r_variant) {
+ r_variant->_data.packed_array = Variant::PackedArrayRef<Vector3>::create(Vector<Vector3>());
+ r_variant->type = Variant::PACKED_VECTOR3_ARRAY;
}
- _FORCE_INLINE_ static void init_color_array(Variant *v) {
- v->_data.packed_array = Variant::PackedArrayRef<Color>::create(Vector<Color>());
- v->type = Variant::PACKED_COLOR_ARRAY;
+ _FORCE_INLINE_ static void init_color_array(Variant *r_variant) {
+ r_variant->_data.packed_array = Variant::PackedArrayRef<Color>::create(Vector<Color>());
+ r_variant->type = Variant::PACKED_COLOR_ARRAY;
}
- _FORCE_INLINE_ static void init_vector4_array(Variant *v) {
- v->_data.packed_array = Variant::PackedArrayRef<Vector4>::create(Vector<Vector4>());
- v->type = Variant::PACKED_VECTOR4_ARRAY;
+ _FORCE_INLINE_ static void init_vector4_array(Variant *r_variant) {
+ r_variant->_data.packed_array = Variant::PackedArrayRef<Vector4>::create(Vector<Vector4>());
+ r_variant->type = Variant::PACKED_VECTOR4_ARRAY;
}
- _FORCE_INLINE_ static void init_object(Variant *v) {
- object_reset_data(v);
- v->type = Variant::OBJECT;
+ _FORCE_INLINE_ static void init_object(Variant *r_variant) {
+ object_reset_data(r_variant);
+ r_variant->type = Variant::OBJECT;
}
- _FORCE_INLINE_ static void clear(Variant *v) {
- v->clear();
+ _FORCE_INLINE_ static void clear(Variant *r_variant) {
+ r_variant->clear();
}
- _FORCE_INLINE_ static void object_assign(Variant *v, const Variant *vo) {
- v->_get_obj().ref(vo->_get_obj());
+ _FORCE_INLINE_ static void object_assign(Variant *r_variant, const Variant *p_var_obj) {
+ r_variant->_get_obj().ref(p_var_obj->_get_obj());
}
- _FORCE_INLINE_ static void object_assign(Variant *v, Object *o) {
- v->_get_obj().ref_pointer(o);
+ _FORCE_INLINE_ static void object_assign(Variant *r_variant, Object *p_object) {
+ r_variant->_get_obj().ref_pointer(p_object);
}
- _FORCE_INLINE_ static void object_assign(Variant *v, const Object *o) {
- v->_get_obj().ref_pointer(const_cast<Object *>(o));
+ _FORCE_INLINE_ static void object_assign(Variant *r_variant, const Object *p_object) {
+ r_variant->_get_obj().ref_pointer(const_cast<Object *>(p_object));
}
template <typename T>
- _FORCE_INLINE_ static void object_assign(Variant *v, const Ref<T> &r) {
- v->_get_obj().ref(r);
+ _FORCE_INLINE_ static void object_assign(Variant *r_variant, const Ref<T> &p_ref) {
+ r_variant->_get_obj().ref(p_ref);
}
// This should be used with extreme caution, as it does not increment the reference count in the
// case where the object is `RefCounted`. You *must* ensure that the destructor of this
// `Variant` is never called, and that the assigned object always outlives the `Variant`.
- _FORCE_INLINE_ static void object_assign_without_ref_unsafe(Variant *v, Object *o) {
- v->type = Variant::OBJECT;
- Variant::ObjData &obj_data = v->_get_obj();
- obj_data.id = o->get_instance_id();
- obj_data.obj = o;
+ _FORCE_INLINE_ static void object_assign_without_ref_unsafe(Variant *r_variant, Object *p_object) {
+ r_variant->type = Variant::OBJECT;
+ Variant::ObjData &obj_data = r_variant->_get_obj();
+ obj_data.id = p_object->get_instance_id();
+ obj_data.obj = p_object;
}
- _FORCE_INLINE_ static void object_reset_data(Variant *v) {
- v->_get_obj() = Variant::ObjData();
+ _FORCE_INLINE_ static void object_reset_data(Variant *r_variant) {
+ r_variant->_get_obj() = Variant::ObjData();
}
- _FORCE_INLINE_ static void update_object_id(Variant *v) {
- const Object *o = v->_get_obj().obj;
+ _FORCE_INLINE_ static void update_object_id(Variant *r_variant) {
+ const Object *o = r_variant->_get_obj().obj;
if (o) {
- v->_get_obj().id = o->get_instance_id();
+ r_variant->_get_obj().id = o->get_instance_id();
}
}
- _FORCE_INLINE_ static void *get_opaque_pointer(Variant *v) {
- switch (v->type) {
+ _FORCE_INLINE_ static void *get_opaque_pointer(Variant *p_variant) {
+ switch (p_variant->type) {
case Variant::NIL:
return nullptr;
case Variant::BOOL:
- return get_bool(v);
+ return get_bool(p_variant);
case Variant::INT:
- return get_int(v);
+ return get_int(p_variant);
case Variant::FLOAT:
- return get_float(v);
+ return get_float(p_variant);
case Variant::STRING:
- return get_string(v);
+ return get_string(p_variant);
case Variant::VECTOR2:
- return get_vector2(v);
+ return get_vector2(p_variant);
case Variant::VECTOR2I:
- return get_vector2i(v);
+ return get_vector2i(p_variant);
case Variant::VECTOR3:
- return get_vector3(v);
+ return get_vector3(p_variant);
case Variant::VECTOR3I:
- return get_vector3i(v);
+ return get_vector3i(p_variant);
case Variant::VECTOR4:
- return get_vector4(v);
+ return get_vector4(p_variant);
case Variant::VECTOR4I:
- return get_vector4i(v);
+ return get_vector4i(p_variant);
case Variant::RECT2:
- return get_rect2(v);
+ return get_rect2(p_variant);
case Variant::RECT2I:
- return get_rect2i(v);
+ return get_rect2i(p_variant);
case Variant::TRANSFORM3D:
- return get_transform(v);
+ return get_transform(p_variant);
case Variant::PROJECTION:
- return get_projection(v);
+ return get_projection(p_variant);
case Variant::TRANSFORM2D:
- return get_transform2d(v);
+ return get_transform2d(p_variant);
case Variant::QUATERNION:
- return get_quaternion(v);
+ return get_quaternion(p_variant);
case Variant::PLANE:
- return get_plane(v);
+ return get_plane(p_variant);
case Variant::BASIS:
- return get_basis(v);
+ return get_basis(p_variant);
case Variant::AABB:
- return get_aabb(v);
+ return get_aabb(p_variant);
case Variant::COLOR:
- return get_color(v);
+ return get_color(p_variant);
case Variant::STRING_NAME:
- return get_string_name(v);
+ return get_string_name(p_variant);
case Variant::NODE_PATH:
- return get_node_path(v);
+ return get_node_path(p_variant);
case Variant::RID:
- return get_rid(v);
+ return get_rid(p_variant);
case Variant::CALLABLE:
- return get_callable(v);
+ return get_callable(p_variant);
case Variant::SIGNAL:
- return get_signal(v);
+ return get_signal(p_variant);
case Variant::DICTIONARY:
- return get_dictionary(v);
+ return get_dictionary(p_variant);
case Variant::ARRAY:
- return get_array(v);
+ return get_array(p_variant);
case Variant::PACKED_BYTE_ARRAY:
- return get_byte_array(v);
+ return get_byte_array(p_variant);
case Variant::PACKED_INT32_ARRAY:
- return get_int32_array(v);
+ return get_int32_array(p_variant);
case Variant::PACKED_INT64_ARRAY:
- return get_int64_array(v);
+ return get_int64_array(p_variant);
case Variant::PACKED_FLOAT32_ARRAY:
- return get_float32_array(v);
+ return get_float32_array(p_variant);
case Variant::PACKED_FLOAT64_ARRAY:
- return get_float64_array(v);
+ return get_float64_array(p_variant);
case Variant::PACKED_STRING_ARRAY:
- return get_string_array(v);
+ return get_string_array(p_variant);
case Variant::PACKED_VECTOR2_ARRAY:
- return get_vector2_array(v);
+ return get_vector2_array(p_variant);
case Variant::PACKED_VECTOR3_ARRAY:
- return get_vector3_array(v);
+ return get_vector3_array(p_variant);
case Variant::PACKED_COLOR_ARRAY:
- return get_color_array(v);
+ return get_color_array(p_variant);
case Variant::PACKED_VECTOR4_ARRAY:
- return get_vector4_array(v);
+ return get_vector4_array(p_variant);
case Variant::OBJECT:
- return get_object(v);
+ return get_object(p_variant);
case Variant::VARIANT_MAX:
ERR_FAIL_V(nullptr);
}
ERR_FAIL_V(nullptr);
}
- _FORCE_INLINE_ static const void *get_opaque_pointer(const Variant *v) {
- switch (v->type) {
+ _FORCE_INLINE_ static const void *get_opaque_pointer(const Variant *p_variant) {
+ switch (p_variant->type) {
case Variant::NIL:
return nullptr;
case Variant::BOOL:
- return get_bool(v);
+ return get_bool(p_variant);
case Variant::INT:
- return get_int(v);
+ return get_int(p_variant);
case Variant::FLOAT:
- return get_float(v);
+ return get_float(p_variant);
case Variant::STRING:
- return get_string(v);
+ return get_string(p_variant);
case Variant::VECTOR2:
- return get_vector2(v);
+ return get_vector2(p_variant);
case Variant::VECTOR2I:
- return get_vector2i(v);
+ return get_vector2i(p_variant);
case Variant::VECTOR3:
- return get_vector3(v);
+ return get_vector3(p_variant);
case Variant::VECTOR3I:
- return get_vector3i(v);
+ return get_vector3i(p_variant);
case Variant::VECTOR4:
- return get_vector4(v);
+ return get_vector4(p_variant);
case Variant::VECTOR4I:
- return get_vector4i(v);
+ return get_vector4i(p_variant);
case Variant::RECT2:
- return get_rect2(v);
+ return get_rect2(p_variant);
case Variant::RECT2I:
- return get_rect2i(v);
+ return get_rect2i(p_variant);
case Variant::TRANSFORM3D:
- return get_transform(v);
+ return get_transform(p_variant);
case Variant::PROJECTION:
- return get_projection(v);
+ return get_projection(p_variant);
case Variant::TRANSFORM2D:
- return get_transform2d(v);
+ return get_transform2d(p_variant);
case Variant::QUATERNION:
- return get_quaternion(v);
+ return get_quaternion(p_variant);
case Variant::PLANE:
- return get_plane(v);
+ return get_plane(p_variant);
case Variant::BASIS:
- return get_basis(v);
+ return get_basis(p_variant);
case Variant::AABB:
- return get_aabb(v);
+ return get_aabb(p_variant);
case Variant::COLOR:
- return get_color(v);
+ return get_color(p_variant);
case Variant::STRING_NAME:
- return get_string_name(v);
+ return get_string_name(p_variant);
case Variant::NODE_PATH:
- return get_node_path(v);
+ return get_node_path(p_variant);
case Variant::RID:
- return get_rid(v);
+ return get_rid(p_variant);
case Variant::CALLABLE:
- return get_callable(v);
+ return get_callable(p_variant);
case Variant::SIGNAL:
- return get_signal(v);
+ return get_signal(p_variant);
case Variant::DICTIONARY:
- return get_dictionary(v);
+ return get_dictionary(p_variant);
case Variant::ARRAY:
- return get_array(v);
+ return get_array(p_variant);
case Variant::PACKED_BYTE_ARRAY:
- return get_byte_array(v);
+ return get_byte_array(p_variant);
case Variant::PACKED_INT32_ARRAY:
- return get_int32_array(v);
+ return get_int32_array(p_variant);
case Variant::PACKED_INT64_ARRAY:
- return get_int64_array(v);
+ return get_int64_array(p_variant);
case Variant::PACKED_FLOAT32_ARRAY:
- return get_float32_array(v);
+ return get_float32_array(p_variant);
case Variant::PACKED_FLOAT64_ARRAY:
- return get_float64_array(v);
+ return get_float64_array(p_variant);
case Variant::PACKED_STRING_ARRAY:
- return get_string_array(v);
+ return get_string_array(p_variant);
case Variant::PACKED_VECTOR2_ARRAY:
- return get_vector2_array(v);
+ return get_vector2_array(p_variant);
case Variant::PACKED_VECTOR3_ARRAY:
- return get_vector3_array(v);
+ return get_vector3_array(p_variant);
case Variant::PACKED_COLOR_ARRAY:
- return get_color_array(v);
+ return get_color_array(p_variant);
case Variant::PACKED_VECTOR4_ARRAY:
- return get_vector4_array(v);
+ return get_vector4_array(p_variant);
case Variant::OBJECT:
- return get_object(v);
+ return get_object(p_variant);
case Variant::VARIANT_MAX:
ERR_FAIL_V(nullptr);
}
@@ -556,20 +556,20 @@ public:
// Used internally in GDExtension and Godot's binding system when converting to Variant
// from values that may include RequiredParam<T> or RequiredResult<T>.
template <typename T>
- _FORCE_INLINE_ static Variant make(const T &v) {
- return Variant(v);
+ _FORCE_INLINE_ static Variant make(const T &p_variant) {
+ return Variant(p_variant);
}
template <typename T>
- _FORCE_INLINE_ static Variant make(const GDExtensionPtr<T> &v) {
- return v.operator Variant();
+ _FORCE_INLINE_ static Variant make(const GDExtensionPtr<T> &p_variant) {
+ return p_variant.operator Variant();
}
template <typename T>
- _FORCE_INLINE_ static Variant make(const RequiredParam<T> &v) {
- return Variant(v._internal_ptr_dont_use());
+ _FORCE_INLINE_ static Variant make(const RequiredParam<T> &p_variant) {
+ return Variant(p_variant._internal_ptr_dont_use());
}
template <typename T>
- _FORCE_INLINE_ static Variant make(const RequiredResult<T> &v) {
- return Variant(v._internal_ptr_dont_use());
+ _FORCE_INLINE_ static Variant make(const RequiredResult<T> &p_variant) {
+ return Variant(p_variant._internal_ptr_dont_use());
}
};
@@ -583,117 +583,117 @@ template <typename T>
struct _VariantInternalAccessorLocal {
using declared_when_native_type = void;
static constexpr bool is_local = true;
- static _FORCE_INLINE_ T &get(Variant *v) { return *reinterpret_cast<T *>(v->_data._mem); }
- static _FORCE_INLINE_ const T &get(const Variant *v) { return *reinterpret_cast<const T *>(v->_data._mem); }
- static _FORCE_INLINE_ void set(Variant *v, T p_value) { *reinterpret_cast<T *>(v->_data._mem) = std::move(p_value); }
+ static _FORCE_INLINE_ T &get(Variant *p_variant) { return *reinterpret_cast<T *>(p_variant->_data._mem); }
+ static _FORCE_INLINE_ const T &get(const Variant *p_variant) { return *reinterpret_cast<const T *>(p_variant->_data._mem); }
+ static _FORCE_INLINE_ void set(Variant *r_variant, T p_value) { *reinterpret_cast<T *>(r_variant->_data._mem) = std::move(p_value); }
};
template <typename T>
struct _VariantInternalAccessorElsewhere {
using declared_when_native_type = void;
- static _FORCE_INLINE_ T &get(Variant *v) { return *reinterpret_cast<T *>(v->_data._ptr); }
- static _FORCE_INLINE_ const T &get(const Variant *v) { return *reinterpret_cast<const T *>(v->_data._ptr); }
- static _FORCE_INLINE_ void set(Variant *v, T p_value) { *reinterpret_cast<T *>(v->_data._ptr) = std::move(p_value); }
+ static _FORCE_INLINE_ T &get(Variant *p_variant) { return *reinterpret_cast<T *>(p_variant->_data._ptr); }
+ static _FORCE_INLINE_ const T &get(const Variant *p_variant) { return *reinterpret_cast<const T *>(p_variant->_data._ptr); }
+ static _FORCE_INLINE_ void set(Variant *r_variant, T p_value) { *reinterpret_cast<T *>(r_variant->_data._ptr) = std::move(p_value); }
};
template <typename T>
struct _VariantInternalAccessorPackedArrayRef {
using declared_when_native_type = void;
- static _FORCE_INLINE_ Vector<T> &get(Variant *v) { return static_cast<Variant::PackedArrayRef<T> *>(v->_data.packed_array)->array; }
- static _FORCE_INLINE_ const Vector<T> &get(const Variant *v) { return static_cast<const Variant::PackedArrayRef<T> *>(v->_data.packed_array)->array; }
- static _FORCE_INLINE_ void set(Variant *v, Vector<T> p_value) { static_cast<Variant::PackedArrayRef<T> *>(v->_data.packed_array)->array = std::move(p_value); }
+ static _FORCE_INLINE_ Vector<T> &get(Variant *p_variant) { return static_cast<Variant::PackedArrayRef<T> *>(p_variant->_data.packed_array)->array; }
+ static _FORCE_INLINE_ const Vector<T> &get(const Variant *p_variant) { return static_cast<const Variant::PackedArrayRef<T> *>(p_variant->_data.packed_array)->array; }
+ static _FORCE_INLINE_ void set(Variant *r_variant, Vector<T> p_value) { static_cast<Variant::PackedArrayRef<T> *>(r_variant->_data.packed_array)->array = std::move(p_value); }
};
template <typename T>
struct VariantInternalAccessor<T *> {
- static _FORCE_INLINE_ T *get(const Variant *v) { return const_cast<T *>(static_cast<const T *>(*VariantInternal::get_object(v))); }
- static _FORCE_INLINE_ void set(Variant *v, const T *p_value) { VariantInternal::object_assign(v, p_value); }
+ static _FORCE_INLINE_ T *get(const Variant *p_variant) { return const_cast<T *>(static_cast<const T *>(*VariantInternal::get_object(p_variant))); }
+ static _FORCE_INLINE_ void set(Variant *r_variant, const T *p_value) { VariantInternal::object_assign(r_variant, p_value); }
};
template <typename T>
struct VariantInternalAccessor<const T *> {
- static _FORCE_INLINE_ const T *get(const Variant *v) { return static_cast<const T *>(*VariantInternal::get_object(v)); }
- static _FORCE_INLINE_ void set(Variant *v, const T *p_value) { VariantInternal::object_assign(v, p_value); }
+ static _FORCE_INLINE_ const T *get(const Variant *p_variant) { return static_cast<const T *>(*VariantInternal::get_object(p_variant)); }
+ static _FORCE_INLINE_ void set(Variant *r_variant, const T *p_value) { VariantInternal::object_assign(r_variant, p_value); }
};
template <>
struct VariantInternalAccessor<IPAddress> {
- static _FORCE_INLINE_ IPAddress get(const Variant *v) { return IPAddress(*VariantInternal::get_string(v)); }
- static _FORCE_INLINE_ void set(Variant *v, IPAddress p_value) { *VariantInternal::get_string(v) = String(p_value); }
+ static _FORCE_INLINE_ IPAddress get(const Variant *p_variant) { return IPAddress(*VariantInternal::get_string(p_variant)); }
+ static _FORCE_INLINE_ void set(Variant *r_variant, IPAddress p_value) { *VariantInternal::get_string(r_variant) = String(p_value); }
};
template <typename T>
struct VariantInternalAccessor<TypedArray<T>> {
- static _FORCE_INLINE_ TypedArray<T> get(const Variant *v) { return TypedArray<T>(*VariantInternal::get_array(v)); }
- static _FORCE_INLINE_ void set(Variant *v, const TypedArray<T> &p_array) { *VariantInternal::get_array(v) = Array(p_array); }
+ static _FORCE_INLINE_ TypedArray<T> get(const Variant *p_variant) { return TypedArray<T>(*VariantInternal::get_array(p_variant)); }
+ static _FORCE_INLINE_ void set(Variant *r_variant, const TypedArray<T> &p_array) { *VariantInternal::get_array(r_variant) = Array(p_array); }
};
template <typename K, typename V>
struct VariantInternalAccessor<TypedDictionary<K, V>> {
- static _FORCE_INLINE_ TypedDictionary<K, V> get(const Variant *v) { return TypedDictionary<K, V>(*VariantInternal::get_dictionary(v)); }
- static _FORCE_INLINE_ void set(Variant *v, const TypedDictionary<K, V> &p_dictionary) { *VariantInternal::get_dictionary(v) = Dictionary(p_dictionary); }
+ static _FORCE_INLINE_ TypedDictionary<K, V> get(const Variant *p_variant) { return TypedDictionary<K, V>(*VariantInternal::get_dictionary(p_variant)); }
+ static _FORCE_INLINE_ void set(Variant *r_variant, const TypedDictionary<K, V> &p_dictionary) { *VariantInternal::get_dictionary(r_variant) = Dictionary(p_dictionary); }
};
template <>
struct VariantInternalAccessor<Object *> {
- static _FORCE_INLINE_ Object *get(const Variant *v) { return const_cast<Object *>(*VariantInternal::get_object(v)); }
- static _FORCE_INLINE_ void set(Variant *v, const Object *p_value) { VariantInternal::object_assign(v, p_value); }
+ static _FORCE_INLINE_ Object *get(const Variant *p_variant) { return const_cast<Object *>(*VariantInternal::get_object(p_variant)); }
+ static _FORCE_INLINE_ void set(Variant *r_variant, const Object *p_value) { VariantInternal::object_assign(r_variant, p_value); }
};
template <typename T>
struct VariantInternalAccessor<Ref<T>> {
- static _FORCE_INLINE_ Ref<T> get(const Variant *v) { return Ref<T>(const_cast<Object *>(*VariantInternal::get_object(v))); }
- static _FORCE_INLINE_ void set(Variant *v, const Ref<T> &p_ref) { VariantInternal::object_assign(v, p_ref); }
+ static _FORCE_INLINE_ Ref<T> get(const Variant *p_variant) { return Ref<T>(const_cast<Object *>(*VariantInternal::get_object(p_variant))); }
+ static _FORCE_INLINE_ void set(Variant *r_variant, const Ref<T> &p_ref) { VariantInternal::object_assign(r_variant, p_ref); }
};
template <class T>
struct VariantInternalAccessor<RequiredParam<T>> {
- static _FORCE_INLINE_ RequiredParam<T> get(const Variant *v) { return RequiredParam<T>(Object::cast_to<T>(const_cast<Object *>(*VariantInternal::get_object(v)))); }
- static _FORCE_INLINE_ void set(Variant *v, const RequiredParam<T> &p_value) { VariantInternal::object_assign(v, p_value.ptr()); }
+ static _FORCE_INLINE_ RequiredParam<T> get(const Variant *p_variant) { return RequiredParam<T>(Object::cast_to<T>(const_cast<Object *>(*VariantInternal::get_object(p_variant)))); }
+ static _FORCE_INLINE_ void set(Variant *r_variant, const RequiredParam<T> &p_value) { VariantInternal::object_assign(r_variant, p_value.ptr()); }
};
template <class T>
struct VariantInternalAccessor<const RequiredParam<T> &> {
- static _FORCE_INLINE_ RequiredParam<T> get(const Variant *v) { return RequiredParam<T>(Object::cast_to<T>(*VariantInternal::get_object(v))); }
- static _FORCE_INLINE_ void set(Variant *v, const RequiredParam<T> &p_value) { VariantInternal::object_assign(v, p_value.ptr()); }
+ static _FORCE_INLINE_ RequiredParam<T> get(const Variant *p_variant) { return RequiredParam<T>(Object::cast_to<T>(*VariantInternal::get_object(p_variant))); }
+ static _FORCE_INLINE_ void set(Variant *r_variant, const RequiredParam<T> &p_value) { VariantInternal::object_assign(r_variant, p_value.ptr()); }
};
template <class T>
struct VariantInternalAccessor<RequiredResult<T>> {
- static _FORCE_INLINE_ RequiredResult<T> get(const Variant *v) { return RequiredResult<T>(Object::cast_to<T>(const_cast<Object *>(*VariantInternal::get_object(v)))); }
- static _FORCE_INLINE_ void set(Variant *v, const RequiredResult<T> &p_value) { VariantInternal::object_assign(v, p_value.ptr()); }
+ static _FORCE_INLINE_ RequiredResult<T> get(const Variant *p_variant) { return RequiredResult<T>(Object::cast_to<T>(const_cast<Object *>(*VariantInternal::get_object(p_variant)))); }
+ static _FORCE_INLINE_ void set(Variant *r_variant, const RequiredResult<T> &p_value) { VariantInternal::object_assign(r_variant, p_value.ptr()); }
};
template <class T>
struct VariantInternalAccessor<const RequiredResult<T> &> {
- static _FORCE_INLINE_ RequiredResult<T> get(const Variant *v) { return RequiredResult<T>(Object::cast_to<T>(*VariantInternal::get_object(v))); }
- static _FORCE_INLINE_ void set(Variant *v, const RequiredResult<T> &p_value) { VariantInternal::object_assign(v, p_value.ptr()); }
+ static _FORCE_INLINE_ RequiredResult<T> get(const Variant *p_variant) { return RequiredResult<T>(Object::cast_to<T>(*VariantInternal::get_object(p_variant))); }
+ static _FORCE_INLINE_ void set(Variant *r_variant, const RequiredResult<T> &p_value) { VariantInternal::object_assign(r_variant, p_value.ptr()); }
};
template <>
struct VariantInternalAccessor<Variant> {
- static _FORCE_INLINE_ Variant &get(Variant *v) { return *v; }
- static _FORCE_INLINE_ const Variant &get(const Variant *v) { return *v; }
- static _FORCE_INLINE_ void set(Variant *v, const Variant &p_value) { *v = p_value; }
+ static _FORCE_INLINE_ Variant &get(Variant *p_variant) { return *p_variant; }
+ static _FORCE_INLINE_ const Variant &get(const Variant *p_variant) { return *p_variant; }
+ static _FORCE_INLINE_ void set(Variant *r_variant, const Variant &p_value) { *r_variant = p_value; }
};
template <>
struct VariantInternalAccessor<Vector<Variant>> {
- static _FORCE_INLINE_ Vector<Variant> get(const Variant *v) {
+ static _FORCE_INLINE_ Vector<Variant> get(const Variant *p_variant) {
Vector<Variant> ret;
- int s = VariantInternal::get_array(v)->size();
+ int s = VariantInternal::get_array(p_variant)->size();
ret.resize(s);
for (int i = 0; i < s; i++) {
- ret.write[i] = VariantInternal::get_array(v)->get(i);
+ ret.write[i] = VariantInternal::get_array(p_variant)->get(i);
}
return ret;
}
- static _FORCE_INLINE_ void set(Variant *v, const Vector<Variant> &p_value) {
+ static _FORCE_INLINE_ void set(Variant *r_variant, const Vector<Variant> &p_value) {
int s = p_value.size();
- VariantInternal::get_array(v)->resize(s);
+ VariantInternal::get_array(r_variant)->resize(s);
for (int i = 0; i < s; i++) {
- VariantInternal::get_array(v)->set(i, p_value[i]);
+ VariantInternal::get_array(r_variant)->set(i, p_value[i]);
}
}
};
@@ -823,11 +823,11 @@ constexpr bool IsVariantTypeT = IsVariantType<T>::value;
template <typename T, typename S>
struct _VariantInternalAccessorConvert {
- static _FORCE_INLINE_ T get(const Variant *v) {
- return T(VariantInternalAccessor<S>::get(v));
+ static _FORCE_INLINE_ T get(const Variant *p_variant) {
+ return T(VariantInternalAccessor<S>::get(p_variant));
}
- static _FORCE_INLINE_ void set(Variant *v, const T p_value) {
- VariantInternalAccessor<S>::get(v) = S(std::move(p_value));
+ static _FORCE_INLINE_ void set(Variant *r_variant, const T p_value) {
+ VariantInternalAccessor<S>::get(r_variant) = S(std::move(p_value));
}
};
@@ -848,95 +848,95 @@ struct VariantInternalAccessor<float> : _VariantInternalAccessorConvert<float, d
template <typename T, typename = void>
struct VariantInitializer {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<T>(v); }
+ static _FORCE_INLINE_ void init(Variant *r_variant) { VariantInternal::init_generic<T>(r_variant); }
};
template <typename T>
struct VariantInitializer<T, std::enable_if_t<VariantInternalAccessor<T>::is_local>> {
- static _FORCE_INLINE_ void init(Variant *v) {
- memnew_placement(&VariantInternalAccessor<T>::get(v), T());
- VariantInternal::set_type(*v, GetTypeInfo<T>::VARIANT_TYPE);
+ static _FORCE_INLINE_ void init(Variant *r_variant) {
+ memnew_placement(&VariantInternalAccessor<T>::get(r_variant), T());
+ VariantInternal::set_type(*r_variant, GetTypeInfo<T>::VARIANT_TYPE);
}
};
template <>
struct VariantInitializer<Transform2D> {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_transform2d(v); }
+ static _FORCE_INLINE_ void init(Variant *r_variant) { VariantInternal::init_transform2d(r_variant); }
};
template <>
struct VariantInitializer<AABB> {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_aabb(v); }
+ static _FORCE_INLINE_ void init(Variant *r_variant) { VariantInternal::init_aabb(r_variant); }
};
template <>
struct VariantInitializer<Basis> {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_basis(v); }
+ static _FORCE_INLINE_ void init(Variant *r_variant) { VariantInternal::init_basis(r_variant); }
};
template <>
struct VariantInitializer<Transform3D> {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_transform3d(v); }
+ static _FORCE_INLINE_ void init(Variant *r_variant) { VariantInternal::init_transform3d(r_variant); }
};
template <>
struct VariantInitializer<Projection> {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_projection(v); }
+ static _FORCE_INLINE_ void init(Variant *r_variant) { VariantInternal::init_projection(r_variant); }
};
template <>
struct VariantInitializer<PackedByteArray> {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_byte_array(v); }
+ static _FORCE_INLINE_ void init(Variant *r_variant) { VariantInternal::init_byte_array(r_variant); }
};
template <>
struct VariantInitializer<PackedInt32Array> {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_int32_array(v); }
+ static _FORCE_INLINE_ void init(Variant *r_variant) { VariantInternal::init_int32_array(r_variant); }
};
template <>
struct VariantInitializer<PackedInt64Array> {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_int64_array(v); }
+ static _FORCE_INLINE_ void init(Variant *r_variant) { VariantInternal::init_int64_array(r_variant); }
};
template <>
struct VariantInitializer<PackedFloat32Array> {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_float32_array(v); }
+ static _FORCE_INLINE_ void init(Variant *r_variant) { VariantInternal::init_float32_array(r_variant); }
};
template <>
struct VariantInitializer<PackedFloat64Array> {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_float64_array(v); }
+ static _FORCE_INLINE_ void init(Variant *r_variant) { VariantInternal::init_float64_array(r_variant); }
};
template <>
struct VariantInitializer<PackedStringArray> {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_string_array(v); }
+ static _FORCE_INLINE_ void init(Variant *r_variant) { VariantInternal::init_string_array(r_variant); }
};
template <>
struct VariantInitializer<PackedVector2Array> {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_vector2_array(v); }
+ static _FORCE_INLINE_ void init(Variant *r_variant) { VariantInternal::init_vector2_array(r_variant); }
};
template <>
struct VariantInitializer<PackedVector3Array> {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_vector3_array(v); }
+ static _FORCE_INLINE_ void init(Variant *r_variant) { VariantInternal::init_vector3_array(r_variant); }
};
template <>
struct VariantInitializer<PackedColorArray> {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_color_array(v); }
+ static _FORCE_INLINE_ void init(Variant *r_variant) { VariantInternal::init_color_array(r_variant); }
};
template <>
struct VariantInitializer<PackedVector4Array> {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_vector4_array(v); }
+ static _FORCE_INLINE_ void init(Variant *r_variant) { VariantInternal::init_vector4_array(r_variant); }
};
template <>
struct VariantInitializer<Object *> {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_object(v); }
+ static _FORCE_INLINE_ void init(Variant *r_variant) { VariantInternal::init_object(r_variant); }
};
/// Note: This struct assumes that the argument type is already of the correct type.
@@ -945,25 +945,25 @@ struct VariantDefaultInitializer;
template <typename T>
struct VariantDefaultInitializer<T, std::enable_if_t<IsVariantTypeT<T>>> {
- static _FORCE_INLINE_ void init(Variant *v) {
- VariantInternalAccessor<T>::get(v) = T();
+ static _FORCE_INLINE_ void init(Variant *r_variant) {
+ VariantInternalAccessor<T>::get(r_variant) = T();
}
};
template <typename T>
struct VariantTypeChanger {
- static _FORCE_INLINE_ void change(Variant *v) {
- if (v->get_type() != GetTypeInfo<T>::VARIANT_TYPE || GetTypeInfo<T>::VARIANT_TYPE >= Variant::PACKED_BYTE_ARRAY) { //second condition removed by optimizer
- VariantInternal::clear(v);
- VariantInitializer<T>::init(v);
+ static _FORCE_INLINE_ void change(Variant *r_variant) {
+ if (r_variant->get_type() != GetTypeInfo<T>::VARIANT_TYPE || GetTypeInfo<T>::VARIANT_TYPE >= Variant::PACKED_BYTE_ARRAY) { //second condition removed by optimizer
+ VariantInternal::clear(r_variant);
+ VariantInitializer<T>::init(r_variant);
}
}
- static _FORCE_INLINE_ void change_and_reset(Variant *v) {
- if (v->get_type() != GetTypeInfo<T>::VARIANT_TYPE || GetTypeInfo<T>::VARIANT_TYPE >= Variant::PACKED_BYTE_ARRAY) { //second condition removed by optimizer
- VariantInternal::clear(v);
- VariantInitializer<T>::init(v);
+ static _FORCE_INLINE_ void change_and_reset(Variant *r_variant) {
+ if (r_variant->get_type() != GetTypeInfo<T>::VARIANT_TYPE || GetTypeInfo<T>::VARIANT_TYPE >= Variant::PACKED_BYTE_ARRAY) { //second condition removed by optimizer
+ VariantInternal::clear(r_variant);
+ VariantInitializer<T>::init(r_variant);
} else {
- VariantDefaultInitializer<T>::init(v);
+ VariantDefaultInitializer<T>::init(r_variant);
}
}
};
diff --git a/core/variant/variant_op.cpp b/core/variant/variant_op.cpp
index 64fff111016..423f03ed498 100644
--- a/core/variant/variant_op.cpp
+++ b/core/variant/variant_op.cpp
@@ -50,11 +50,11 @@ void register_op(Variant::Operator p_op, Variant::Type p_type_a, Variant::Type p
template <>
class OperatorEvaluatorMul<Vector2, Vector2i, double> : public CommonEvaluate<OperatorEvaluatorMul<Vector2, Vector2i, double>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<Vector2>::get(r_ret) = Vector2(VariantInternalAccessor<Vector2i>::get(left).x, VariantInternalAccessor<Vector2i>::get(left).y) * VariantInternalAccessor<double>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<Vector2>::get(r_ret) = Vector2(VariantInternalAccessor<Vector2i>::get(p_left).x, VariantInternalAccessor<Vector2i>::get(p_left).y) * VariantInternalAccessor<double>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<Vector2>::encode(Vector2(PtrToArg<Vector2i>::convert(left).x, PtrToArg<Vector2i>::convert(left).y) * PtrToArg<double>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<Vector2>::encode(Vector2(PtrToArg<Vector2i>::convert(p_left).x, PtrToArg<Vector2i>::convert(p_left).y) * PtrToArg<double>::convert(p_right), r_ret);
}
using ReturnType = Vector2;
};
@@ -62,11 +62,11 @@ public:
template <>
class OperatorEvaluatorMul<Vector2, double, Vector2i> : public CommonEvaluate<OperatorEvaluatorMul<Vector2, double, Vector2i>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<Vector2>::get(r_ret) = Vector2(VariantInternalAccessor<Vector2i>::get(right).x, VariantInternalAccessor<Vector2i>::get(right).y) * VariantInternalAccessor<double>::get(left);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<Vector2>::get(r_ret) = Vector2(VariantInternalAccessor<Vector2i>::get(p_right).x, VariantInternalAccessor<Vector2i>::get(p_right).y) * VariantInternalAccessor<double>::get(p_left);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<Vector2>::encode(Vector2(PtrToArg<Vector2i>::convert(right).x, PtrToArg<Vector2i>::convert(right).y) * PtrToArg<double>::convert(left), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<Vector2>::encode(Vector2(PtrToArg<Vector2i>::convert(p_right).x, PtrToArg<Vector2i>::convert(p_right).y) * PtrToArg<double>::convert(p_left), r_ret);
}
using ReturnType = Vector2;
};
@@ -85,11 +85,11 @@ public:
*r_ret = Vector2(a.x, a.y) / b;
r_valid = true;
}
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<Vector2>::get(r_ret) = Vector2(VariantInternalAccessor<Vector2i>::get(left).x, VariantInternalAccessor<Vector2i>::get(left).y) / VariantInternalAccessor<double>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<Vector2>::get(r_ret) = Vector2(VariantInternalAccessor<Vector2i>::get(p_left).x, VariantInternalAccessor<Vector2i>::get(p_left).y) / VariantInternalAccessor<double>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<Vector2>::encode(Vector2(PtrToArg<Vector2i>::convert(left).x, PtrToArg<Vector2i>::convert(left).y) / PtrToArg<double>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<Vector2>::encode(Vector2(PtrToArg<Vector2i>::convert(p_left).x, PtrToArg<Vector2i>::convert(p_left).y) / PtrToArg<double>::convert(p_right), r_ret);
}
static Variant::Type get_return_type() { return GetTypeInfo<Vector2>::VARIANT_TYPE; }
};
@@ -97,11 +97,11 @@ public:
template <>
class OperatorEvaluatorMul<Vector3, Vector3i, double> : public CommonEvaluate<OperatorEvaluatorMul<Vector3, Vector3i, double>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<Vector3>::get(r_ret) = Vector3(VariantInternalAccessor<Vector3i>::get(left).x, VariantInternalAccessor<Vector3i>::get(left).y, VariantInternalAccessor<Vector3i>::get(left).z) * VariantInternalAccessor<double>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<Vector3>::get(r_ret) = Vector3(VariantInternalAccessor<Vector3i>::get(p_left).x, VariantInternalAccessor<Vector3i>::get(p_left).y, VariantInternalAccessor<Vector3i>::get(p_left).z) * VariantInternalAccessor<double>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<Vector3>::encode(Vector3(PtrToArg<Vector3i>::convert(left).x, PtrToArg<Vector3i>::convert(left).y, PtrToArg<Vector3i>::convert(left).z) * PtrToArg<double>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<Vector3>::encode(Vector3(PtrToArg<Vector3i>::convert(p_left).x, PtrToArg<Vector3i>::convert(p_left).y, PtrToArg<Vector3i>::convert(p_left).z) * PtrToArg<double>::convert(p_right), r_ret);
}
using ReturnType = Vector3;
};
@@ -109,11 +109,11 @@ public:
template <>
class OperatorEvaluatorMul<Vector3, double, Vector3i> : public CommonEvaluate<OperatorEvaluatorMul<Vector3, double, Vector3i>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<Vector3>::get(r_ret) = Vector3(VariantInternalAccessor<Vector3i>::get(right).x, VariantInternalAccessor<Vector3i>::get(right).y, VariantInternalAccessor<Vector3i>::get(right).z) * VariantInternalAccessor<double>::get(left);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<Vector3>::get(r_ret) = Vector3(VariantInternalAccessor<Vector3i>::get(p_right).x, VariantInternalAccessor<Vector3i>::get(p_right).y, VariantInternalAccessor<Vector3i>::get(p_right).z) * VariantInternalAccessor<double>::get(p_left);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<Vector3>::encode(Vector3(PtrToArg<Vector3i>::convert(right).x, PtrToArg<Vector3i>::convert(right).y, PtrToArg<Vector3i>::convert(right).z) * PtrToArg<double>::convert(left), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<Vector3>::encode(Vector3(PtrToArg<Vector3i>::convert(p_right).x, PtrToArg<Vector3i>::convert(p_right).y, PtrToArg<Vector3i>::convert(p_right).z) * PtrToArg<double>::convert(p_left), r_ret);
}
using ReturnType = Vector3;
};
@@ -132,11 +132,11 @@ public:
*r_ret = Vector3(a.x, a.y, a.z) / b;
r_valid = true;
}
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<Vector3>::get(r_ret) = Vector3(VariantInternalAccessor<Vector3i>::get(left).x, VariantInternalAccessor<Vector3i>::get(left).y, VariantInternalAccessor<Vector3i>::get(left).z) / VariantInternalAccessor<double>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<Vector3>::get(r_ret) = Vector3(VariantInternalAccessor<Vector3i>::get(p_left).x, VariantInternalAccessor<Vector3i>::get(p_left).y, VariantInternalAccessor<Vector3i>::get(p_left).z) / VariantInternalAccessor<double>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<Vector3>::encode(Vector3(PtrToArg<Vector3i>::convert(left).x, PtrToArg<Vector3i>::convert(left).y, PtrToArg<Vector3i>::convert(left).z) / PtrToArg<double>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<Vector3>::encode(Vector3(PtrToArg<Vector3i>::convert(p_left).x, PtrToArg<Vector3i>::convert(p_left).y, PtrToArg<Vector3i>::convert(p_left).z) / PtrToArg<double>::convert(p_right), r_ret);
}
static Variant::Type get_return_type() { return GetTypeInfo<Vector3>::VARIANT_TYPE; }
};
@@ -146,11 +146,11 @@ public:
template <>
class OperatorEvaluatorMul<Vector4, Vector4i, double> : public CommonEvaluate<OperatorEvaluatorMul<Vector4, Vector4i, double>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<Vector4>::get(r_ret) = Vector4(VariantInternalAccessor<Vector4i>::get(left).x, VariantInternalAccessor<Vector4i>::get(left).y, VariantInternalAccessor<Vector4i>::get(left).z, VariantInternalAccessor<Vector4i>::get(left).w) * VariantInternalAccessor<double>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<Vector4>::get(r_ret) = Vector4(VariantInternalAccessor<Vector4i>::get(p_left).x, VariantInternalAccessor<Vector4i>::get(p_left).y, VariantInternalAccessor<Vector4i>::get(p_left).z, VariantInternalAccessor<Vector4i>::get(p_left).w) * VariantInternalAccessor<double>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<Vector4>::encode(Vector4(PtrToArg<Vector4i>::convert(left).x, PtrToArg<Vector4i>::convert(left).y, PtrToArg<Vector4i>::convert(left).z, PtrToArg<Vector4i>::convert(left).w) * PtrToArg<double>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<Vector4>::encode(Vector4(PtrToArg<Vector4i>::convert(p_left).x, PtrToArg<Vector4i>::convert(p_left).y, PtrToArg<Vector4i>::convert(p_left).z, PtrToArg<Vector4i>::convert(p_left).w) * PtrToArg<double>::convert(p_right), r_ret);
}
using ReturnType = Vector4;
};
@@ -158,11 +158,11 @@ public:
template <>
class OperatorEvaluatorMul<Vector4, double, Vector4i> : public CommonEvaluate<OperatorEvaluatorMul<Vector4, double, Vector4i>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<Vector4>::get(r_ret) = Vector4(VariantInternalAccessor<Vector4i>::get(right).x, VariantInternalAccessor<Vector4i>::get(right).y, VariantInternalAccessor<Vector4i>::get(right).z, VariantInternalAccessor<Vector4i>::get(right).w) * VariantInternalAccessor<double>::get(left);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<Vector4>::get(r_ret) = Vector4(VariantInternalAccessor<Vector4i>::get(p_right).x, VariantInternalAccessor<Vector4i>::get(p_right).y, VariantInternalAccessor<Vector4i>::get(p_right).z, VariantInternalAccessor<Vector4i>::get(p_right).w) * VariantInternalAccessor<double>::get(p_left);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<Vector4>::encode(Vector4(PtrToArg<Vector4i>::convert(right).x, PtrToArg<Vector4i>::convert(right).y, PtrToArg<Vector4i>::convert(right).z, PtrToArg<Vector4i>::convert(right).w) * PtrToArg<double>::convert(left), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<Vector4>::encode(Vector4(PtrToArg<Vector4i>::convert(p_right).x, PtrToArg<Vector4i>::convert(p_right).y, PtrToArg<Vector4i>::convert(p_right).z, PtrToArg<Vector4i>::convert(p_right).w) * PtrToArg<double>::convert(p_left), r_ret);
}
using ReturnType = Vector4;
};
@@ -182,12 +182,12 @@ public:
r_valid = true;
}
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<Vector4>::get(r_ret) = Vector4(VariantInternalAccessor<Vector4i>::get(left).x, VariantInternalAccessor<Vector4i>::get(left).y, VariantInternalAccessor<Vector4i>::get(left).z, VariantInternalAccessor<Vector4i>::get(left).w) / VariantInternalAccessor<double>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<Vector4>::get(r_ret) = Vector4(VariantInternalAccessor<Vector4i>::get(p_left).x, VariantInternalAccessor<Vector4i>::get(p_left).y, VariantInternalAccessor<Vector4i>::get(p_left).z, VariantInternalAccessor<Vector4i>::get(p_left).w) / VariantInternalAccessor<double>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<Vector4>::encode(Vector4(PtrToArg<Vector4i>::convert(left).x, PtrToArg<Vector4i>::convert(left).y, PtrToArg<Vector4i>::convert(left).z, PtrToArg<Vector4i>::convert(left).w) / PtrToArg<double>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<Vector4>::encode(Vector4(PtrToArg<Vector4i>::convert(p_left).x, PtrToArg<Vector4i>::convert(p_left).y, PtrToArg<Vector4i>::convert(p_left).z, PtrToArg<Vector4i>::convert(p_left).w) / PtrToArg<double>::convert(p_right), r_ret);
}
static Variant::Type get_return_type() { return GetTypeInfo<Vector4>::VARIANT_TYPE; }
diff --git a/core/variant/variant_op.h b/core/variant/variant_op.h
index 9efbf664fb7..96427e3feb3 100644
--- a/core/variant/variant_op.h
+++ b/core/variant/variant_op.h
@@ -49,11 +49,11 @@ public:
template <typename R, typename A, typename B>
class OperatorEvaluatorAdd : public CommonEvaluate<OperatorEvaluatorAdd<R, A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(left) + VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) + VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<R>::encode(PtrToArg<A>::convert(left) + PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(p_left) + PtrToArg<B>::convert(p_right), r_ret);
}
using ReturnType = R;
};
@@ -61,11 +61,11 @@ public:
template <typename R, typename A, typename B>
class OperatorEvaluatorSub : public CommonEvaluate<OperatorEvaluatorSub<R, A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(left) - VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) - VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<R>::encode(PtrToArg<A>::convert(left) - PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(p_left) - PtrToArg<B>::convert(p_right), r_ret);
}
using ReturnType = R;
};
@@ -73,11 +73,11 @@ public:
template <typename R, typename A, typename B>
class OperatorEvaluatorMul : public CommonEvaluate<OperatorEvaluatorMul<R, A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(left) * VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) * VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<R>::encode(PtrToArg<A>::convert(left) * PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(p_left) * PtrToArg<B>::convert(p_right), r_ret);
}
using ReturnType = R;
};
@@ -85,11 +85,11 @@ public:
template <typename R, typename A, typename B>
class OperatorEvaluatorPow : public CommonEvaluate<OperatorEvaluatorPow<R, A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<R>::get(r_ret) = R(Math::pow((double)VariantInternalAccessor<A>::get(left), (double)VariantInternalAccessor<B>::get(right)));
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<R>::get(r_ret) = R(Math::pow((double)VariantInternalAccessor<A>::get(p_left), (double)VariantInternalAccessor<B>::get(p_right)));
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<R>::encode(R(Math::pow((double)PtrToArg<A>::convert(left), (double)PtrToArg<B>::convert(right))), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<R>::encode(R(Math::pow((double)PtrToArg<A>::convert(p_left), (double)PtrToArg<B>::convert(p_right))), r_ret);
}
using ReturnType = R;
};
@@ -97,11 +97,11 @@ public:
template <typename R, typename A, typename B>
class OperatorEvaluatorXForm : public CommonEvaluate<OperatorEvaluatorXForm<R, A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(left).xform(VariantInternalAccessor<B>::get(right));
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(p_left).xform(VariantInternalAccessor<B>::get(p_right));
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<R>::encode(PtrToArg<A>::convert(left).xform(PtrToArg<B>::convert(right)), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(p_left).xform(PtrToArg<B>::convert(p_right)), r_ret);
}
using ReturnType = R;
};
@@ -109,11 +109,11 @@ public:
template <typename R, typename A, typename B>
class OperatorEvaluatorXFormInv : public CommonEvaluate<OperatorEvaluatorXFormInv<R, A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<B>::get(right).xform_inv(VariantInternalAccessor<A>::get(left));
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<B>::get(p_right).xform_inv(VariantInternalAccessor<A>::get(p_left));
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<R>::encode(PtrToArg<B>::convert(right).xform_inv(PtrToArg<A>::convert(left)), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<B>::convert(p_right).xform_inv(PtrToArg<A>::convert(p_left)), r_ret);
}
using ReturnType = R;
};
@@ -121,11 +121,11 @@ public:
template <typename R, typename A, typename B>
class OperatorEvaluatorDiv : public CommonEvaluate<OperatorEvaluatorDiv<R, A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(left) / VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) / VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<R>::encode(PtrToArg<A>::convert(left) / PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(p_left) / PtrToArg<B>::convert(p_right), r_ret);
}
using ReturnType = R;
};
@@ -144,11 +144,11 @@ public:
*r_ret = a / b;
r_valid = true;
}
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(left) / VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) / VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<R>::encode(PtrToArg<A>::convert(left) / PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(p_left) / PtrToArg<B>::convert(p_right), r_ret);
}
static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
};
@@ -167,12 +167,12 @@ public:
*r_ret = a / b;
r_valid = true;
}
- static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ static void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
VariantTypeChanger<Vector2i>::change(r_ret);
- VariantInternalAccessor<Vector2i>::get(r_ret) = VariantInternalAccessor<Vector2i>::get(left) / VariantInternalAccessor<Vector2i>::get(right);
+ VariantInternalAccessor<Vector2i>::get(r_ret) = VariantInternalAccessor<Vector2i>::get(p_left) / VariantInternalAccessor<Vector2i>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<Vector2i>::encode(PtrToArg<Vector2i>::convert(left) / PtrToArg<Vector2i>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<Vector2i>::encode(PtrToArg<Vector2i>::convert(p_left) / PtrToArg<Vector2i>::convert(p_right), r_ret);
}
static Variant::Type get_return_type() { return GetTypeInfo<Vector2i>::VARIANT_TYPE; }
};
@@ -191,12 +191,12 @@ public:
*r_ret = a / b;
r_valid = true;
}
- static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ static void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
VariantTypeChanger<Vector3i>::change(r_ret);
- VariantInternalAccessor<Vector3i>::get(r_ret) = VariantInternalAccessor<Vector3i>::get(left) / VariantInternalAccessor<Vector3i>::get(right);
+ VariantInternalAccessor<Vector3i>::get(r_ret) = VariantInternalAccessor<Vector3i>::get(p_left) / VariantInternalAccessor<Vector3i>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<Vector3i>::encode(PtrToArg<Vector3i>::convert(left) / PtrToArg<Vector3i>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<Vector3i>::encode(PtrToArg<Vector3i>::convert(p_left) / PtrToArg<Vector3i>::convert(p_right), r_ret);
}
static Variant::Type get_return_type() { return GetTypeInfo<Vector3i>::VARIANT_TYPE; }
};
@@ -215,12 +215,12 @@ public:
*r_ret = a / b;
r_valid = true;
}
- static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ static void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
VariantTypeChanger<Vector4i>::change(r_ret);
- VariantInternalAccessor<Vector4i>::get(r_ret) = VariantInternalAccessor<Vector4i>::get(left) / VariantInternalAccessor<Vector4i>::get(right);
+ VariantInternalAccessor<Vector4i>::get(r_ret) = VariantInternalAccessor<Vector4i>::get(p_left) / VariantInternalAccessor<Vector4i>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<Vector4i>::encode(PtrToArg<Vector4i>::convert(left) / PtrToArg<Vector4i>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<Vector4i>::encode(PtrToArg<Vector4i>::convert(p_left) / PtrToArg<Vector4i>::convert(p_right), r_ret);
}
static Variant::Type get_return_type() { return GetTypeInfo<Vector4i>::VARIANT_TYPE; }
};
@@ -228,11 +228,11 @@ public:
template <typename R, typename A, typename B>
class OperatorEvaluatorMod : public CommonEvaluate<OperatorEvaluatorMod<R, A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(left) % VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) % VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<R>::encode(PtrToArg<A>::convert(left) % PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(p_left) % PtrToArg<B>::convert(p_right), r_ret);
}
using ReturnType = R;
};
@@ -251,11 +251,11 @@ public:
*r_ret = a % b;
r_valid = true;
}
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(left) % VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) % VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<R>::encode(PtrToArg<A>::convert(left) % PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(p_left) % PtrToArg<B>::convert(p_right), r_ret);
}
static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
};
@@ -274,12 +274,12 @@ public:
*r_ret = a % b;
r_valid = true;
}
- static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ static void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
VariantTypeChanger<Vector2i>::change(r_ret);
- VariantInternalAccessor<Vector2i>::get(r_ret) = VariantInternalAccessor<Vector2i>::get(left) % VariantInternalAccessor<Vector2i>::get(right);
+ VariantInternalAccessor<Vector2i>::get(r_ret) = VariantInternalAccessor<Vector2i>::get(p_left) % VariantInternalAccessor<Vector2i>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<Vector2i>::encode(PtrToArg<Vector2i>::convert(left) % PtrToArg<Vector2i>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<Vector2i>::encode(PtrToArg<Vector2i>::convert(p_left) % PtrToArg<Vector2i>::convert(p_right), r_ret);
}
static Variant::Type get_return_type() { return GetTypeInfo<Vector2i>::VARIANT_TYPE; }
};
@@ -298,12 +298,12 @@ public:
*r_ret = a % b;
r_valid = true;
}
- static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ static void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
VariantTypeChanger<Vector3i>::change(r_ret);
- VariantInternalAccessor<Vector3i>::get(r_ret) = VariantInternalAccessor<Vector3i>::get(left) % VariantInternalAccessor<Vector3i>::get(right);
+ VariantInternalAccessor<Vector3i>::get(r_ret) = VariantInternalAccessor<Vector3i>::get(p_left) % VariantInternalAccessor<Vector3i>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<Vector3i>::encode(PtrToArg<Vector3i>::convert(left) % PtrToArg<Vector3i>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<Vector3i>::encode(PtrToArg<Vector3i>::convert(p_left) % PtrToArg<Vector3i>::convert(p_right), r_ret);
}
static Variant::Type get_return_type() { return GetTypeInfo<Vector3i>::VARIANT_TYPE; }
};
@@ -322,12 +322,12 @@ public:
*r_ret = a % b;
r_valid = true;
}
- static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ static void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
VariantTypeChanger<Vector4i>::change(r_ret);
- VariantInternalAccessor<Vector4i>::get(r_ret) = VariantInternalAccessor<Vector4i>::get(left) % VariantInternalAccessor<Vector4i>::get(right);
+ VariantInternalAccessor<Vector4i>::get(r_ret) = VariantInternalAccessor<Vector4i>::get(p_left) % VariantInternalAccessor<Vector4i>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<Vector4i>::encode(PtrToArg<Vector4i>::convert(left) % PtrToArg<Vector4i>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<Vector4i>::encode(PtrToArg<Vector4i>::convert(p_left) % PtrToArg<Vector4i>::convert(p_right), r_ret);
}
static Variant::Type get_return_type() { return GetTypeInfo<Vector4i>::VARIANT_TYPE; }
};
@@ -335,11 +335,11 @@ public:
template <typename R, typename A>
class OperatorEvaluatorNeg : public CommonEvaluate<OperatorEvaluatorNeg<R, A>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<R>::get(r_ret) = -VariantInternalAccessor<A>::get(left);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<R>::get(r_ret) = -VariantInternalAccessor<A>::get(p_left);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<R>::encode(-PtrToArg<A>::convert(left), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<R>::encode(-PtrToArg<A>::convert(p_left), r_ret);
}
using ReturnType = R;
};
@@ -347,11 +347,11 @@ public:
template <typename R, typename A>
class OperatorEvaluatorPos : public CommonEvaluate<OperatorEvaluatorPos<R, A>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(left);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(p_left);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<R>::encode(PtrToArg<A>::convert(left), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(p_left), r_ret);
}
using ReturnType = R;
};
@@ -373,11 +373,11 @@ public:
*r_ret = a << b;
r_valid = true;
}
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(left) << VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) << VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<R>::encode(PtrToArg<A>::convert(left) << PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(p_left) << PtrToArg<B>::convert(p_right), r_ret);
}
static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
};
@@ -399,11 +399,11 @@ public:
*r_ret = a >> b;
r_valid = true;
}
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(left) >> VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) >> VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<R>::encode(PtrToArg<A>::convert(left) >> PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(p_left) >> PtrToArg<B>::convert(p_right), r_ret);
}
static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; }
};
@@ -411,11 +411,11 @@ public:
template <typename R, typename A, typename B>
class OperatorEvaluatorBitOr : public CommonEvaluate<OperatorEvaluatorBitOr<R, A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(left) | VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) | VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<R>::encode(PtrToArg<A>::convert(left) | PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(p_left) | PtrToArg<B>::convert(p_right), r_ret);
}
using ReturnType = R;
};
@@ -423,11 +423,11 @@ public:
template <typename R, typename A, typename B>
class OperatorEvaluatorBitAnd : public CommonEvaluate<OperatorEvaluatorBitAnd<R, A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(left) & VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) & VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<R>::encode(PtrToArg<A>::convert(left) & PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(p_left) & PtrToArg<B>::convert(p_right), r_ret);
}
using ReturnType = R;
};
@@ -435,11 +435,11 @@ public:
template <typename R, typename A, typename B>
class OperatorEvaluatorBitXor : public CommonEvaluate<OperatorEvaluatorBitXor<R, A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(left) ^ VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<R>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) ^ VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<R>::encode(PtrToArg<A>::convert(left) ^ PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<R>::encode(PtrToArg<A>::convert(p_left) ^ PtrToArg<B>::convert(p_right), r_ret);
}
using ReturnType = R;
};
@@ -447,11 +447,11 @@ public:
template <typename R, typename A>
class OperatorEvaluatorBitNeg : public CommonEvaluate<OperatorEvaluatorBitNeg<R, A>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<R>::get(r_ret) = ~VariantInternalAccessor<A>::get(left);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<R>::get(r_ret) = ~VariantInternalAccessor<A>::get(p_left);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<R>::encode(~PtrToArg<A>::convert(left), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<R>::encode(~PtrToArg<A>::convert(p_left), r_ret);
}
using ReturnType = R;
};
@@ -459,48 +459,48 @@ public:
template <typename A, typename B>
class OperatorEvaluatorEqual : public CommonEvaluate<OperatorEvaluatorEqual<A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<bool>::get(r_ret) = VariantInternalAccessor<A>::get(left) == VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<bool>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) == VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<A>::convert(left) == PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<A>::convert(p_left) == PtrToArg<B>::convert(p_right), r_ret);
}
using ReturnType = bool;
};
class OperatorEvaluatorEqualObject : public CommonEvaluate<OperatorEvaluatorEqualObject> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- const Object *a = left->get_validated_object();
- const Object *b = right->get_validated_object();
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ const Object *a = p_left->get_validated_object();
+ const Object *b = p_right->get_validated_object();
VariantInternalAccessor<bool>::get(r_ret) = a == b;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<Object *>::convert(left) == PtrToArg<Object *>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Object *>::convert(p_left) == PtrToArg<Object *>::convert(p_right), r_ret);
}
using ReturnType = bool;
};
class OperatorEvaluatorEqualObjectNil : public CommonEvaluate<OperatorEvaluatorEqualObjectNil> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- const Object *a = left->get_validated_object();
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ const Object *a = p_left->get_validated_object();
VariantInternalAccessor<bool>::get(r_ret) = a == nullptr;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<Object *>::convert(left) == nullptr, r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Object *>::convert(p_left) == nullptr, r_ret);
}
using ReturnType = bool;
};
class OperatorEvaluatorEqualNilObject : public CommonEvaluate<OperatorEvaluatorEqualNilObject> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- const Object *b = right->get_validated_object();
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ const Object *b = p_right->get_validated_object();
VariantInternalAccessor<bool>::get(r_ret) = nullptr == b;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(nullptr == PtrToArg<Object *>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(nullptr == PtrToArg<Object *>::convert(p_right), r_ret);
}
using ReturnType = bool;
};
@@ -508,48 +508,48 @@ public:
template <typename A, typename B>
class OperatorEvaluatorNotEqual : public CommonEvaluate<OperatorEvaluatorNotEqual<A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<bool>::get(r_ret) = VariantInternalAccessor<A>::get(left) != VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<bool>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) != VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<A>::convert(left) != PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<A>::convert(p_left) != PtrToArg<B>::convert(p_right), r_ret);
}
using ReturnType = bool;
};
class OperatorEvaluatorNotEqualObject : public CommonEvaluate<OperatorEvaluatorNotEqualObject> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- Object *a = left->get_validated_object();
- Object *b = right->get_validated_object();
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ Object *a = p_left->get_validated_object();
+ Object *b = p_right->get_validated_object();
VariantInternalAccessor<bool>::get(r_ret) = a != b;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<Object *>::convert(left) != PtrToArg<Object *>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Object *>::convert(p_left) != PtrToArg<Object *>::convert(p_right), r_ret);
}
using ReturnType = bool;
};
class OperatorEvaluatorNotEqualObjectNil : public CommonEvaluate<OperatorEvaluatorNotEqualObjectNil> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- Object *a = left->get_validated_object();
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ Object *a = p_left->get_validated_object();
VariantInternalAccessor<bool>::get(r_ret) = a != nullptr;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<Object *>::convert(left) != nullptr, r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Object *>::convert(p_left) != nullptr, r_ret);
}
using ReturnType = bool;
};
class OperatorEvaluatorNotEqualNilObject : public CommonEvaluate<OperatorEvaluatorNotEqualNilObject> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- Object *b = right->get_validated_object();
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ Object *b = p_right->get_validated_object();
VariantInternalAccessor<bool>::get(r_ret) = nullptr != b;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(nullptr != PtrToArg<Object *>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(nullptr != PtrToArg<Object *>::convert(p_right), r_ret);
}
using ReturnType = bool;
};
@@ -557,11 +557,11 @@ public:
template <typename A, typename B>
class OperatorEvaluatorLess : public CommonEvaluate<OperatorEvaluatorLess<A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<bool>::get(r_ret) = VariantInternalAccessor<A>::get(left) < VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<bool>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) < VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<A>::convert(left) < PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<A>::convert(p_left) < PtrToArg<B>::convert(p_right), r_ret);
}
using ReturnType = bool;
};
@@ -569,11 +569,11 @@ public:
template <typename A, typename B>
class OperatorEvaluatorLessEqual : public CommonEvaluate<OperatorEvaluatorLessEqual<A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<bool>::get(r_ret) = VariantInternalAccessor<A>::get(left) <= VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<bool>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) <= VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<A>::convert(left) <= PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<A>::convert(p_left) <= PtrToArg<B>::convert(p_right), r_ret);
}
using ReturnType = bool;
};
@@ -581,11 +581,11 @@ public:
template <typename A, typename B>
class OperatorEvaluatorGreater : public CommonEvaluate<OperatorEvaluatorGreater<A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<bool>::get(r_ret) = VariantInternalAccessor<A>::get(left) > VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<bool>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) > VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<A>::convert(left) > PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<A>::convert(p_left) > PtrToArg<B>::convert(p_right), r_ret);
}
using ReturnType = bool;
};
@@ -593,11 +593,11 @@ public:
template <typename A, typename B>
class OperatorEvaluatorGreaterEqual : public CommonEvaluate<OperatorEvaluatorGreaterEqual<A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<bool>::get(r_ret) = VariantInternalAccessor<A>::get(left) >= VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<bool>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) >= VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<A>::convert(left) >= PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<A>::convert(p_left) >= PtrToArg<B>::convert(p_right), r_ret);
}
using ReturnType = bool;
};
@@ -605,11 +605,11 @@ public:
template <typename A, typename B>
class OperatorEvaluatorAnd : public CommonEvaluate<OperatorEvaluatorAnd<A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<bool>::get(r_ret) = VariantInternalAccessor<A>::get(left) && VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<bool>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) && VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<A>::convert(left) && PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<A>::convert(p_left) && PtrToArg<B>::convert(p_right), r_ret);
}
using ReturnType = bool;
};
@@ -617,11 +617,11 @@ public:
template <typename A, typename B>
class OperatorEvaluatorOr : public CommonEvaluate<OperatorEvaluatorOr<A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<bool>::get(r_ret) = VariantInternalAccessor<A>::get(left) || VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<bool>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) || VariantInternalAccessor<B>::get(p_right);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<A>::convert(left) || PtrToArg<B>::convert(right), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<A>::convert(p_left) || PtrToArg<B>::convert(p_right), r_ret);
}
using ReturnType = bool;
};
@@ -630,14 +630,14 @@ public:
template <typename A, typename B>
class OperatorEvaluatorXor : public CommonEvaluate<OperatorEvaluatorXor<A, B>> {
public:
- _FORCE_INLINE_ static bool xor_op(const A &a, const B &b) {
- return ((a) || (b)) && !((a) && (b));
+ _FORCE_INLINE_ static bool xor_op(const A &p_left, const B &p_right) {
+ return ((p_left) || (p_right)) && !((p_left) && (p_right));
}
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<bool>::get(r_ret) = xor_op(VariantInternalAccessor<A>::get(left), VariantInternalAccessor<B>::get(right));
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<bool>::get(r_ret) = xor_op(VariantInternalAccessor<A>::get(p_left), VariantInternalAccessor<B>::get(p_right));
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(xor_op(PtrToArg<A>::convert(left), PtrToArg<B>::convert(right)), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(xor_op(PtrToArg<A>::convert(p_left), PtrToArg<B>::convert(p_right)), r_ret);
}
using ReturnType = bool;
};
@@ -645,11 +645,11 @@ public:
template <typename A>
class OperatorEvaluatorNot : public CommonEvaluate<OperatorEvaluatorNot<A>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<bool>::get(r_ret) = VariantInternalAccessor<A>::get(left) == A();
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<bool>::get(r_ret) = VariantInternalAccessor<A>::get(p_left) == A();
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<A>::convert(left) == A(), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<A>::convert(p_left) == A(), r_ret);
}
using ReturnType = bool;
};
@@ -658,29 +658,29 @@ public:
class OperatorEvaluatorAddArray : public CommonEvaluate<OperatorEvaluatorAddArray> {
public:
- _FORCE_INLINE_ static void _add_arrays(Array &sum, const Array &array_a, const Array &array_b) {
- int asize = array_a.size();
- int bsize = array_b.size();
+ _FORCE_INLINE_ static void _add_arrays(Array &r_sum, const Array &p_array_left, const Array &p_array_right) {
+ int asize = p_array_left.size();
+ int bsize = p_array_right.size();
- if (array_a.is_typed() && array_a.is_same_typed(array_b)) {
- sum.set_typed(array_a.get_typed_builtin(), array_a.get_typed_class_name(), array_a.get_typed_script());
+ if (p_array_left.is_typed() && p_array_left.is_same_typed(p_array_right)) {
+ r_sum.set_typed(p_array_left.get_typed_builtin(), p_array_left.get_typed_class_name(), p_array_left.get_typed_script());
}
- sum.resize(asize + bsize);
+ r_sum.resize(asize + bsize);
for (int i = 0; i < asize; i++) {
- sum[i] = array_a[i];
+ r_sum[i] = p_array_left[i];
}
for (int i = 0; i < bsize; i++) {
- sum[i + asize] = array_b[i];
+ r_sum[i + asize] = p_array_right[i];
}
}
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
*r_ret = Array();
- _add_arrays(VariantInternalAccessor<Array>::get(r_ret), VariantInternalAccessor<Array>::get(left), VariantInternalAccessor<Array>::get(right));
+ _add_arrays(VariantInternalAccessor<Array>::get(r_ret), VariantInternalAccessor<Array>::get(p_left), VariantInternalAccessor<Array>::get(p_right));
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
Array ret;
- _add_arrays(ret, PtrToArg<Array>::convert(left), PtrToArg<Array>::convert(right));
+ _add_arrays(ret, PtrToArg<Array>::convert(p_left), PtrToArg<Array>::convert(p_right));
PtrToArg<Array>::encode(ret, r_ret);
}
using ReturnType = Array;
@@ -689,13 +689,13 @@ public:
template <typename T>
class OperatorEvaluatorAppendArray : public CommonEvaluate<OperatorEvaluatorAppendArray<T>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<Vector<T>>::get(r_ret) = VariantInternalAccessor<Vector<T>>::get(left);
- VariantInternalAccessor<Vector<T>>::get(r_ret).append_array(VariantInternalAccessor<Vector<T>>::get(right));
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<Vector<T>>::get(r_ret) = VariantInternalAccessor<Vector<T>>::get(p_left);
+ VariantInternalAccessor<Vector<T>>::get(r_ret).append_array(VariantInternalAccessor<Vector<T>>::get(p_right));
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- Vector<T> sum = PtrToArg<Vector<T>>::convert(left);
- sum.append_array(PtrToArg<Vector<T>>::convert(right));
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ Vector<T> sum = PtrToArg<Vector<T>>::convert(p_left);
+ sum.append_array(PtrToArg<Vector<T>>::convert(p_right));
PtrToArg<Vector<T>>::encode(sum, r_ret);
}
using ReturnType = Vector<T>;
@@ -704,14 +704,14 @@ public:
template <typename Left, typename Right>
class OperatorEvaluatorStringConcat : public CommonEvaluate<OperatorEvaluatorStringConcat<Left, Right>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- const String a(VariantInternalAccessor<Left>::get(left));
- const String b(VariantInternalAccessor<Right>::get(right));
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ const String a(VariantInternalAccessor<Left>::get(p_left));
+ const String b(VariantInternalAccessor<Right>::get(p_right));
VariantInternalAccessor<String>::get(r_ret) = a + b;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- const String a(PtrToArg<Left>::convert(left));
- const String b(PtrToArg<Right>::convert(right));
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ const String a(PtrToArg<Left>::convert(p_left));
+ const String b(PtrToArg<Right>::convert(p_right));
PtrToArg<String>::encode(a + b, r_ret);
}
using ReturnType = String;
@@ -723,9 +723,9 @@ class OperatorEvaluatorStringFormat;
template <typename S>
class OperatorEvaluatorStringFormat<S, void> {
public:
- _FORCE_INLINE_ static String do_mod(const String &s, bool *r_valid) {
+ _FORCE_INLINE_ static String do_mod(const String &p_string, bool *r_valid) {
Array values = { Variant() };
- String a = s.sprintf(values, r_valid);
+ String a = p_string.sprintf(values, r_valid);
if (r_valid) {
*r_valid = !*r_valid;
}
@@ -734,17 +734,17 @@ public:
static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
*r_ret = do_mod(VariantInternalAccessor<S>::get(&p_left), &r_valid);
}
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
bool valid = true;
- String result = do_mod(VariantInternalAccessor<S>::get(left), &valid);
+ String result = do_mod(VariantInternalAccessor<S>::get(p_left), &valid);
if (unlikely(!valid)) {
- VariantInternalAccessor<String>::get(r_ret) = VariantInternalAccessor<S>::get(left);
+ VariantInternalAccessor<String>::get(r_ret) = VariantInternalAccessor<S>::get(p_left);
ERR_FAIL_MSG(vformat("String formatting error: %s.", result));
}
VariantInternalAccessor<String>::get(r_ret) = result;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<String>::encode(do_mod(PtrToArg<S>::convert(left), nullptr), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<String>::encode(do_mod(PtrToArg<S>::convert(p_left), nullptr), r_ret);
}
static Variant::Type get_return_type() { return Variant::STRING; }
};
@@ -752,8 +752,8 @@ public:
template <typename S>
class OperatorEvaluatorStringFormat<S, Array> {
public:
- _FORCE_INLINE_ static String do_mod(const String &s, const Array &p_values, bool *r_valid) {
- String a = s.sprintf(p_values, r_valid);
+ _FORCE_INLINE_ static String do_mod(const String &p_string, const Array &p_values, bool *r_valid) {
+ String a = p_string.sprintf(p_values, r_valid);
if (r_valid) {
*r_valid = !*r_valid;
}
@@ -762,17 +762,17 @@ public:
static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
*r_ret = do_mod(VariantInternalAccessor<S>::get(&p_left), VariantInternalAccessor<Array>::get(&p_right), &r_valid);
}
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
bool valid = true;
- String result = do_mod(VariantInternalAccessor<S>::get(left), VariantInternalAccessor<Array>::get(right), &valid);
+ String result = do_mod(VariantInternalAccessor<S>::get(p_left), VariantInternalAccessor<Array>::get(p_right), &valid);
if (unlikely(!valid)) {
- VariantInternalAccessor<String>::get(r_ret) = VariantInternalAccessor<S>::get(left);
+ VariantInternalAccessor<String>::get(r_ret) = VariantInternalAccessor<S>::get(p_left);
ERR_FAIL_MSG(vformat("String formatting error: %s.", result));
}
VariantInternalAccessor<String>::get(r_ret) = result;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<String>::encode(do_mod(PtrToArg<S>::convert(left), PtrToArg<Array>::convert(right), nullptr), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<String>::encode(do_mod(PtrToArg<S>::convert(p_left), PtrToArg<Array>::convert(p_right), nullptr), r_ret);
}
static Variant::Type get_return_type() { return Variant::STRING; }
};
@@ -780,9 +780,9 @@ public:
template <typename S>
class OperatorEvaluatorStringFormat<S, Object> {
public:
- _FORCE_INLINE_ static String do_mod(const String &s, const Object *p_object, bool *r_valid) {
+ _FORCE_INLINE_ static String do_mod(const String &p_string, const Object *p_object, bool *r_valid) {
Array values = { p_object };
- String a = s.sprintf(values, r_valid);
+ String a = p_string.sprintf(values, r_valid);
if (r_valid) {
*r_valid = !*r_valid;
}
@@ -792,17 +792,17 @@ public:
static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
*r_ret = do_mod(VariantInternalAccessor<S>::get(&p_left), p_right.get_validated_object(), &r_valid);
}
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
bool valid = true;
- String result = do_mod(VariantInternalAccessor<S>::get(left), right->get_validated_object(), &valid);
+ String result = do_mod(VariantInternalAccessor<S>::get(p_left), p_right->get_validated_object(), &valid);
if (unlikely(!valid)) {
- VariantInternalAccessor<String>::get(r_ret) = VariantInternalAccessor<S>::get(left);
+ VariantInternalAccessor<String>::get(r_ret) = VariantInternalAccessor<S>::get(p_left);
ERR_FAIL_MSG(vformat("String formatting error: %s.", result));
}
VariantInternalAccessor<String>::get(r_ret) = result;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<String>::encode(do_mod(PtrToArg<S>::convert(left), PtrToArg<Object *>::convert(right), nullptr), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<String>::encode(do_mod(PtrToArg<S>::convert(p_left), PtrToArg<Object *>::convert(p_right), nullptr), r_ret);
}
static Variant::Type get_return_type() { return Variant::STRING; }
};
@@ -810,9 +810,9 @@ public:
template <typename S, typename T>
class OperatorEvaluatorStringFormat {
public:
- _FORCE_INLINE_ static String do_mod(const String &s, const T &p_value, bool *r_valid) {
+ _FORCE_INLINE_ static String do_mod(const String &p_string, const T &p_value, bool *r_valid) {
Array values = { p_value };
- String a = s.sprintf(values, r_valid);
+ String a = p_string.sprintf(values, r_valid);
if (r_valid) {
*r_valid = !*r_valid;
}
@@ -821,27 +821,27 @@ public:
static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) {
*r_ret = do_mod(VariantInternalAccessor<S>::get(&p_left), VariantInternalAccessor<T>::get(&p_right), &r_valid);
}
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
bool valid = true;
- String result = do_mod(VariantInternalAccessor<S>::get(left), VariantInternalAccessor<T>::get(right), &valid);
+ String result = do_mod(VariantInternalAccessor<S>::get(p_left), VariantInternalAccessor<T>::get(p_right), &valid);
if (unlikely(!valid)) {
- VariantInternalAccessor<String>::get(r_ret) = VariantInternalAccessor<S>::get(left);
+ VariantInternalAccessor<String>::get(r_ret) = VariantInternalAccessor<S>::get(p_left);
ERR_FAIL_MSG(vformat("String formatting error: %s.", result));
}
VariantInternalAccessor<String>::get(r_ret) = result;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<String>::encode(do_mod(PtrToArg<S>::convert(left), PtrToArg<T>::convert(right), nullptr), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<String>::encode(do_mod(PtrToArg<S>::convert(p_left), PtrToArg<T>::convert(p_right), nullptr), r_ret);
}
static Variant::Type get_return_type() { return Variant::STRING; }
};
class OperatorEvaluatorAlwaysTrue : public CommonEvaluate<OperatorEvaluatorAlwaysTrue> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
VariantInternalAccessor<bool>::get(r_ret) = true;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
PtrToArg<bool>::encode(true, r_ret);
}
using ReturnType = bool;
@@ -849,10 +849,10 @@ public:
class OperatorEvaluatorAlwaysFalse : public CommonEvaluate<OperatorEvaluatorAlwaysFalse> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
VariantInternalAccessor<bool>::get(r_ret) = false;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
PtrToArg<bool>::encode(false, r_ret);
}
using ReturnType = bool;
@@ -915,12 +915,12 @@ _FORCE_INLINE_ static bool _operate_get_ptr_object(const void *p_ptr) {
#define OP_EVALUATOR(m_class_name, m_left, m_right, m_op) \
class m_class_name : public CommonEvaluate<m_class_name> { \
public: \
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { \
- VariantInternalAccessor<bool>::get(r_ret) = m_op(_operate_get_##m_left(left), _operate_get_##m_right(right)); \
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) { \
+ VariantInternalAccessor<bool>::get(r_ret) = m_op(_operate_get_##m_left(p_left), _operate_get_##m_right(p_right)); \
} \
\
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) { \
- PtrToArg<bool>::encode(m_op(_operate_get_ptr_##m_left(left), _operate_get_ptr_##m_right(right)), r_ret); \
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) { \
+ PtrToArg<bool>::encode(m_op(_operate_get_ptr_##m_left(p_left), _operate_get_ptr_##m_right(p_right)), r_ret); \
} \
\
using ReturnType = bool; \
@@ -1063,44 +1063,44 @@ OP_EVALUATOR(OperatorEvaluatorObjectXObjectXor, object, object, _operate_xor)
class OperatorEvaluatorNotBool : public CommonEvaluate<OperatorEvaluatorNotBool> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<bool>::get(r_ret) = !VariantInternalAccessor<bool>::get(left);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<bool>::get(r_ret) = !VariantInternalAccessor<bool>::get(p_left);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(!PtrToArg<bool>::convert(left), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(!PtrToArg<bool>::convert(p_left), r_ret);
}
using ReturnType = bool;
};
class OperatorEvaluatorNotInt : public CommonEvaluate<OperatorEvaluatorNotInt> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<bool>::get(r_ret) = !VariantInternalAccessor<int64_t>::get(left);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<bool>::get(r_ret) = !VariantInternalAccessor<int64_t>::get(p_left);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(!PtrToArg<int64_t>::convert(left), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(!PtrToArg<int64_t>::convert(p_left), r_ret);
}
using ReturnType = bool;
};
class OperatorEvaluatorNotFloat : public CommonEvaluate<OperatorEvaluatorNotFloat> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<bool>::get(r_ret) = !VariantInternalAccessor<double>::get(left);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<bool>::get(r_ret) = !VariantInternalAccessor<double>::get(p_left);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(!PtrToArg<double>::convert(left), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(!PtrToArg<double>::convert(p_left), r_ret);
}
using ReturnType = bool;
};
class OperatorEvaluatorNotObject : public CommonEvaluate<OperatorEvaluatorNotObject> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- VariantInternalAccessor<bool>::get(r_ret) = left->get_validated_object() == nullptr;
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ VariantInternalAccessor<bool>::get(r_ret) = p_left->get_validated_object() == nullptr;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<Object *>::convert(left) == nullptr, r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Object *>::convert(p_left) == nullptr, r_ret);
}
using ReturnType = bool;
};
@@ -1113,13 +1113,13 @@ class OperatorEvaluatorInStringFind;
template <typename Left>
class OperatorEvaluatorInStringFind<Left, String> : public CommonEvaluate<OperatorEvaluatorInStringFind<Left, String>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- const Left &str_a = VariantInternalAccessor<Left>::get(left);
- const String &str_b = VariantInternalAccessor<String>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ const Left &str_a = VariantInternalAccessor<Left>::get(p_left);
+ const String &str_b = VariantInternalAccessor<String>::get(p_right);
VariantInternalAccessor<bool>::get(r_ret) = str_b.find(str_a) != -1;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<String>::convert(right).find(PtrToArg<Left>::convert(left)) != -1, r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<String>::convert(p_right).find(PtrToArg<Left>::convert(p_left)) != -1, r_ret);
}
using ReturnType = bool;
};
@@ -1127,13 +1127,13 @@ public:
template <typename Left>
class OperatorEvaluatorInStringFind<Left, StringName> : public CommonEvaluate<OperatorEvaluatorInStringFind<Left, StringName>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- const Left &str_a = VariantInternalAccessor<Left>::get(left);
- const String str_b = VariantInternalAccessor<StringName>::get(right).string();
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ const Left &str_a = VariantInternalAccessor<Left>::get(p_left);
+ const String str_b = VariantInternalAccessor<StringName>::get(p_right).string();
VariantInternalAccessor<bool>::get(r_ret) = str_b.find(str_a) != -1;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<StringName>::convert(right).string().find(PtrToArg<Left>::convert(left)) != -1, r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<StringName>::convert(p_right).string().find(PtrToArg<Left>::convert(p_left)) != -1, r_ret);
}
using ReturnType = bool;
};
@@ -1141,37 +1141,37 @@ public:
template <typename A, typename B>
class OperatorEvaluatorInArrayFind : public CommonEvaluate<OperatorEvaluatorInArrayFind<A, B>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- const A &a = VariantInternalAccessor<A>::get(left);
- const B &b = VariantInternalAccessor<B>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ const A &a = VariantInternalAccessor<A>::get(p_left);
+ const B &b = VariantInternalAccessor<B>::get(p_right);
VariantInternalAccessor<bool>::get(r_ret) = b.find(a) != -1;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<B>::convert(right).find(PtrToArg<A>::convert(left)) != -1, r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<B>::convert(p_right).find(PtrToArg<A>::convert(p_left)) != -1, r_ret);
}
using ReturnType = bool;
};
class OperatorEvaluatorInArrayFindNil : public CommonEvaluate<OperatorEvaluatorInArrayFindNil> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- const Array &b = VariantInternalAccessor<Array>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ const Array &b = VariantInternalAccessor<Array>::get(p_right);
VariantInternalAccessor<bool>::get(r_ret) = b.find(Variant()) != -1;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<Array>::convert(right).find(Variant()) != -1, r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Array>::convert(p_right).find(Variant()) != -1, r_ret);
}
using ReturnType = bool;
};
class OperatorEvaluatorInArrayFindObject : public CommonEvaluate<OperatorEvaluatorInArrayFindObject> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- const Array &b = VariantInternalAccessor<Array>::get(right);
- VariantInternalAccessor<bool>::get(r_ret) = b.find(*left) != -1;
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ const Array &b = VariantInternalAccessor<Array>::get(p_right);
+ VariantInternalAccessor<bool>::get(r_ret) = b.find(*p_left) != -1;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<Array>::convert(right).find(PtrToArg<Object *>::convert(left)) != -1, r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Array>::convert(p_right).find(PtrToArg<Object *>::convert(p_left)) != -1, r_ret);
}
using ReturnType = bool;
};
@@ -1179,37 +1179,37 @@ public:
template <typename A>
class OperatorEvaluatorInDictionaryHas : public CommonEvaluate<OperatorEvaluatorInDictionaryHas<A>> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- const Dictionary &b = VariantInternalAccessor<Dictionary>::get(right);
- const A &a = VariantInternalAccessor<A>::get(left);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ const Dictionary &b = VariantInternalAccessor<Dictionary>::get(p_right);
+ const A &a = VariantInternalAccessor<A>::get(p_left);
VariantInternalAccessor<bool>::get(r_ret) = b.has(a);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<Dictionary>::convert(right).has(PtrToArg<A>::convert(left)), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Dictionary>::convert(p_right).has(PtrToArg<A>::convert(p_left)), r_ret);
}
using ReturnType = bool;
};
class OperatorEvaluatorInDictionaryHasNil : public CommonEvaluate<OperatorEvaluatorInDictionaryHasNil> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- const Dictionary &b = VariantInternalAccessor<Dictionary>::get(right);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ const Dictionary &b = VariantInternalAccessor<Dictionary>::get(p_right);
VariantInternalAccessor<bool>::get(r_ret) = b.has(Variant());
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<Dictionary>::convert(right).has(Variant()), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Dictionary>::convert(p_right).has(Variant()), r_ret);
}
using ReturnType = bool;
};
class OperatorEvaluatorInDictionaryHasObject : public CommonEvaluate<OperatorEvaluatorInDictionaryHasObject> {
public:
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- const Dictionary &b = VariantInternalAccessor<Dictionary>::get(right);
- VariantInternalAccessor<bool>::get(r_ret) = b.has(*left);
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ const Dictionary &b = VariantInternalAccessor<Dictionary>::get(p_right);
+ VariantInternalAccessor<bool>::get(r_ret) = b.has(*p_left);
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
- PtrToArg<bool>::encode(PtrToArg<Dictionary>::convert(right).has(PtrToArg<Object *>::convert(left)), r_ret);
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
+ PtrToArg<bool>::encode(PtrToArg<Dictionary>::convert(p_right).has(PtrToArg<Object *>::convert(p_left)), r_ret);
}
using ReturnType = bool;
};
@@ -1231,21 +1231,21 @@ public:
*r_ret = exist;
r_valid = true;
}
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- Object *l = right->get_validated_object();
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ Object *l = p_right->get_validated_object();
if (unlikely(!l)) {
VariantInternalAccessor<bool>::get(r_ret) = false;
ERR_FAIL_MSG("Invalid base object for 'in'.");
}
- const String &a = VariantInternalAccessor<String>::get(left);
+ const String &a = VariantInternalAccessor<String>::get(p_left);
bool valid;
l->get(a, &valid);
VariantInternalAccessor<bool>::get(r_ret) = valid;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
bool valid;
- PtrToArg<Object *>::convert(right)->get(PtrToArg<String>::convert(left), &valid);
+ PtrToArg<Object *>::convert(p_right)->get(PtrToArg<String>::convert(p_left), &valid);
PtrToArg<bool>::encode(valid, r_ret);
}
static Variant::Type get_return_type() { return Variant::BOOL; }
@@ -1268,21 +1268,21 @@ public:
*r_ret = exist;
r_valid = true;
}
- static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) {
- Object *l = right->get_validated_object();
+ static inline void validated_evaluate(const Variant *p_left, const Variant *p_right, Variant *r_ret) {
+ Object *l = p_right->get_validated_object();
if (unlikely(!l)) {
VariantInternalAccessor<bool>::get(r_ret) = false;
ERR_FAIL_MSG("Invalid base object for 'in'.");
}
- const StringName &a = VariantInternalAccessor<StringName>::get(left);
+ const StringName &a = VariantInternalAccessor<StringName>::get(p_left);
bool valid;
l->get(a, &valid);
VariantInternalAccessor<bool>::get(r_ret) = valid;
}
- static void ptr_evaluate(const void *left, const void *right, void *r_ret) {
+ static void ptr_evaluate(const void *p_left, const void *p_right, void *r_ret) {
bool valid;
- PtrToArg<Object *>::convert(right)->get(PtrToArg<StringName>::convert(left), &valid);
+ PtrToArg<Object *>::convert(p_right)->get(PtrToArg<StringName>::convert(p_left), &valid);
PtrToArg<bool>::encode(valid, r_ret);
}
static Variant::Type get_return_type() { return Variant::BOOL; }
diff --git a/core/variant/variant_parser.cpp b/core/variant/variant_parser.cpp
index 6da3703260f..cc222638335 100644
--- a/core/variant/variant_parser.cpp
+++ b/core/variant/variant_parser.cpp
@@ -159,7 +159,7 @@ static double stor_fix(const String &p_str) {
return -1;
}
-Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, String &r_err_str) {
+Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &r_line, String &r_err_str) {
bool string_name = false;
while (true) {
@@ -177,7 +177,7 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri
switch (cchar) {
case '\n': {
- line++;
+ r_line++;
break;
}
case 0: {
@@ -220,7 +220,7 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri
return OK;
}
if (ch == '\n') {
- line++;
+ r_line++;
break;
}
}
@@ -386,7 +386,7 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri
return ERR_PARSE_ERROR;
}
if (ch == '\n') {
- line++;
+ r_line++;
}
str += ch;
}
@@ -519,9 +519,9 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri
return ERR_PARSE_ERROR;
}
-Error VariantParser::_parse_enginecfg(Stream *p_stream, Vector<String> &strings, int &line, String &r_err_str) {
+Error VariantParser::_parse_enginecfg(Stream *p_stream, Vector<String> &r_strings, int &r_line, String &r_err_str) {
Token token;
- get_token(p_stream, token, line, r_err_str);
+ get_token(p_stream, token, r_line, r_err_str);
if (token.type != TK_PARENTHESIS_OPEN) {
r_err_str = "Expected '(' in old-style project.godot construct";
return ERR_PARSE_ERROR;
@@ -538,21 +538,21 @@ Error VariantParser::_parse_enginecfg(Stream *p_stream, Vector<String> &strings,
}
if (c == ',') {
- strings.push_back(accum.strip_edges());
+ r_strings.push_back(accum.strip_edges());
accum = String();
} else if (c == ')') {
- strings.push_back(accum.strip_edges());
+ r_strings.push_back(accum.strip_edges());
return OK;
} else if (c == '\n') {
- line++;
+ r_line++;
}
}
}
template <typename T>
-Error VariantParser::_parse_construct(Stream *p_stream, Vector<T> &r_construct, int &line, String &r_err_str) {
+Error VariantParser::_parse_construct(Stream *p_stream, Vector<T> &r_construct, int &r_line, String &r_err_str) {
Token token;
- get_token(p_stream, token, line, r_err_str);
+ get_token(p_stream, token, r_line, r_err_str);
if (token.type != TK_PARENTHESIS_OPEN) {
r_err_str = "Expected '(' in constructor";
return ERR_PARSE_ERROR;
@@ -561,7 +561,7 @@ Error VariantParser::_parse_construct(Stream *p_stream, Vector<T> &r_construct,
bool first = true;
while (true) {
if (!first) {
- get_token(p_stream, token, line, r_err_str);
+ get_token(p_stream, token, r_line, r_err_str);
if (token.type == TK_COMMA) {
//do none
} else if (token.type == TK_PARENTHESIS_CLOSE) {
@@ -571,7 +571,7 @@ Error VariantParser::_parse_construct(Stream *p_stream, Vector<T> &r_construct,
return ERR_PARSE_ERROR;
}
}
- get_token(p_stream, token, line, r_err_str);
+ get_token(p_stream, token, r_line, r_err_str);
if (first && token.type == TK_PARENTHESIS_CLOSE) {
break;
@@ -598,15 +598,15 @@ Error VariantParser::_parse_construct(Stream *p_stream, Vector<T> &r_construct,
return OK;
}
-Error VariantParser::_parse_byte_array(Stream *p_stream, Vector<uint8_t> &r_construct, int &line, String &r_err_str) {
+Error VariantParser::_parse_byte_array(Stream *p_stream, Vector<uint8_t> &r_construct, int &r_line, String &r_err_str) {
Token token;
- get_token(p_stream, token, line, r_err_str);
+ get_token(p_stream, token, r_line, r_err_str);
if (token.type != TK_PARENTHESIS_OPEN) {
r_err_str = "Expected '(' in constructor";
return ERR_PARSE_ERROR;
}
- get_token(p_stream, token, line, r_err_str);
+ get_token(p_stream, token, r_line, r_err_str);
if (token.type == TK_STRING) {
// Base64 encoded array.
String base64_encoded_string = token.value;
@@ -623,7 +623,7 @@ Error VariantParser::_parse_byte_array(Stream *p_stream, Vector<uint8_t> &r_cons
}
r_construct.resize(arr_len);
- get_token(p_stream, token, line, r_err_str);
+ get_token(p_stream, token, r_line, r_err_str);
if (token.type != TK_PARENTHESIS_CLOSE) {
r_err_str = "Expected ')' in constructor";
return ERR_PARSE_ERROR;
@@ -650,7 +650,7 @@ Error VariantParser::_parse_byte_array(Stream *p_stream, Vector<uint8_t> &r_cons
r_construct.push_back(token.value);
- get_token(p_stream, token, line, r_err_str);
+ get_token(p_stream, token, r_line, r_err_str);
if (token.type == TK_COMMA) {
//do none
@@ -661,7 +661,7 @@ Error VariantParser::_parse_byte_array(Stream *p_stream, Vector<uint8_t> &r_cons
return ERR_PARSE_ERROR;
}
- get_token(p_stream, token, line, r_err_str);
+ get_token(p_stream, token, r_line, r_err_str);
}
} else if (token.type == TK_PARENTHESIS_CLOSE) {
// Empty array.
@@ -674,41 +674,41 @@ Error VariantParser::_parse_byte_array(Stream *p_stream, Vector<uint8_t> &r_cons
return OK;
}
-Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, int &line, String &r_err_str, ResourceParser *p_res_parser) {
- if (token.type == TK_CURLY_BRACKET_OPEN) {
+Error VariantParser::parse_value(Token &r_token, Variant &r_value, Stream *p_stream, int &r_line, String &r_err_str, ResourceParser *p_res_parser) {
+ if (r_token.type == TK_CURLY_BRACKET_OPEN) {
Dictionary d;
- Error err = _parse_dictionary(d, p_stream, line, r_err_str, p_res_parser);
+ Error err = _parse_dictionary(d, p_stream, r_line, r_err_str, p_res_parser);
if (err) {
return err;
}
- value = d;
+ r_value = d;
return OK;
- } else if (token.type == TK_BRACKET_OPEN) {
+ } else if (r_token.type == TK_BRACKET_OPEN) {
Array a;
- Error err = _parse_array(a, p_stream, line, r_err_str, p_res_parser);
+ Error err = _parse_array(a, p_stream, r_line, r_err_str, p_res_parser);
if (err) {
return err;
}
- value = a;
+ r_value = a;
return OK;
- } else if (token.type == TK_IDENTIFIER) {
- String id = token.value;
+ } else if (r_token.type == TK_IDENTIFIER) {
+ String id = r_token.value;
if (id == "true") {
- value = true;
+ r_value = true;
} else if (id == "false") {
- value = false;
+ r_value = false;
} else if (id == "null" || id == "nil") {
- value = Variant();
+ r_value = Variant();
} else if (id == "inf") {
- value = Math::INF;
+ r_value = Math::INF;
} else if (id == "-inf" || id == "inf_neg") {
// inf_neg kept for compatibility.
- value = -Math::INF;
+ r_value = -Math::INF;
} else if (id == "nan") {
- value = Math::NaN;
+ r_value = Math::NaN;
} else if (id == "Vector2") {
Vector<real_t> args;
- Error err = _parse_construct<real_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<real_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -718,10 +718,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- value = Vector2(args[0], args[1]);
+ r_value = Vector2(args[0], args[1]);
} else if (id == "Vector2i") {
Vector<int32_t> args;
- Error err = _parse_construct<int32_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<int32_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -731,10 +731,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- value = Vector2i(args[0], args[1]);
+ r_value = Vector2i(args[0], args[1]);
} else if (id == "Rect2") {
Vector<real_t> args;
- Error err = _parse_construct<real_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<real_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -744,10 +744,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- value = Rect2(args[0], args[1], args[2], args[3]);
+ r_value = Rect2(args[0], args[1], args[2], args[3]);
} else if (id == "Rect2i") {
Vector<int32_t> args;
- Error err = _parse_construct<int32_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<int32_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -757,10 +757,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- value = Rect2i(args[0], args[1], args[2], args[3]);
+ r_value = Rect2i(args[0], args[1], args[2], args[3]);
} else if (id == "Vector3") {
Vector<real_t> args;
- Error err = _parse_construct<real_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<real_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -770,10 +770,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- value = Vector3(args[0], args[1], args[2]);
+ r_value = Vector3(args[0], args[1], args[2]);
} else if (id == "Vector3i") {
Vector<int32_t> args;
- Error err = _parse_construct<int32_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<int32_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -783,10 +783,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- value = Vector3i(args[0], args[1], args[2]);
+ r_value = Vector3i(args[0], args[1], args[2]);
} else if (id == "Vector4") {
Vector<real_t> args;
- Error err = _parse_construct<real_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<real_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -796,10 +796,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- value = Vector4(args[0], args[1], args[2], args[3]);
+ r_value = Vector4(args[0], args[1], args[2], args[3]);
} else if (id == "Vector4i") {
Vector<int32_t> args;
- Error err = _parse_construct<int32_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<int32_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -809,10 +809,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- value = Vector4i(args[0], args[1], args[2], args[3]);
+ r_value = Vector4i(args[0], args[1], args[2], args[3]);
} else if (id == "Transform2D" || id == "Matrix32") { //compatibility
Vector<real_t> args;
- Error err = _parse_construct<real_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<real_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -826,10 +826,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
m[0] = Vector2(args[0], args[1]);
m[1] = Vector2(args[2], args[3]);
m[2] = Vector2(args[4], args[5]);
- value = m;
+ r_value = m;
} else if (id == "Plane") {
Vector<real_t> args;
- Error err = _parse_construct<real_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<real_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -839,10 +839,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- value = Plane(args[0], args[1], args[2], args[3]);
+ r_value = Plane(args[0], args[1], args[2], args[3]);
} else if (id == "Quaternion" || id == "Quat") { // "Quat" kept for compatibility
Vector<real_t> args;
- Error err = _parse_construct<real_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<real_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -852,10 +852,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- value = Quaternion(args[0], args[1], args[2], args[3]);
+ r_value = Quaternion(args[0], args[1], args[2], args[3]);
} else if (id == "AABB" || id == "Rect3") {
Vector<real_t> args;
- Error err = _parse_construct<real_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<real_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -865,10 +865,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- value = AABB(Vector3(args[0], args[1], args[2]), Vector3(args[3], args[4], args[5]));
+ r_value = AABB(Vector3(args[0], args[1], args[2]), Vector3(args[3], args[4], args[5]));
} else if (id == "Basis" || id == "Matrix3") { //compatibility
Vector<real_t> args;
- Error err = _parse_construct<real_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<real_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -878,10 +878,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- value = Basis(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);
+ r_value = Basis(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);
} else if (id == "Transform3D" || id == "Transform") { // "Transform" kept for compatibility with Godot <4.
Vector<real_t> args;
- Error err = _parse_construct<real_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<real_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -891,10 +891,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- value = Transform3D(Basis(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]), Vector3(args[9], args[10], args[11]));
+ r_value = Transform3D(Basis(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]), Vector3(args[9], args[10], args[11]));
} else if (id == "Projection") { // "Transform" kept for compatibility with Godot <4.
Vector<real_t> args;
- Error err = _parse_construct<real_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<real_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -904,10 +904,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- value = Projection(Vector4(args[0], args[1], args[2], args[3]), Vector4(args[4], args[5], args[6], args[7]), Vector4(args[8], args[9], args[10], args[11]), Vector4(args[12], args[13], args[14], args[15]));
+ r_value = Projection(Vector4(args[0], args[1], args[2], args[3]), Vector4(args[4], args[5], args[6], args[7]), Vector4(args[8], args[9], args[10], args[11]), Vector4(args[12], args[13], args[14], args[15]));
} else if (id == "Color") {
Vector<float> args;
- Error err = _parse_construct<float>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<float>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -917,96 +917,96 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- value = Color(args[0], args[1], args[2], args[3]);
+ r_value = Color(args[0], args[1], args[2], args[3]);
} else if (id == "NodePath") {
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_PARENTHESIS_OPEN) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_PARENTHESIS_OPEN) {
r_err_str = "Expected '('";
return ERR_PARSE_ERROR;
}
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_STRING) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_STRING) {
r_err_str = "Expected string as argument for NodePath()";
return ERR_PARSE_ERROR;
}
- value = NodePath(String(token.value));
+ r_value = NodePath(String(r_token.value));
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_PARENTHESIS_CLOSE) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_PARENTHESIS_CLOSE) {
r_err_str = "Expected ')'";
return ERR_PARSE_ERROR;
}
} else if (id == "RID") {
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_PARENTHESIS_OPEN) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_PARENTHESIS_OPEN) {
r_err_str = "Expected '('";
return ERR_PARSE_ERROR;
}
- get_token(p_stream, token, line, r_err_str);
+ get_token(p_stream, r_token, r_line, r_err_str);
// Permit empty RID.
- if (token.type == TK_PARENTHESIS_CLOSE) {
- value = RID();
+ if (r_token.type == TK_PARENTHESIS_CLOSE) {
+ r_value = RID();
return OK;
- } else if (token.type != TK_NUMBER) {
+ } else if (r_token.type != TK_NUMBER) {
r_err_str = "Expected number as argument or ')'";
return ERR_PARSE_ERROR;
}
- value = RID::from_uint64(token.value);
+ r_value = RID::from_uint64(r_token.value);
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_PARENTHESIS_CLOSE) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_PARENTHESIS_CLOSE) {
r_err_str = "Expected ')'";
return ERR_PARSE_ERROR;
}
} else if (id == "Signal") {
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_PARENTHESIS_OPEN) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_PARENTHESIS_OPEN) {
r_err_str = "Expected '('";
return ERR_PARSE_ERROR;
}
// Load as empty.
- value = Signal();
+ r_value = Signal();
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_PARENTHESIS_CLOSE) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_PARENTHESIS_CLOSE) {
r_err_str = "Expected ')'";
return ERR_PARSE_ERROR;
}
} else if (id == "Callable") {
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_PARENTHESIS_OPEN) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_PARENTHESIS_OPEN) {
r_err_str = "Expected '('";
return ERR_PARSE_ERROR;
}
// Load as empty.
- value = Callable();
+ r_value = Callable();
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_PARENTHESIS_CLOSE) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_PARENTHESIS_CLOSE) {
r_err_str = "Expected ')'";
return ERR_PARSE_ERROR;
}
} else if (id == "Object") {
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_PARENTHESIS_OPEN) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_PARENTHESIS_OPEN) {
r_err_str = "Expected '('";
return ERR_PARSE_ERROR;
}
- get_token(p_stream, token, line, r_err_str);
+ get_token(p_stream, r_token, r_line, r_err_str);
- if (token.type != TK_IDENTIFIER) {
+ if (r_token.type != TK_IDENTIFIER) {
r_err_str = "Expected identifier with type of object";
return ERR_PARSE_ERROR;
}
- String type = token.value;
+ String type = r_token.value;
Object *obj = ClassDB::instantiate(type);
@@ -1017,8 +1017,8 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
Ref<RefCounted> ref = Ref<RefCounted>(Object::cast_to<RefCounted>(obj));
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_COMMA) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_COMMA) {
r_err_str = "Expected ',' after object type";
return ERR_PARSE_ERROR;
}
@@ -1034,18 +1034,18 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
if (at_key) {
- Error err = get_token(p_stream, token, line, r_err_str);
+ Error err = get_token(p_stream, r_token, r_line, r_err_str);
if (err != OK) {
return err;
}
- if (token.type == TK_PARENTHESIS_CLOSE) {
- value = ref.is_valid() ? Variant(ref) : Variant(obj);
+ if (r_token.type == TK_PARENTHESIS_CLOSE) {
+ r_value = ref.is_valid() ? Variant(ref) : Variant(obj);
return OK;
}
if (need_comma) {
- if (token.type != TK_COMMA) {
+ if (r_token.type != TK_COMMA) {
r_err_str = "Expected '}' or ','";
return ERR_PARSE_ERROR;
} else {
@@ -1054,31 +1054,31 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
}
- if (token.type != TK_STRING) {
+ if (r_token.type != TK_STRING) {
r_err_str = "Expected property name as string";
return ERR_PARSE_ERROR;
}
- key = token.value;
+ key = r_token.value;
- err = get_token(p_stream, token, line, r_err_str);
+ err = get_token(p_stream, r_token, r_line, r_err_str);
if (err != OK) {
return err;
}
- if (token.type != TK_COLON) {
+ if (r_token.type != TK_COLON) {
r_err_str = "Expected ':'";
return ERR_PARSE_ERROR;
}
at_key = false;
} else {
- Error err = get_token(p_stream, token, line, r_err_str);
+ Error err = get_token(p_stream, r_token, r_line, r_err_str);
if (err != OK) {
return err;
}
Variant v;
- err = parse_value(token, v, p_stream, line, r_err_str, p_res_parser);
+ err = parse_value(r_token, v, p_stream, r_line, r_err_str, p_res_parser);
if (err) {
return err;
}
@@ -1088,23 +1088,23 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
}
} else if (id == "Resource" || id == "SubResource" || id == "ExtResource") {
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_PARENTHESIS_OPEN) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_PARENTHESIS_OPEN) {
r_err_str = "Expected '('";
return ERR_PARSE_ERROR;
}
if (p_res_parser && id == "Resource" && p_res_parser->func) {
Ref<Resource> res;
- Error err = p_res_parser->func(p_res_parser->userdata, p_stream, res, line, r_err_str);
+ Error err = p_res_parser->func(p_res_parser->userdata, p_stream, res, r_line, r_err_str);
if (err) {
return err;
}
- value = res;
+ r_value = res;
} else if (p_res_parser && id == "ExtResource" && p_res_parser->ext_func) {
Ref<Resource> res;
- Error err = p_res_parser->ext_func(p_res_parser->userdata, p_stream, res, line, r_err_str);
+ Error err = p_res_parser->ext_func(p_res_parser->userdata, p_stream, res, r_line, r_err_str);
if (err) {
// If the file is missing, the error can be ignored.
if (err != ERR_FILE_NOT_FOUND && err != ERR_CANT_OPEN && err != ERR_FILE_CANT_OPEN) {
@@ -1112,34 +1112,34 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
}
- value = res;
+ r_value = res;
} else if (p_res_parser && id == "SubResource" && p_res_parser->sub_func) {
Ref<Resource> res;
- Error err = p_res_parser->sub_func(p_res_parser->userdata, p_stream, res, line, r_err_str);
+ Error err = p_res_parser->sub_func(p_res_parser->userdata, p_stream, res, r_line, r_err_str);
if (err) {
return err;
}
- value = res;
+ r_value = res;
} else {
- get_token(p_stream, token, line, r_err_str);
- if (token.type == TK_STRING) {
- String path = token.value;
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type == TK_STRING) {
+ String path = r_token.value;
String uid_string;
- get_token(p_stream, token, line, r_err_str);
+ get_token(p_stream, r_token, r_line, r_err_str);
if (path.begins_with("uid://")) {
uid_string = path;
path = "";
}
- if (token.type == TK_COMMA) {
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_STRING) {
+ if (r_token.type == TK_COMMA) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_STRING) {
r_err_str = "Expected string in Resource reference";
return ERR_PARSE_ERROR;
}
- String extra_path = token.value;
+ String extra_path = r_token.value;
if (extra_path.begins_with("uid://")) {
if (!uid_string.is_empty()) {
r_err_str = "Two uid:// paths in one Resource reference";
@@ -1153,7 +1153,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
path = extra_path;
}
- get_token(p_stream, token, line, r_err_str);
+ get_token(p_stream, r_token, r_line, r_err_str);
}
Ref<Resource> res;
@@ -1174,12 +1174,12 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- if (token.type != TK_PARENTHESIS_CLOSE) {
+ if (r_token.type != TK_PARENTHESIS_CLOSE) {
r_err_str = "Expected ')'";
return ERR_PARSE_ERROR;
}
- value = res;
+ r_value = res;
} else {
r_err_str = "Expected string as argument for Resource()";
return ERR_PARSE_ERROR;
@@ -1188,14 +1188,14 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
} else if (id == "Dictionary") {
Error err = OK;
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_BRACKET_OPEN) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_BRACKET_OPEN) {
r_err_str = "Expected '['";
return ERR_PARSE_ERROR;
}
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_IDENTIFIER) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_IDENTIFIER) {
r_err_str = "Expected type identifier for key";
return ERR_PARSE_ERROR;
}
@@ -1212,17 +1212,17 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
StringName key_class_name;
Variant key_script;
bool got_comma_token = false;
- if (builtin_types.has(token.value)) {
- key_type = builtin_types.get(token.value);
- } else if (token.value == "Resource" || token.value == "SubResource" || token.value == "ExtResource") {
+ if (builtin_types.has(r_token.value)) {
+ key_type = builtin_types.get(r_token.value);
+ } else if (r_token.value == "Resource" || r_token.value == "SubResource" || r_token.value == "ExtResource") {
Variant resource;
- err = parse_value(token, resource, p_stream, line, r_err_str, p_res_parser);
+ err = parse_value(r_token, resource, p_stream, r_line, r_err_str, p_res_parser);
if (err) {
- if (token.value == "Resource" && err == ERR_PARSE_ERROR && r_err_str == "Expected '('" && token.type == TK_COMMA) {
+ if (r_token.value == "Resource" && err == ERR_PARSE_ERROR && r_err_str == "Expected '('" && r_token.type == TK_COMMA) {
err = OK;
r_err_str = String();
key_type = Variant::OBJECT;
- key_class_name = token.value;
+ key_class_name = r_token.value;
got_comma_token = true;
} else {
return err;
@@ -1235,21 +1235,21 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
key_script = script;
}
}
- } else if (ClassDB::class_exists(token.value)) {
+ } else if (ClassDB::class_exists(r_token.value)) {
key_type = Variant::OBJECT;
- key_class_name = token.value;
+ key_class_name = r_token.value;
}
if (!got_comma_token) {
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_COMMA) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_COMMA) {
r_err_str = "Expected ',' after key type";
return ERR_PARSE_ERROR;
}
}
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_IDENTIFIER) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_IDENTIFIER) {
r_err_str = "Expected type identifier for value";
return ERR_PARSE_ERROR;
}
@@ -1258,17 +1258,17 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
StringName value_class_name;
Variant value_script;
bool got_bracket_token = false;
- if (builtin_types.has(token.value)) {
- value_type = builtin_types.get(token.value);
- } else if (token.value == "Resource" || token.value == "SubResource" || token.value == "ExtResource") {
+ if (builtin_types.has(r_token.value)) {
+ value_type = builtin_types.get(r_token.value);
+ } else if (r_token.value == "Resource" || r_token.value == "SubResource" || r_token.value == "ExtResource") {
Variant resource;
- err = parse_value(token, resource, p_stream, line, r_err_str, p_res_parser);
+ err = parse_value(r_token, resource, p_stream, r_line, r_err_str, p_res_parser);
if (err) {
- if (token.value == "Resource" && err == ERR_PARSE_ERROR && r_err_str == "Expected '('" && token.type == TK_BRACKET_CLOSE) {
+ if (r_token.value == "Resource" && err == ERR_PARSE_ERROR && r_err_str == "Expected '('" && r_token.type == TK_BRACKET_CLOSE) {
err = OK;
r_err_str = String();
value_type = Variant::OBJECT;
- value_class_name = token.value;
+ value_class_name = r_token.value;
got_bracket_token = true;
} else {
return err;
@@ -1281,9 +1281,9 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
value_script = script;
}
}
- } else if (ClassDB::class_exists(token.value)) {
+ } else if (ClassDB::class_exists(r_token.value)) {
value_type = Variant::OBJECT;
- value_class_name = token.value;
+ value_class_name = r_token.value;
}
if (key_type != Variant::NIL || value_type != Variant::NIL) {
@@ -1291,51 +1291,51 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
if (!got_bracket_token) {
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_BRACKET_CLOSE) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_BRACKET_CLOSE) {
r_err_str = "Expected ']'";
return ERR_PARSE_ERROR;
}
}
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_PARENTHESIS_OPEN) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_PARENTHESIS_OPEN) {
r_err_str = "Expected '('";
return ERR_PARSE_ERROR;
}
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_CURLY_BRACKET_OPEN) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_CURLY_BRACKET_OPEN) {
r_err_str = "Expected '{'";
return ERR_PARSE_ERROR;
}
Dictionary values;
- err = _parse_dictionary(values, p_stream, line, r_err_str, p_res_parser);
+ err = _parse_dictionary(values, p_stream, r_line, r_err_str, p_res_parser);
if (err) {
return err;
}
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_PARENTHESIS_CLOSE) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_PARENTHESIS_CLOSE) {
r_err_str = "Expected ')'";
return ERR_PARSE_ERROR;
}
dict.assign(values);
- value = dict;
+ r_value = dict;
} else if (id == "Array") {
Error err = OK;
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_BRACKET_OPEN) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_BRACKET_OPEN) {
r_err_str = "Expected '['";
return ERR_PARSE_ERROR;
}
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_IDENTIFIER) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_IDENTIFIER) {
r_err_str = "Expected type identifier";
return ERR_PARSE_ERROR;
}
@@ -1349,16 +1349,16 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
Array array = Array();
bool got_bracket_token = false;
- if (builtin_types.has(token.value)) {
- array.set_typed(builtin_types.get(token.value), StringName(), Variant());
- } else if (token.value == "Resource" || token.value == "SubResource" || token.value == "ExtResource") {
+ if (builtin_types.has(r_token.value)) {
+ array.set_typed(builtin_types.get(r_token.value), StringName(), Variant());
+ } else if (r_token.value == "Resource" || r_token.value == "SubResource" || r_token.value == "ExtResource") {
Variant resource;
- err = parse_value(token, resource, p_stream, line, r_err_str, p_res_parser);
+ err = parse_value(r_token, resource, p_stream, r_line, r_err_str, p_res_parser);
if (err) {
- if (token.value == "Resource" && err == ERR_PARSE_ERROR && r_err_str == "Expected '('" && token.type == TK_BRACKET_CLOSE) {
+ if (r_token.value == "Resource" && err == ERR_PARSE_ERROR && r_err_str == "Expected '('" && r_token.type == TK_BRACKET_CLOSE) {
err = OK;
r_err_str = String();
- array.set_typed(Variant::OBJECT, token.value, Variant());
+ array.set_typed(Variant::OBJECT, r_token.value, Variant());
got_bracket_token = true;
} else {
return err;
@@ -1369,48 +1369,48 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
array.set_typed(Variant::OBJECT, script->get_instance_base_type(), script);
}
}
- } else if (ClassDB::class_exists(token.value)) {
- array.set_typed(Variant::OBJECT, token.value, Variant());
+ } else if (ClassDB::class_exists(r_token.value)) {
+ array.set_typed(Variant::OBJECT, r_token.value, Variant());
}
if (!got_bracket_token) {
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_BRACKET_CLOSE) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_BRACKET_CLOSE) {
r_err_str = "Expected ']'";
return ERR_PARSE_ERROR;
}
}
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_PARENTHESIS_OPEN) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_PARENTHESIS_OPEN) {
r_err_str = "Expected '('";
return ERR_PARSE_ERROR;
}
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_BRACKET_OPEN) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_BRACKET_OPEN) {
r_err_str = "Expected '['";
return ERR_PARSE_ERROR;
}
Array values;
- err = _parse_array(values, p_stream, line, r_err_str, p_res_parser);
+ err = _parse_array(values, p_stream, r_line, r_err_str, p_res_parser);
if (err) {
return err;
}
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_PARENTHESIS_CLOSE) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_PARENTHESIS_CLOSE) {
r_err_str = "Expected ')'";
return ERR_PARSE_ERROR;
}
array.assign(values);
- value = array;
+ r_value = array;
} else if (id == "PackedByteArray" || id == "PoolByteArray" || id == "ByteArray") {
Vector<uint8_t> args;
- Error err = _parse_byte_array(p_stream, args, line, r_err_str);
+ Error err = _parse_byte_array(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -1425,10 +1425,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
}
- value = arr;
+ r_value = arr;
} else if (id == "PackedInt32Array" || id == "PackedIntArray" || id == "PoolIntArray" || id == "IntArray") {
Vector<int32_t> args;
- Error err = _parse_construct<int32_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<int32_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -1443,10 +1443,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
}
- value = arr;
+ r_value = arr;
} else if (id == "PackedInt64Array") {
Vector<int64_t> args;
- Error err = _parse_construct<int64_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<int64_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -1461,10 +1461,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
}
- value = arr;
+ r_value = arr;
} else if (id == "PackedFloat32Array" || id == "PackedRealArray" || id == "PoolRealArray" || id == "FloatArray") {
Vector<float> args;
- Error err = _parse_construct<float>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<float>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -1479,10 +1479,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
}
- value = arr;
+ r_value = arr;
} else if (id == "PackedFloat64Array") {
Vector<double> args;
- Error err = _parse_construct<double>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<double>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -1497,10 +1497,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
}
- value = arr;
+ r_value = arr;
} else if (id == "PackedStringArray" || id == "PoolStringArray" || id == "StringArray") {
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_PARENTHESIS_OPEN) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_PARENTHESIS_OPEN) {
r_err_str = "Expected '('";
return ERR_PARSE_ERROR;
}
@@ -1510,27 +1510,27 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
bool first = true;
while (true) {
if (!first) {
- get_token(p_stream, token, line, r_err_str);
- if (token.type == TK_COMMA) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type == TK_COMMA) {
//do none
- } else if (token.type == TK_PARENTHESIS_CLOSE) {
+ } else if (r_token.type == TK_PARENTHESIS_CLOSE) {
break;
} else {
r_err_str = "Expected ',' or ')'";
return ERR_PARSE_ERROR;
}
}
- get_token(p_stream, token, line, r_err_str);
+ get_token(p_stream, r_token, r_line, r_err_str);
- if (token.type == TK_PARENTHESIS_CLOSE) {
+ if (r_token.type == TK_PARENTHESIS_CLOSE) {
break;
- } else if (token.type != TK_STRING) {
+ } else if (r_token.type != TK_STRING) {
r_err_str = "Expected string";
return ERR_PARSE_ERROR;
}
first = false;
- cs.push_back(token.value);
+ cs.push_back(r_token.value);
}
Vector<String> arr;
@@ -1543,10 +1543,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
}
- value = arr;
+ r_value = arr;
} else if (id == "PackedVector2Array" || id == "PoolVector2Array" || id == "Vector2Array") {
Vector<real_t> args;
- Error err = _parse_construct<real_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<real_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -1561,10 +1561,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
}
- value = arr;
+ r_value = arr;
} else if (id == "PackedVector3Array" || id == "PoolVector3Array" || id == "Vector3Array") {
Vector<real_t> args;
- Error err = _parse_construct<real_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<real_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -1579,10 +1579,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
}
- value = arr;
+ r_value = arr;
} else if (id == "PackedVector4Array" || id == "PoolVector4Array" || id == "Vector4Array") {
Vector<real_t> args;
- Error err = _parse_construct<real_t>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<real_t>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -1597,10 +1597,10 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
}
- value = arr;
+ r_value = arr;
} else if (id == "PackedColorArray" || id == "PoolColorArray" || id == "ColorArray") {
Vector<float> args;
- Error err = _parse_construct<float>(p_stream, args, line, r_err_str);
+ Error err = _parse_construct<float>(p_stream, args, r_line, r_err_str);
if (err) {
return err;
}
@@ -1615,7 +1615,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
}
- value = arr;
+ r_value = arr;
} else {
r_err_str = vformat("Unexpected identifier '%s'", id);
return ERR_PARSE_ERROR;
@@ -1623,25 +1623,25 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
// All above branches end up here unless they had an early return.
return OK;
- } else if (token.type == TK_NUMBER) {
- value = token.value;
+ } else if (r_token.type == TK_NUMBER) {
+ r_value = r_token.value;
return OK;
- } else if (token.type == TK_STRING) {
- value = token.value;
+ } else if (r_token.type == TK_STRING) {
+ r_value = r_token.value;
return OK;
- } else if (token.type == TK_STRING_NAME) {
- value = token.value;
+ } else if (r_token.type == TK_STRING_NAME) {
+ r_value = r_token.value;
return OK;
- } else if (token.type == TK_COLOR) {
- value = token.value;
+ } else if (r_token.type == TK_COLOR) {
+ r_value = r_token.value;
return OK;
} else {
- r_err_str = vformat("Expected value, got '%s'", String(tk_name[token.type]));
+ r_err_str = vformat("Expected value, got '%s'", String(tk_name[r_token.type]));
return ERR_PARSE_ERROR;
}
}
-Error VariantParser::_parse_array(Array &array, Stream *p_stream, int &line, String &r_err_str, ResourceParser *p_res_parser) {
+Error VariantParser::_parse_array(Array &r_array, Stream *p_stream, int &r_line, String &r_err_str, ResourceParser *p_res_parser) {
Token token;
bool need_comma = false;
@@ -1651,7 +1651,7 @@ Error VariantParser::_parse_array(Array &array, Stream *p_stream, int &line, Str
return ERR_FILE_CORRUPT;
}
- Error err = get_token(p_stream, token, line, r_err_str);
+ Error err = get_token(p_stream, token, r_line, r_err_str);
if (err != OK) {
return err;
}
@@ -1671,17 +1671,17 @@ Error VariantParser::_parse_array(Array &array, Stream *p_stream, int &line, Str
}
Variant v;
- err = parse_value(token, v, p_stream, line, r_err_str, p_res_parser);
+ err = parse_value(token, v, p_stream, r_line, r_err_str, p_res_parser);
if (err) {
return err;
}
- array.push_back(v);
+ r_array.push_back(v);
need_comma = true;
}
}
-Error VariantParser::_parse_dictionary(Dictionary &object, Stream *p_stream, int &line, String &r_err_str, ResourceParser *p_res_parser) {
+Error VariantParser::_parse_dictionary(Dictionary &r_object, Stream *p_stream, int &r_line, String &r_err_str, ResourceParser *p_res_parser) {
bool at_key = true;
Variant key;
Token token;
@@ -1694,7 +1694,7 @@ Error VariantParser::_parse_dictionary(Dictionary &object, Stream *p_stream, int
}
if (at_key) {
- Error err = get_token(p_stream, token, line, r_err_str);
+ Error err = get_token(p_stream, token, r_line, r_err_str);
if (err != OK) {
return err;
}
@@ -1713,13 +1713,13 @@ Error VariantParser::_parse_dictionary(Dictionary &object, Stream *p_stream, int
}
}
- err = parse_value(token, key, p_stream, line, r_err_str, p_res_parser);
+ err = parse_value(token, key, p_stream, r_line, r_err_str, p_res_parser);
if (err) {
return err;
}
- err = get_token(p_stream, token, line, r_err_str);
+ err = get_token(p_stream, token, r_line, r_err_str);
if (err != OK) {
return err;
@@ -1730,27 +1730,27 @@ Error VariantParser::_parse_dictionary(Dictionary &object, Stream *p_stream, int
}
at_key = false;
} else {
- Error err = get_token(p_stream, token, line, r_err_str);
+ Error err = get_token(p_stream, token, r_line, r_err_str);
if (err != OK) {
return err;
}
Variant v;
- err = parse_value(token, v, p_stream, line, r_err_str, p_res_parser);
+ err = parse_value(token, v, p_stream, r_line, r_err_str, p_res_parser);
if (err && err != ERR_FILE_MISSING_DEPENDENCIES) {
return err;
}
- object[key] = v;
+ r_object[key] = v;
need_comma = true;
at_key = true;
}
}
}
-Error VariantParser::_parse_tag(Token &token, Stream *p_stream, int &line, String &r_err_str, Tag &r_tag, ResourceParser *p_res_parser, bool p_simple_tag) {
+Error VariantParser::_parse_tag(Token &r_token, Stream *p_stream, int &r_line, String &r_err_str, Tag &r_tag, ResourceParser *p_res_parser, bool p_simple_tag) {
r_tag.fields.clear();
- if (token.type != TK_BRACKET_OPEN) {
+ if (r_token.type != TK_BRACKET_OPEN) {
r_err_str = "Expected '['";
return ERR_PARSE_ERROR;
}
@@ -1810,14 +1810,14 @@ Error VariantParser::_parse_tag(Token &token, Stream *p_stream, int &line, Strin
return OK;
}
- get_token(p_stream, token, line, r_err_str);
+ get_token(p_stream, r_token, r_line, r_err_str);
- if (token.type != TK_IDENTIFIER) {
+ if (r_token.type != TK_IDENTIFIER) {
r_err_str = "Expected identifier (tag name)";
return ERR_PARSE_ERROR;
}
- r_tag.name = token.value;
+ r_tag.name = r_token.value;
bool parsing_tag = true;
while (true) {
@@ -1826,42 +1826,42 @@ Error VariantParser::_parse_tag(Token &token, Stream *p_stream, int &line, Strin
return ERR_FILE_CORRUPT;
}
- get_token(p_stream, token, line, r_err_str);
- if (token.type == TK_BRACKET_CLOSE) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type == TK_BRACKET_CLOSE) {
break;
}
- if (parsing_tag && token.type == TK_PERIOD) {
+ if (parsing_tag && r_token.type == TK_PERIOD) {
r_tag.name += "."; //support tags such as [someprop.Android] for specific platforms
- get_token(p_stream, token, line, r_err_str);
- } else if (parsing_tag && token.type == TK_COLON) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ } else if (parsing_tag && r_token.type == TK_COLON) {
r_tag.name += ":"; //support tags such as [someprop.Android] for specific platforms
- get_token(p_stream, token, line, r_err_str);
+ get_token(p_stream, r_token, r_line, r_err_str);
} else {
parsing_tag = false;
}
- if (token.type != TK_IDENTIFIER) {
+ if (r_token.type != TK_IDENTIFIER) {
r_err_str = "Expected identifier";
return ERR_PARSE_ERROR;
}
- String id = token.value;
+ String id = r_token.value;
if (parsing_tag) {
r_tag.name += id;
continue;
}
- get_token(p_stream, token, line, r_err_str);
- if (token.type != TK_EQUAL) {
+ get_token(p_stream, r_token, r_line, r_err_str);
+ if (r_token.type != TK_EQUAL) {
r_err_str = "Expected '=' after identifier";
return ERR_PARSE_ERROR;
}
- get_token(p_stream, token, line, r_err_str);
+ get_token(p_stream, r_token, r_line, r_err_str);
Variant value;
- Error err = parse_value(token, value, p_stream, line, r_err_str, p_res_parser);
+ Error err = parse_value(r_token, value, p_stream, r_line, r_err_str, p_res_parser);
if (err) {
return err;
}
@@ -1872,9 +1872,9 @@ Error VariantParser::_parse_tag(Token &token, Stream *p_stream, int &line, Strin
return OK;
}
-Error VariantParser::parse_tag(Stream *p_stream, int &line, String &r_err_str, Tag &r_tag, ResourceParser *p_res_parser, bool p_simple_tag) {
+Error VariantParser::parse_tag(Stream *p_stream, int &r_line, String &r_err_str, Tag &r_tag, ResourceParser *p_res_parser, bool p_simple_tag) {
Token token;
- get_token(p_stream, token, line, r_err_str);
+ get_token(p_stream, token, r_line, r_err_str);
if (token.type == TK_EOF) {
return ERR_FILE_EOF;
@@ -1885,10 +1885,10 @@ Error VariantParser::parse_tag(Stream *p_stream, int &line, String &r_err_str, T
return ERR_PARSE_ERROR;
}
- return _parse_tag(token, p_stream, line, r_err_str, r_tag, p_res_parser, p_simple_tag);
+ return _parse_tag(token, p_stream, r_line, r_err_str, r_tag, p_res_parser, p_simple_tag);
}
-Error VariantParser::parse_tag_assign_eof(Stream *p_stream, int &line, String &r_err_str, Tag &r_tag, String &r_assign, Variant &r_value, ResourceParser *p_res_parser, bool p_simple_tag) {
+Error VariantParser::parse_tag_assign_eof(Stream *p_stream, int &r_line, String &r_err_str, Tag &r_tag, String &r_assign, Variant &r_value, ResourceParser *p_res_parser, bool p_simple_tag) {
//assign..
r_assign = "";
String what;
@@ -1914,7 +1914,7 @@ Error VariantParser::parse_tag_assign_eof(Stream *p_stream, int &line, String &r
return ERR_FILE_EOF;
}
if (ch == '\n') {
- line++;
+ r_line++;
break;
}
}
@@ -1925,7 +1925,7 @@ Error VariantParser::parse_tag_assign_eof(Stream *p_stream, int &line, String &r
//it's a tag!
p_stream->saved = '['; //go back one
- Error err = parse_tag(p_stream, line, r_err_str, r_tag, p_res_parser, p_simple_tag);
+ Error err = parse_tag(p_stream, r_line, r_err_str, r_tag, p_res_parser, p_simple_tag);
return err;
}
@@ -1934,7 +1934,7 @@ Error VariantParser::parse_tag_assign_eof(Stream *p_stream, int &line, String &r
if (c == '"') { //quoted
p_stream->saved = '"';
Token tk;
- Error err = get_token(p_stream, tk, line, r_err_str);
+ Error err = get_token(p_stream, tk, r_line, r_err_str);
if (err) {
return err;
}
@@ -1950,12 +1950,12 @@ Error VariantParser::parse_tag_assign_eof(Stream *p_stream, int &line, String &r
} else {
r_assign = what;
Token token;
- get_token(p_stream, token, line, r_err_str);
- Error err = parse_value(token, r_value, p_stream, line, r_err_str, p_res_parser);
+ get_token(p_stream, token, r_line, r_err_str);
+ Error err = parse_value(token, r_value, p_stream, r_line, r_err_str, p_res_parser);
return err;
}
} else if (c == '\n') {
- line++;
+ r_line++;
}
}
}
@@ -1999,13 +1999,13 @@ static String rtos_fix(double p_value, bool p_compat) {
return String::num_scientific(p_value);
}
-static String encode_resource_reference(const String &path) {
- ResourceUID::ID uid = ResourceLoader::get_resource_uid(path);
+static String encode_resource_reference(const String &p_path) {
+ ResourceUID::ID uid = ResourceLoader::get_resource_uid(p_path);
if (uid != ResourceUID::INVALID_ID) {
return "Resource(\"" + ResourceUID::get_singleton()->id_to_text(uid) +
- "\", \"" + path.c_escape_multiline() + "\")";
+ "\", \"" + p_path.c_escape_multiline() + "\")";
} else {
- return "Resource(\"" + path.c_escape_multiline() + "\")";
+ return "Resource(\"" + p_path.c_escape_multiline() + "\")";
}
}
@@ -2562,8 +2562,8 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
return OK;
}
-static Error _write_to_str(void *ud, const String &p_string) {
- String *str = (String *)ud;
+static Error _write_to_str(void *p_ud, const String &p_string) {
+ String *str = (String *)p_ud;
(*str) += p_string;
return OK;
}
diff --git a/core/variant/variant_parser.h b/core/variant/variant_parser.h
index 59f005a584a..ffc51bdbd2c 100644
--- a/core/variant/variant_parser.h
+++ b/core/variant/variant_parser.h
@@ -87,7 +87,7 @@ public:
StreamString(bool p_readahead_enabled = true) { readahead_enabled = p_readahead_enabled; }
};
- typedef Error (*ParseResourceFunc)(void *p_self, Stream *p_stream, Ref<Resource> &r_res, int &line, String &r_err_str);
+ typedef Error (*ParseResourceFunc)(void *p_self, Stream *p_stream, Ref<Resource> &r_res, int &r_line, String &r_err_str);
struct ResourceParser {
void *userdata = nullptr;
@@ -138,26 +138,26 @@ private:
static const char *tk_name[TK_MAX];
template <typename T>
- static Error _parse_construct(Stream *p_stream, Vector<T> &r_construct, int &line, String &r_err_str);
- static Error _parse_byte_array(Stream *p_stream, Vector<uint8_t> &r_construct, int &line, String &r_err_str);
- static Error _parse_enginecfg(Stream *p_stream, Vector<String> &strings, int &line, String &r_err_str);
- static Error _parse_dictionary(Dictionary &object, Stream *p_stream, int &line, String &r_err_str, ResourceParser *p_res_parser = nullptr);
- static Error _parse_array(Array &array, Stream *p_stream, int &line, String &r_err_str, ResourceParser *p_res_parser = nullptr);
- static Error _parse_tag(Token &token, Stream *p_stream, int &line, String &r_err_str, Tag &r_tag, ResourceParser *p_res_parser = nullptr, bool p_simple_tag = false);
+ static Error _parse_construct(Stream *p_stream, Vector<T> &r_construct, int &r_line, String &r_err_str);
+ static Error _parse_byte_array(Stream *p_stream, Vector<uint8_t> &r_construct, int &r_line, String &r_err_str);
+ static Error _parse_enginecfg(Stream *p_stream, Vector<String> &r_strings, int &r_line, String &r_err_str);
+ static Error _parse_dictionary(Dictionary &r_object, Stream *p_stream, int &r_line, String &r_err_str, ResourceParser *p_res_parser = nullptr);
+ static Error _parse_array(Array &r_array, Stream *p_stream, int &r_line, String &r_err_str, ResourceParser *p_res_parser = nullptr);
+ static Error _parse_tag(Token &r_token, Stream *p_stream, int &r_line, String &r_err_str, Tag &r_tag, ResourceParser *p_res_parser = nullptr, bool p_simple_tag = false);
public:
- static Error parse_tag(Stream *p_stream, int &line, String &r_err_str, Tag &r_tag, ResourceParser *p_res_parser = nullptr, bool p_simple_tag = false);
- static Error parse_tag_assign_eof(Stream *p_stream, int &line, String &r_err_str, Tag &r_tag, String &r_assign, Variant &r_value, ResourceParser *p_res_parser = nullptr, bool p_simple_tag = false);
+ static Error parse_tag(Stream *p_stream, int &r_line, String &r_err_str, Tag &r_tag, ResourceParser *p_res_parser = nullptr, bool p_simple_tag = false);
+ static Error parse_tag_assign_eof(Stream *p_stream, int &r_line, String &r_err_str, Tag &r_tag, String &r_assign, Variant &r_value, ResourceParser *p_res_parser = nullptr, bool p_simple_tag = false);
- static Error parse_value(Token &token, Variant &value, Stream *p_stream, int &line, String &r_err_str, ResourceParser *p_res_parser = nullptr);
- static Error get_token(Stream *p_stream, Token &r_token, int &line, String &r_err_str);
+ static Error parse_value(Token &r_token, Variant &r_value, Stream *p_stream, int &r_line, String &r_err_str, ResourceParser *p_res_parser = nullptr);
+ static Error get_token(Stream *p_stream, Token &r_token, int &r_line, String &r_err_str);
static Error parse(Stream *p_stream, Variant &r_ret, String &r_err_str, int &r_err_line, ResourceParser *p_res_parser = nullptr);
};
class VariantWriter {
public:
- typedef Error (*StoreStringFunc)(void *ud, const String &p_string);
- typedef String (*EncodeResourceFunc)(void *ud, const Ref<Resource> &p_resource);
+ typedef Error (*StoreStringFunc)(void *p_ud, const String &p_string);
+ typedef String (*EncodeResourceFunc)(void *p_ud, const Ref<Resource> &p_resource);
static Error write(const Variant &p_variant, StoreStringFunc p_store_string_func, void *p_store_string_ud, EncodeResourceFunc p_encode_res_func, void *p_encode_res_ud, int p_recursion_count = 0, bool p_compat = true);
static Error write_to_string(const Variant &p_variant, String &r_string, EncodeResourceFunc p_encode_res_func = nullptr, void *p_encode_res_ud = nullptr, bool p_compat = true);
diff --git a/core/variant/variant_setget.cpp b/core/variant/variant_setget.cpp
index 91f92dda59b..1aacbe575b2 100644
--- a/core/variant/variant_setget.cpp
+++ b/core/variant/variant_setget.cpp
@@ -35,8 +35,8 @@
#include "core/variant/variant_callable.h"
struct VariantSetterGetterInfo {
- void (*setter)(Variant *base, const Variant *value, bool &valid);
- void (*getter)(const Variant *base, Variant *value);
+ void (*setter)(Variant *r_base, const Variant *p_value, bool &r_valid);
+ void (*getter)(const Variant *p_base, Variant *r_value);
Variant::ValidatedSetter validated_setter;
Variant::ValidatedGetter validated_getter;
Variant::PTRSetter ptr_setter;
@@ -332,65 +332,65 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
#define INDEXED_SETGET_STRUCT_TYPED(m_base_type, m_elem_type) \
struct VariantIndexedSetGet_##m_base_type { \
- static void get(const Variant *base, int64_t index, Variant *value, bool *oob) { \
- int64_t size = VariantInternalAccessor<m_base_type>::get(base).size(); \
- if (index < 0) { \
- index += size; \
+ static void get(const Variant *p_base, int64_t p_index, Variant *r_value, bool *r_oob) { \
+ int64_t size = VariantInternalAccessor<m_base_type>::get(p_base).size(); \
+ if (p_index < 0) { \
+ p_index += size; \
} \
- if (index < 0 || index >= size) { \
- *oob = true; \
+ if (p_index < 0 || p_index >= size) { \
+ *r_oob = true; \
return; \
} \
- VariantTypeAdjust<m_elem_type>::adjust(value); \
- VariantInternalAccessor<m_elem_type>::get(value) = (VariantInternalAccessor<m_base_type>::get(base))[index]; \
- *oob = false; \
+ VariantTypeAdjust<m_elem_type>::adjust(r_value); \
+ VariantInternalAccessor<m_elem_type>::get(r_value) = (VariantInternalAccessor<m_base_type>::get(p_base))[p_index]; \
+ *r_oob = false; \
} \
- static void ptr_get(const void *base, int64_t index, void *member) { \
+ static void ptr_get(const void *p_base, int64_t p_index, void *member) { \
/* avoid ptrconvert for performance*/ \
- const m_base_type &v = *reinterpret_cast<const m_base_type *>(base); \
- if (index < 0) \
- index += v.size(); \
- OOB_TEST(index, v.size()); \
- PtrToArg<m_elem_type>::encode(v[index], member); \
+ const m_base_type &v = *reinterpret_cast<const m_base_type *>(p_base); \
+ if (p_index < 0) \
+ p_index += v.size(); \
+ OOB_TEST(p_index, v.size()); \
+ PtrToArg<m_elem_type>::encode(v[p_index], member); \
} \
- static void set(Variant *base, int64_t index, const Variant *value, bool *valid, bool *oob) { \
- if (value->get_type() != GetTypeInfo<m_elem_type>::VARIANT_TYPE) { \
- *oob = false; \
- *valid = false; \
+ static void set(Variant *r_base, int64_t p_index, const Variant *p_value, bool *r_valid, bool *r_oob) { \
+ if (p_value->get_type() != GetTypeInfo<m_elem_type>::VARIANT_TYPE) { \
+ *r_oob = false; \
+ *r_valid = false; \
return; \
} \
- int64_t size = VariantInternalAccessor<m_base_type>::get(base).size(); \
- if (index < 0) { \
- index += size; \
+ int64_t size = VariantInternalAccessor<m_base_type>::get(r_base).size(); \
+ if (p_index < 0) { \
+ p_index += size; \
} \
- if (index < 0 || index >= size) { \
- *oob = true; \
- *valid = false; \
+ if (p_index < 0 || p_index >= size) { \
+ *r_oob = true; \
+ *r_valid = false; \
return; \
} \
- (VariantInternalAccessor<m_base_type>::get(base)).write[index] = VariantInternalAccessor<m_elem_type>::get(value); \
- *oob = false; \
- *valid = true; \
+ (VariantInternalAccessor<m_base_type>::get(r_base)).write[p_index] = VariantInternalAccessor<m_elem_type>::get(p_value); \
+ *r_oob = false; \
+ *r_valid = true; \
} \
- static void validated_set(Variant *base, int64_t index, const Variant *value, bool *oob) { \
- int64_t size = VariantInternalAccessor<m_base_type>::get(base).size(); \
- if (index < 0) { \
- index += size; \
+ static void validated_set(Variant *r_base, int64_t p_index, const Variant *p_value, bool *r_oob) { \
+ int64_t size = VariantInternalAccessor<m_base_type>::get(r_base).size(); \
+ if (p_index < 0) { \
+ p_index += size; \
} \
- if (index < 0 || index >= size) { \
- *oob = true; \
+ if (p_index < 0 || p_index >= size) { \
+ *r_oob = true; \
return; \
} \
- (VariantInternalAccessor<m_base_type>::get(base)).write[index] = VariantInternalAccessor<m_elem_type>::get(value); \
- *oob = false; \
+ (VariantInternalAccessor<m_base_type>::get(r_base)).write[p_index] = VariantInternalAccessor<m_elem_type>::get(p_value); \
+ *r_oob = false; \
} \
- static void ptr_set(void *base, int64_t index, const void *member) { \
+ static void ptr_set(void *r_base, int64_t p_index, const void *member) { \
/* avoid ptrconvert for performance*/ \
- m_base_type &v = *reinterpret_cast<m_base_type *>(base); \
- if (index < 0) \
- index += v.size(); \
- OOB_TEST(index, v.size()); \
- v.write[index] = PtrToArg<m_elem_type>::convert(member); \
+ m_base_type &v = *reinterpret_cast<m_base_type *>(r_base); \
+ if (p_index < 0) \
+ p_index += v.size(); \
+ OOB_TEST(p_index, v.size()); \
+ v.write[p_index] = PtrToArg<m_elem_type>::convert(member); \
} \
static Variant::Type get_index_type() { \
return GetTypeInfo<m_elem_type>::VARIANT_TYPE; \
@@ -398,77 +398,77 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
static uint32_t get_index_usage() { \
return GetTypeInfo<m_elem_type>::get_class_info().usage; \
} \
- static uint64_t get_indexed_size(const Variant *base) { \
- return VariantInternalAccessor<m_base_type>::get(base).size(); \
+ static uint64_t get_indexed_size(const Variant *p_base) { \
+ return VariantInternalAccessor<m_base_type>::get(p_base).size(); \
} \
};
#define INDEXED_SETGET_STRUCT_TYPED_NUMERIC(m_base_type, m_elem_type, m_assign_type) \
struct VariantIndexedSetGet_##m_base_type { \
- static void get(const Variant *base, int64_t index, Variant *value, bool *oob) { \
- int64_t size = VariantInternalAccessor<m_base_type>::get(base).size(); \
- if (index < 0) { \
- index += size; \
+ static void get(const Variant *p_base, int64_t p_index, Variant *r_value, bool *r_oob) { \
+ int64_t size = VariantInternalAccessor<m_base_type>::get(p_base).size(); \
+ if (p_index < 0) { \
+ p_index += size; \
} \
- if (index < 0 || index >= size) { \
- *oob = true; \
+ if (p_index < 0 || p_index >= size) { \
+ *r_oob = true; \
return; \
} \
- VariantTypeAdjust<m_elem_type>::adjust(value); \
- VariantInternalAccessor<m_elem_type>::get(value) = (VariantInternalAccessor<m_base_type>::get(base))[index]; \
- *oob = false; \
+ VariantTypeAdjust<m_elem_type>::adjust(r_value); \
+ VariantInternalAccessor<m_elem_type>::get(r_value) = (VariantInternalAccessor<m_base_type>::get(p_base))[p_index]; \
+ *r_oob = false; \
} \
- static void ptr_get(const void *base, int64_t index, void *member) { \
+ static void ptr_get(const void *p_base, int64_t p_index, void *member) { \
/* avoid ptrconvert for performance*/ \
- const m_base_type &v = *reinterpret_cast<const m_base_type *>(base); \
- if (index < 0) \
- index += v.size(); \
- OOB_TEST(index, v.size()); \
- PtrToArg<m_elem_type>::encode(v[index], member); \
+ const m_base_type &v = *reinterpret_cast<const m_base_type *>(p_base); \
+ if (p_index < 0) \
+ p_index += v.size(); \
+ OOB_TEST(p_index, v.size()); \
+ PtrToArg<m_elem_type>::encode(v[p_index], member); \
} \
- static void set(Variant *base, int64_t index, const Variant *value, bool *valid, bool *oob) { \
- int64_t size = VariantInternalAccessor<m_base_type>::get(base).size(); \
- if (index < 0) { \
- index += size; \
+ static void set(Variant *r_base, int64_t p_index, const Variant *p_value, bool *r_valid, bool *r_oob) { \
+ int64_t size = VariantInternalAccessor<m_base_type>::get(r_base).size(); \
+ if (p_index < 0) { \
+ p_index += size; \
} \
- if (index < 0 || index >= size) { \
- *oob = true; \
- *valid = false; \
+ if (p_index < 0 || p_index >= size) { \
+ *r_oob = true; \
+ *r_valid = false; \
return; \
} \
m_assign_type num; \
- if (value->get_type() == Variant::INT) { \
- num = (m_assign_type) * &VariantInternalAccessor<int64_t>::get(value); \
- } else if (value->get_type() == Variant::FLOAT) { \
- num = (m_assign_type) * &VariantInternalAccessor<double>::get(value); \
+ if (p_value->get_type() == Variant::INT) { \
+ num = (m_assign_type) * &VariantInternalAccessor<int64_t>::get(p_value); \
+ } else if (p_value->get_type() == Variant::FLOAT) { \
+ num = (m_assign_type) * &VariantInternalAccessor<double>::get(p_value); \
} else { \
- *oob = false; \
- *valid = false; \
+ *r_oob = false; \
+ *r_valid = false; \
return; \
} \
- (VariantInternalAccessor<m_base_type>::get(base)).write[index] = num; \
- *oob = false; \
- *valid = true; \
+ (VariantInternalAccessor<m_base_type>::get(r_base)).write[p_index] = num; \
+ *r_oob = false; \
+ *r_valid = true; \
} \
- static void validated_set(Variant *base, int64_t index, const Variant *value, bool *oob) { \
- int64_t size = VariantInternalAccessor<m_base_type>::get(base).size(); \
- if (index < 0) { \
- index += size; \
+ static void validated_set(Variant *r_base, int64_t p_index, const Variant *p_value, bool *r_oob) { \
+ int64_t size = VariantInternalAccessor<m_base_type>::get(r_base).size(); \
+ if (p_index < 0) { \
+ p_index += size; \
} \
- if (index < 0 || index >= size) { \
- *oob = true; \
+ if (p_index < 0 || p_index >= size) { \
+ *r_oob = true; \
return; \
} \
- (VariantInternalAccessor<m_base_type>::get(base)).write[index] = VariantInternalAccessor<m_elem_type>::get(value); \
- *oob = false; \
+ (VariantInternalAccessor<m_base_type>::get(r_base)).write[p_index] = VariantInternalAccessor<m_elem_type>::get(p_value); \
+ *r_oob = false; \
} \
- static void ptr_set(void *base, int64_t index, const void *member) { \
+ static void ptr_set(void *r_base, int64_t p_index, const void *member) { \
/* avoid ptrconvert for performance*/ \
- m_base_type &v = *reinterpret_cast<m_base_type *>(base); \
- if (index < 0) \
- index += v.size(); \
- OOB_TEST(index, v.size()); \
- v.write[index] = PtrToArg<m_elem_type>::convert(member); \
+ m_base_type &v = *reinterpret_cast<m_base_type *>(r_base); \
+ if (p_index < 0) \
+ p_index += v.size(); \
+ OOB_TEST(p_index, v.size()); \
+ v.write[p_index] = PtrToArg<m_elem_type>::convert(member); \
} \
static Variant::Type get_index_type() { \
return GetTypeInfo<m_elem_type>::VARIANT_TYPE; \
@@ -476,61 +476,61 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
static uint32_t get_index_usage() { \
return GetTypeInfo<m_elem_type>::get_class_info().usage; \
} \
- static uint64_t get_indexed_size(const Variant *base) { \
- return VariantInternalAccessor<m_base_type>::get(base).size(); \
+ static uint64_t get_indexed_size(const Variant *p_base) { \
+ return VariantInternalAccessor<m_base_type>::get(p_base).size(); \
} \
};
#define INDEXED_SETGET_STRUCT_BUILTIN_NUMERIC(m_base_type, m_elem_type, m_assign_type, m_max) \
struct VariantIndexedSetGet_##m_base_type { \
- static void get(const Variant *base, int64_t index, Variant *value, bool *oob) { \
- if (index < 0 || index >= m_max) { \
- *oob = true; \
+ static void get(const Variant *p_base, int64_t p_index, Variant *r_value, bool *r_oob) { \
+ if (p_index < 0 || p_index >= m_max) { \
+ *r_oob = true; \
return; \
} \
- VariantTypeAdjust<m_elem_type>::adjust(value); \
- VariantInternalAccessor<m_elem_type>::get(value) = (VariantInternalAccessor<m_base_type>::get(base))[index]; \
- *oob = false; \
+ VariantTypeAdjust<m_elem_type>::adjust(r_value); \
+ VariantInternalAccessor<m_elem_type>::get(r_value) = (VariantInternalAccessor<m_base_type>::get(p_base))[p_index]; \
+ *r_oob = false; \
} \
- static void ptr_get(const void *base, int64_t index, void *member) { \
+ static void ptr_get(const void *p_base, int64_t p_index, void *member) { \
/* avoid ptrconvert for performance*/ \
- const m_base_type &v = *reinterpret_cast<const m_base_type *>(base); \
- OOB_TEST(index, m_max); \
- PtrToArg<m_elem_type>::encode(v[index], member); \
+ const m_base_type &v = *reinterpret_cast<const m_base_type *>(p_base); \
+ OOB_TEST(p_index, m_max); \
+ PtrToArg<m_elem_type>::encode(v[p_index], member); \
} \
- static void set(Variant *base, int64_t index, const Variant *value, bool *valid, bool *oob) { \
- if (index < 0 || index >= m_max) { \
- *oob = true; \
- *valid = false; \
+ static void set(Variant *r_base, int64_t p_index, const Variant *p_value, bool *r_valid, bool *r_oob) { \
+ if (p_index < 0 || p_index >= m_max) { \
+ *r_oob = true; \
+ *r_valid = false; \
return; \
} \
m_assign_type num; \
- if (value->get_type() == Variant::INT) { \
- num = (m_assign_type) * &VariantInternalAccessor<int64_t>::get(value); \
- } else if (value->get_type() == Variant::FLOAT) { \
- num = (m_assign_type) * &VariantInternalAccessor<double>::get(value); \
+ if (p_value->get_type() == Variant::INT) { \
+ num = (m_assign_type) * &VariantInternalAccessor<int64_t>::get(p_value); \
+ } else if (p_value->get_type() == Variant::FLOAT) { \
+ num = (m_assign_type) * &VariantInternalAccessor<double>::get(p_value); \
} else { \
- *oob = false; \
- *valid = false; \
+ *r_oob = false; \
+ *r_valid = false; \
return; \
} \
- (VariantInternalAccessor<m_base_type>::get(base))[index] = num; \
- *oob = false; \
- *valid = true; \
+ (VariantInternalAccessor<m_base_type>::get(r_base))[p_index] = num; \
+ *r_oob = false; \
+ *r_valid = true; \
} \
- static void validated_set(Variant *base, int64_t index, const Variant *value, bool *oob) { \
- if (index < 0 || index >= m_max) { \
- *oob = true; \
+ static void validated_set(Variant *r_base, int64_t p_index, const Variant *p_value, bool *r_oob) { \
+ if (p_index < 0 || p_index >= m_max) { \
+ *r_oob = true; \
return; \
} \
- (VariantInternalAccessor<m_base_type>::get(base))[index] = VariantInternalAccessor<m_elem_type>::get(value); \
- *oob = false; \
+ (VariantInternalAccessor<m_base_type>::get(r_base))[p_index] = VariantInternalAccessor<m_elem_type>::get(p_value); \
+ *r_oob = false; \
} \
- static void ptr_set(void *base, int64_t index, const void *member) { \
+ static void ptr_set(void *r_base, int64_t p_index, const void *member) { \
/* avoid ptrconvert for performance*/ \
- m_base_type &v = *reinterpret_cast<m_base_type *>(base); \
- OOB_TEST(index, m_max); \
- v[index] = PtrToArg<m_elem_type>::convert(member); \
+ m_base_type &v = *reinterpret_cast<m_base_type *>(r_base); \
+ OOB_TEST(p_index, m_max); \
+ v[p_index] = PtrToArg<m_elem_type>::convert(member); \
} \
static Variant::Type get_index_type() { \
return GetTypeInfo<m_elem_type>::VARIANT_TYPE; \
@@ -538,55 +538,55 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
static uint32_t get_index_usage() { \
return GetTypeInfo<m_elem_type>::get_class_info().usage; \
} \
- static uint64_t get_indexed_size(const Variant *base) { \
+ static uint64_t get_indexed_size(const Variant *p_base) { \
return m_max; \
} \
};
#define INDEXED_SETGET_STRUCT_BUILTIN_ACCESSOR(m_base_type, m_elem_type, m_accessor, m_max) \
struct VariantIndexedSetGet_##m_base_type { \
- static void get(const Variant *base, int64_t index, Variant *value, bool *oob) { \
- if (index < 0 || index >= m_max) { \
- *oob = true; \
+ static void get(const Variant *p_base, int64_t p_index, Variant *r_value, bool *r_oob) { \
+ if (p_index < 0 || p_index >= m_max) { \
+ *r_oob = true; \
return; \
} \
- VariantTypeAdjust<m_elem_type>::adjust(value); \
- VariantInternalAccessor<m_elem_type>::get(value) = (VariantInternalAccessor<m_base_type>::get(base))m_accessor[index]; \
- *oob = false; \
+ VariantTypeAdjust<m_elem_type>::adjust(r_value); \
+ VariantInternalAccessor<m_elem_type>::get(r_value) = (VariantInternalAccessor<m_base_type>::get(p_base))m_accessor[p_index]; \
+ *r_oob = false; \
} \
- static void ptr_get(const void *base, int64_t index, void *member) { \
+ static void ptr_get(const void *p_base, int64_t p_index, void *member) { \
/* avoid ptrconvert for performance*/ \
- const m_base_type &v = *reinterpret_cast<const m_base_type *>(base); \
- OOB_TEST(index, m_max); \
- PtrToArg<m_elem_type>::encode(v m_accessor[index], member); \
+ const m_base_type &v = *reinterpret_cast<const m_base_type *>(p_base); \
+ OOB_TEST(p_index, m_max); \
+ PtrToArg<m_elem_type>::encode(v m_accessor[p_index], member); \
} \
- static void set(Variant *base, int64_t index, const Variant *value, bool *valid, bool *oob) { \
- if (value->get_type() != GetTypeInfo<m_elem_type>::VARIANT_TYPE) { \
- *oob = false; \
- *valid = false; \
+ static void set(Variant *r_base, int64_t p_index, const Variant *p_value, bool *r_valid, bool *r_oob) { \
+ if (p_value->get_type() != GetTypeInfo<m_elem_type>::VARIANT_TYPE) { \
+ *r_oob = false; \
+ *r_valid = false; \
} \
- if (index < 0 || index >= m_max) { \
- *oob = true; \
- *valid = false; \
+ if (p_index < 0 || p_index >= m_max) { \
+ *r_oob = true; \
+ *r_valid = false; \
return; \
} \
- (VariantInternalAccessor<m_base_type>::get(base)) m_accessor[index] = VariantInternalAccessor<m_elem_type>::get(value); \
- *oob = false; \
- *valid = true; \
+ (VariantInternalAccessor<m_base_type>::get(r_base)) m_accessor[p_index] = VariantInternalAccessor<m_elem_type>::get(p_value); \
+ *r_oob = false; \
+ *r_valid = true; \
} \
- static void validated_set(Variant *base, int64_t index, const Variant *value, bool *oob) { \
- if (index < 0 || index >= m_max) { \
- *oob = true; \
+ static void validated_set(Variant *r_base, int64_t p_index, const Variant *p_value, bool *r_oob) { \
+ if (p_index < 0 || p_index >= m_max) { \
+ *r_oob = true; \
return; \
} \
- (VariantInternalAccessor<m_base_type>::get(base)) m_accessor[index] = VariantInternalAccessor<m_elem_type>::get(value); \
- *oob = false; \
+ (VariantInternalAccessor<m_base_type>::get(r_base)) m_accessor[p_index] = VariantInternalAccessor<m_elem_type>::get(p_value); \
+ *r_oob = false; \
} \
- static void ptr_set(void *base, int64_t index, const void *member) { \
+ static void ptr_set(void *r_base, int64_t p_index, const void *member) { \
/* avoid ptrconvert for performance*/ \
- m_base_type &v = *reinterpret_cast<m_base_type *>(base); \
- OOB_TEST(index, m_max); \
- v m_accessor[index] = PtrToArg<m_elem_type>::convert(member); \
+ m_base_type &v = *reinterpret_cast<m_base_type *>(r_base); \
+ OOB_TEST(p_index, m_max); \
+ v m_accessor[p_index] = PtrToArg<m_elem_type>::convert(member); \
} \
static Variant::Type get_index_type() { \
return GetTypeInfo<m_elem_type>::VARIANT_TYPE; \
@@ -594,55 +594,55 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
static uint32_t get_index_usage() { \
return GetTypeInfo<m_elem_type>::get_class_info().usage; \
} \
- static uint64_t get_indexed_size(const Variant *base) { \
+ static uint64_t get_indexed_size(const Variant *p_base) { \
return m_max; \
} \
};
#define INDEXED_SETGET_STRUCT_BUILTIN_FUNC(m_base_type, m_elem_type, m_set, m_get, m_max) \
struct VariantIndexedSetGet_##m_base_type { \
- static void get(const Variant *base, int64_t index, Variant *value, bool *oob) { \
- if (index < 0 || index >= m_max) { \
- *oob = true; \
+ static void get(const Variant *p_base, int64_t p_index, Variant *r_value, bool *r_oob) { \
+ if (p_index < 0 || p_index >= m_max) { \
+ *r_oob = true; \
return; \
} \
- VariantTypeAdjust<m_elem_type>::adjust(value); \
- VariantInternalAccessor<m_elem_type>::get(value) = VariantInternalAccessor<m_base_type>::get(base).m_get(index); \
- *oob = false; \
+ VariantTypeAdjust<m_elem_type>::adjust(r_value); \
+ VariantInternalAccessor<m_elem_type>::get(r_value) = VariantInternalAccessor<m_base_type>::get(p_base).m_get(p_index); \
+ *r_oob = false; \
} \
- static void ptr_get(const void *base, int64_t index, void *member) { \
+ static void ptr_get(const void *p_base, int64_t p_index, void *member) { \
/* avoid ptrconvert for performance*/ \
- const m_base_type &v = *reinterpret_cast<const m_base_type *>(base); \
- OOB_TEST(index, m_max); \
- PtrToArg<m_elem_type>::encode(v.m_get(index), member); \
+ const m_base_type &v = *reinterpret_cast<const m_base_type *>(p_base); \
+ OOB_TEST(p_index, m_max); \
+ PtrToArg<m_elem_type>::encode(v.m_get(p_index), member); \
} \
- static void set(Variant *base, int64_t index, const Variant *value, bool *valid, bool *oob) { \
- if (value->get_type() != GetTypeInfo<m_elem_type>::VARIANT_TYPE) { \
- *oob = false; \
- *valid = false; \
+ static void set(Variant *r_base, int64_t p_index, const Variant *p_value, bool *r_valid, bool *r_oob) { \
+ if (p_value->get_type() != GetTypeInfo<m_elem_type>::VARIANT_TYPE) { \
+ *r_oob = false; \
+ *r_valid = false; \
} \
- if (index < 0 || index >= m_max) { \
- *oob = true; \
- *valid = false; \
+ if (p_index < 0 || p_index >= m_max) { \
+ *r_oob = true; \
+ *r_valid = false; \
return; \
} \
- VariantInternalAccessor<m_base_type>::get(base).m_set(index, VariantInternalAccessor<m_elem_type>::get(value)); \
- *oob = false; \
- *valid = true; \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_set(p_index, VariantInternalAccessor<m_elem_type>::get(p_value)); \
+ *r_oob = false; \
+ *r_valid = true; \
} \
- static void validated_set(Variant *base, int64_t index, const Variant *value, bool *oob) { \
- if (index < 0 || index >= m_max) { \
- *oob = true; \
+ static void validated_set(Variant *r_base, int64_t p_index, const Variant *p_value, bool *r_oob) { \
+ if (p_index < 0 || p_index >= m_max) { \
+ *r_oob = true; \
return; \
} \
- VariantInternalAccessor<m_base_type>::get(base).m_set(index, VariantInternalAccessor<m_elem_type>::get(value)); \
- *oob = false; \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_set(p_index, VariantInternalAccessor<m_elem_type>::get(p_value)); \
+ *r_oob = false; \
} \
- static void ptr_set(void *base, int64_t index, const void *member) { \
+ static void ptr_set(void *r_base, int64_t p_index, const void *member) { \
/* avoid ptrconvert for performance*/ \
- m_base_type &v = *reinterpret_cast<m_base_type *>(base); \
- OOB_TEST(index, m_max); \
- v.m_set(index, PtrToArg<m_elem_type>::convert(member)); \
+ m_base_type &v = *reinterpret_cast<m_base_type *>(r_base); \
+ OOB_TEST(p_index, m_max); \
+ v.m_set(p_index, PtrToArg<m_elem_type>::convert(member)); \
} \
static Variant::Type get_index_type() { \
return GetTypeInfo<m_elem_type>::VARIANT_TYPE; \
@@ -650,198 +650,198 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
static uint32_t get_index_usage() { \
return GetTypeInfo<m_elem_type>::get_class_info().usage; \
} \
- static uint64_t get_indexed_size(const Variant *base) { \
+ static uint64_t get_indexed_size(const Variant *p_base) { \
return m_max; \
} \
};
struct VariantIndexedSetGet_Array {
- static void get(const Variant *base, int64_t index, Variant *value, bool *oob) {
- int64_t size = VariantInternalAccessor<Array>::get(base).size();
- if (index < 0) {
- index += size;
+ static void get(const Variant *p_base, int64_t p_index, Variant *r_value, bool *r_oob) {
+ int64_t size = VariantInternalAccessor<Array>::get(p_base).size();
+ if (p_index < 0) {
+ p_index += size;
}
- if (index < 0 || index >= size) {
- *oob = true;
+ if (p_index < 0 || p_index >= size) {
+ *r_oob = true;
return;
}
- *value = (VariantInternalAccessor<Array>::get(base))[index];
- *oob = false;
+ *r_value = (VariantInternalAccessor<Array>::get(p_base))[p_index];
+ *r_oob = false;
}
- static void ptr_get(const void *base, int64_t index, void *member) {
+ static void ptr_get(const void *p_base, int64_t p_index, void *p_member) {
/* avoid ptrconvert for performance*/
- const Array &v = *reinterpret_cast<const Array *>(base);
- if (index < 0) {
- index += v.size();
+ const Array &v = *reinterpret_cast<const Array *>(p_base);
+ if (p_index < 0) {
+ p_index += v.size();
}
- OOB_TEST(index, v.size());
- PtrToArg<Variant>::encode(v[index], member);
+ OOB_TEST(p_index, v.size());
+ PtrToArg<Variant>::encode(v[p_index], p_member);
}
- static void set(Variant *base, int64_t index, const Variant *value, bool *valid, bool *oob) {
- if (VariantInternalAccessor<Array>::get(base).is_read_only()) {
- *valid = false;
- *oob = true;
+ static void set(Variant *r_base, int64_t p_index, const Variant *p_value, bool *r_valid, bool *r_oob) {
+ if (VariantInternalAccessor<Array>::get(r_base).is_read_only()) {
+ *r_valid = false;
+ *r_oob = true;
return;
}
- int64_t size = VariantInternalAccessor<Array>::get(base).size();
- if (index < 0) {
- index += size;
+ int64_t size = VariantInternalAccessor<Array>::get(r_base).size();
+ if (p_index < 0) {
+ p_index += size;
}
- if (index < 0 || index >= size) {
- *oob = true;
- *valid = false;
+ if (p_index < 0 || p_index >= size) {
+ *r_oob = true;
+ *r_valid = false;
return;
}
- VariantInternalAccessor<Array>::get(base).set(index, *value);
- *oob = false;
- *valid = true;
+ VariantInternalAccessor<Array>::get(r_base).set(p_index, *p_value);
+ *r_oob = false;
+ *r_valid = true;
}
- static void validated_set(Variant *base, int64_t index, const Variant *value, bool *oob) {
- if (VariantInternalAccessor<Array>::get(base).is_read_only()) {
- *oob = true;
+ static void validated_set(Variant *r_base, int64_t p_index, const Variant *p_value, bool *r_oob) {
+ if (VariantInternalAccessor<Array>::get(r_base).is_read_only()) {
+ *r_oob = true;
return;
}
- int64_t size = VariantInternalAccessor<Array>::get(base).size();
- if (index < 0) {
- index += size;
+ int64_t size = VariantInternalAccessor<Array>::get(r_base).size();
+ if (p_index < 0) {
+ p_index += size;
}
- if (index < 0 || index >= size) {
- *oob = true;
+ if (p_index < 0 || p_index >= size) {
+ *r_oob = true;
return;
}
- VariantInternalAccessor<Array>::get(base).set(index, *value);
- *oob = false;
+ VariantInternalAccessor<Array>::get(r_base).set(p_index, *p_value);
+ *r_oob = false;
}
- static void ptr_set(void *base, int64_t index, const void *member) {
+ static void ptr_set(void *r_base, int64_t p_index, const void *p_member) {
/* avoid ptrconvert for performance*/
- Array &v = *reinterpret_cast<Array *>(base);
- if (index < 0) {
- index += v.size();
+ Array &v = *reinterpret_cast<Array *>(r_base);
+ if (p_index < 0) {
+ p_index += v.size();
}
- OOB_TEST(index, v.size());
- v.set(index, PtrToArg<Variant>::convert(member));
+ OOB_TEST(p_index, v.size());
+ v.set(p_index, PtrToArg<Variant>::convert(p_member));
}
static Variant::Type get_index_type() { return Variant::NIL; }
static uint32_t get_index_usage() { return PROPERTY_USAGE_NIL_IS_VARIANT; }
- static uint64_t get_indexed_size(const Variant *base) { return 0; }
+ static uint64_t get_indexed_size(const Variant *p_base) { return 0; }
};
struct VariantIndexedSetGet_Dictionary {
- static void get(const Variant *base, int64_t index, Variant *value, bool *oob) {
- const Variant *ptr = VariantInternalAccessor<Dictionary>::get(base).getptr(index);
+ static void get(const Variant *p_base, int64_t p_index, Variant *r_value, bool *r_oob) {
+ const Variant *ptr = VariantInternalAccessor<Dictionary>::get(p_base).getptr(p_index);
if (!ptr) {
- *oob = true;
+ *r_oob = true;
return;
}
- *value = *ptr;
- *oob = false;
+ *r_value = *ptr;
+ *r_oob = false;
}
- static void ptr_get(const void *base, int64_t index, void *member) {
+ static void ptr_get(const void *p_base, int64_t p_index, void *p_member) {
// Avoid ptrconvert for performance.
- const Dictionary &v = *reinterpret_cast<const Dictionary *>(base);
- const Variant *ptr = v.getptr(index);
+ const Dictionary &v = *reinterpret_cast<const Dictionary *>(p_base);
+ const Variant *ptr = v.getptr(p_index);
NULL_TEST(ptr);
- PtrToArg<Variant>::encode(*ptr, member);
+ PtrToArg<Variant>::encode(*ptr, p_member);
}
- static void set(Variant *base, int64_t index, const Variant *value, bool *valid, bool *oob) {
- *valid = VariantInternalAccessor<Dictionary>::get(base).set(index, *value);
- *oob = VariantInternalAccessor<Dictionary>::get(base).is_read_only();
+ static void set(Variant *r_base, int64_t p_index, const Variant *p_value, bool *r_valid, bool *r_oob) {
+ *r_valid = VariantInternalAccessor<Dictionary>::get(r_base).set(p_index, *p_value);
+ *r_oob = VariantInternalAccessor<Dictionary>::get(r_base).is_read_only();
}
- static void validated_set(Variant *base, int64_t index, const Variant *value, bool *oob) {
- VariantInternalAccessor<Dictionary>::get(base).set(index, *value);
- *oob = VariantInternalAccessor<Dictionary>::get(base).is_read_only();
+ static void validated_set(Variant *r_base, int64_t p_index, const Variant *p_value, bool *r_oob) {
+ VariantInternalAccessor<Dictionary>::get(r_base).set(p_index, *p_value);
+ *r_oob = VariantInternalAccessor<Dictionary>::get(r_base).is_read_only();
}
- static void ptr_set(void *base, int64_t index, const void *member) {
- Dictionary &v = *reinterpret_cast<Dictionary *>(base);
- v.set(index, PtrToArg<Variant>::convert(member));
+ static void ptr_set(void *r_base, int64_t p_index, const void *p_member) {
+ Dictionary &v = *reinterpret_cast<Dictionary *>(r_base);
+ v.set(p_index, PtrToArg<Variant>::convert(p_member));
}
static Variant::Type get_index_type() { return Variant::NIL; }
static uint32_t get_index_usage() { return PROPERTY_USAGE_DEFAULT; }
- static uint64_t get_indexed_size(const Variant *base) { return VariantInternalAccessor<Dictionary>::get(base).size(); }
+ static uint64_t get_indexed_size(const Variant *r_base) { return VariantInternalAccessor<Dictionary>::get(r_base).size(); }
};
struct VariantIndexedSetGet_String {
- static void get(const Variant *base, int64_t index, Variant *value, bool *oob) {
- int64_t length = VariantInternalAccessor<String>::get(base).length();
- if (index < 0) {
- index += length;
+ static void get(const Variant *p_base, int64_t p_index, Variant *r_value, bool *r_oob) {
+ int64_t length = VariantInternalAccessor<String>::get(p_base).length();
+ if (p_index < 0) {
+ p_index += length;
}
- if (index < 0 || index >= length) {
- *oob = true;
+ if (p_index < 0 || p_index >= length) {
+ *r_oob = true;
return;
}
- *value = String::chr((VariantInternalAccessor<String>::get(base))[index]);
- *oob = false;
+ *r_value = String::chr((VariantInternalAccessor<String>::get(p_base))[p_index]);
+ *r_oob = false;
}
- static void ptr_get(const void *base, int64_t index, void *member) {
+ static void ptr_get(const void *p_base, int64_t p_index, void *p_member) {
/* avoid ptrconvert for performance*/
- const String &v = *reinterpret_cast<const String *>(base);
- if (index < 0) {
- index += v.length();
+ const String &v = *reinterpret_cast<const String *>(p_base);
+ if (p_index < 0) {
+ p_index += v.length();
}
- OOB_TEST(index, v.length());
- PtrToArg<String>::encode(String::chr(v[index]), member);
+ OOB_TEST(p_index, v.length());
+ PtrToArg<String>::encode(String::chr(v[p_index]), p_member);
}
- static void set(Variant *base, int64_t index, const Variant *value, bool *valid, bool *oob) {
- if (value->get_type() != Variant::STRING) {
- *oob = false;
- *valid = false;
+ static void set(Variant *r_base, int64_t p_index, const Variant *p_value, bool *r_valid, bool *r_oob) {
+ if (p_value->get_type() != Variant::STRING) {
+ *r_oob = false;
+ *r_valid = false;
return;
}
- int64_t length = VariantInternalAccessor<String>::get(base).length();
- if (index < 0) {
- index += length;
+ int64_t length = VariantInternalAccessor<String>::get(r_base).length();
+ if (p_index < 0) {
+ p_index += length;
}
- if (index < 0 || index >= length) {
- *oob = true;
- *valid = false;
+ if (p_index < 0 || p_index >= length) {
+ *r_oob = true;
+ *r_valid = false;
return;
}
- String *b = &VariantInternalAccessor<String>::get(base);
- const String *v = VariantInternal::get_string(value);
+ String *b = &VariantInternalAccessor<String>::get(r_base);
+ const String *v = VariantInternal::get_string(p_value);
if (v->length() == 0) {
- b->remove_at(index);
+ b->remove_at(p_index);
} else {
- b->set(index, v->get(0));
+ b->set(p_index, v->get(0));
}
- *oob = false;
- *valid = true;
+ *r_oob = false;
+ *r_valid = true;
}
- static void validated_set(Variant *base, int64_t index, const Variant *value, bool *oob) {
- int64_t length = VariantInternalAccessor<String>::get(base).length();
- if (index < 0) {
- index += length;
+ static void validated_set(Variant *r_base, int64_t p_index, const Variant *p_value, bool *r_oob) {
+ int64_t length = VariantInternalAccessor<String>::get(r_base).length();
+ if (p_index < 0) {
+ p_index += length;
}
- if (index < 0 || index >= length) {
- *oob = true;
+ if (p_index < 0 || p_index >= length) {
+ *r_oob = true;
return;
}
- String *b = &VariantInternalAccessor<String>::get(base);
- const String *v = VariantInternal::get_string(value);
+ String *b = &VariantInternalAccessor<String>::get(r_base);
+ const String *v = VariantInternal::get_string(p_value);
if (v->length() == 0) {
- b->remove_at(index);
+ b->remove_at(p_index);
} else {
- b->set(index, v->get(0));
+ b->set(p_index, v->get(0));
}
- *oob = false;
+ *r_oob = false;
}
- static void ptr_set(void *base, int64_t index, const void *member) {
+ static void ptr_set(void *r_base, int64_t p_index, const void *p_member) {
/* avoid ptrconvert for performance*/
- String &v = *reinterpret_cast<String *>(base);
- if (index < 0) {
- index += v.length();
+ String &v = *reinterpret_cast<String *>(r_base);
+ if (p_index < 0) {
+ p_index += v.length();
}
- OOB_TEST(index, v.length());
- const String &m = *reinterpret_cast<const String *>(member);
+ OOB_TEST(p_index, v.length());
+ const String &m = *reinterpret_cast<const String *>(p_member);
if (unlikely(m.length() == 0)) {
- v.remove_at(index);
+ v.remove_at(p_index);
} else {
- v.set(index, m.unicode_at(0));
+ v.set(p_index, m.unicode_at(0));
}
}
static Variant::Type get_index_type() { return Variant::STRING; }
static uint32_t get_index_usage() { return PROPERTY_USAGE_DEFAULT; }
- static uint64_t get_indexed_size(const Variant *base) { return VariantInternal::get_string(base)->length(); }
+ static uint64_t get_indexed_size(const Variant *p_base) { return VariantInternal::get_string(p_base)->length(); }
};
INDEXED_SETGET_STRUCT_BUILTIN_NUMERIC(Vector2, double, real_t, 2)
@@ -869,8 +869,8 @@ INDEXED_SETGET_STRUCT_TYPED(PackedColorArray, Color)
INDEXED_SETGET_STRUCT_TYPED(PackedVector4Array, Vector4)
struct VariantIndexedSetterGetterInfo {
- void (*setter)(Variant *base, int64_t index, const Variant *value, bool *valid, bool *oob) = nullptr;
- void (*getter)(const Variant *base, int64_t index, Variant *value, bool *oob) = nullptr;
+ void (*setter)(Variant *r_base, int64_t p_index, const Variant *p_value, bool *r_valid, bool *r_oob) = nullptr;
+ void (*getter)(const Variant *p_base, int64_t p_index, Variant *r_value, bool *r_oob) = nullptr;
Variant::ValidatedIndexedSetter validated_setter = nullptr;
Variant::ValidatedIndexedGetter validated_getter = nullptr;
@@ -878,7 +878,7 @@ struct VariantIndexedSetterGetterInfo {
Variant::PTRIndexedSetter ptr_setter = nullptr;
Variant::PTRIndexedGetter ptr_getter = nullptr;
- uint64_t (*get_indexed_size)(const Variant *base) = nullptr;
+ uint64_t (*get_indexed_size)(const Variant *p_base) = nullptr;
Variant::Type index_type = Variant::NIL;
uint32_t index_usage = PROPERTY_USAGE_DEFAULT;
@@ -1004,89 +1004,89 @@ uint64_t Variant::get_indexed_size() const {
}
struct VariantKeyedSetGetDictionary {
- static void get(const Variant *base, const Variant *key, Variant *value, bool *r_valid) {
- const Variant *ptr = VariantInternalAccessor<Dictionary>::get(base).getptr(*key);
+ static void get(const Variant *p_base, const Variant *p_key, Variant *r_value, bool *r_valid) {
+ const Variant *ptr = VariantInternalAccessor<Dictionary>::get(p_base).getptr(*p_key);
if (!ptr) {
*r_valid = false;
return;
}
- *value = *ptr;
+ *r_value = *ptr;
*r_valid = true;
}
- static void ptr_get(const void *base, const void *key, void *value) {
+ static void ptr_get(const void *p_base, const void *p_key, void *r_value) {
/* avoid ptrconvert for performance*/
- const Dictionary &v = *reinterpret_cast<const Dictionary *>(base);
- const Variant *ptr = v.getptr(PtrToArg<Variant>::convert(key));
+ const Dictionary &v = *reinterpret_cast<const Dictionary *>(p_base);
+ const Variant *ptr = v.getptr(PtrToArg<Variant>::convert(p_key));
NULL_TEST(ptr);
- PtrToArg<Variant>::encode(*ptr, value);
+ PtrToArg<Variant>::encode(*ptr, r_value);
}
- static void set(Variant *base, const Variant *key, const Variant *value, bool *r_valid) {
- *r_valid = VariantInternalAccessor<Dictionary>::get(base).set(*key, *value);
+ static void set(Variant *r_base, const Variant *p_key, const Variant *p_value, bool *r_valid) {
+ *r_valid = VariantInternalAccessor<Dictionary>::get(r_base).set(*p_key, *p_value);
}
- static void ptr_set(void *base, const void *key, const void *value) {
- Dictionary &v = *reinterpret_cast<Dictionary *>(base);
- v.set(PtrToArg<Variant>::convert(key), PtrToArg<Variant>::convert(value));
+ static void ptr_set(void *r_base, const void *p_key, const void *p_value) {
+ Dictionary &v = *reinterpret_cast<Dictionary *>(r_base);
+ v.set(PtrToArg<Variant>::convert(p_key), PtrToArg<Variant>::convert(p_value));
}
- static bool has(const Variant *base, const Variant *key, bool *r_valid) {
+ static bool has(const Variant *p_base, const Variant *p_key, bool *r_valid) {
*r_valid = true;
- return VariantInternalAccessor<Dictionary>::get(base).has(*key);
+ return VariantInternalAccessor<Dictionary>::get(p_base).has(*p_key);
}
- static uint32_t ptr_has(const void *base, const void *key) {
+ static uint32_t ptr_has(const void *p_base, const void *p_key) {
/* avoid ptrconvert for performance*/
- const Dictionary &v = *reinterpret_cast<const Dictionary *>(base);
- return v.has(PtrToArg<Variant>::convert(key));
+ const Dictionary &v = *reinterpret_cast<const Dictionary *>(p_base);
+ return v.has(PtrToArg<Variant>::convert(p_key));
}
};
struct VariantKeyedSetGetObject {
- static void get(const Variant *base, const Variant *key, Variant *value, bool *r_valid) {
- Object *obj = base->get_validated_object();
+ static void get(const Variant *p_base, const Variant *p_key, Variant *r_value, bool *r_valid) {
+ Object *obj = p_base->get_validated_object();
if (!obj) {
*r_valid = false;
- *value = Variant();
+ *r_value = Variant();
return;
}
- *value = obj->getvar(*key, r_valid);
+ *r_value = obj->getvar(*p_key, r_valid);
}
- static void ptr_get(const void *base, const void *key, void *value) {
- const Object *obj = PtrToArg<Object *>::convert(base);
+ static void ptr_get(const void *p_base, const void *p_key, void *r_value) {
+ const Object *obj = PtrToArg<Object *>::convert(p_base);
NULL_TEST(obj);
- Variant v = obj->getvar(PtrToArg<Variant>::convert(key));
- PtrToArg<Variant>::encode(v, value);
+ Variant v = obj->getvar(PtrToArg<Variant>::convert(p_key));
+ PtrToArg<Variant>::encode(v, r_value);
}
- static void set(Variant *base, const Variant *key, const Variant *value, bool *r_valid) {
- Object *obj = base->get_validated_object();
+ static void set(Variant *r_base, const Variant *p_key, const Variant *p_value, bool *r_valid) {
+ Object *obj = r_base->get_validated_object();
if (!obj) {
*r_valid = false;
return;
}
- obj->setvar(*key, *value, r_valid);
+ obj->setvar(*p_key, *p_value, r_valid);
}
- static void ptr_set(void *base, const void *key, const void *value) {
- Object *obj = PtrToArg<Object *>::convert(base);
+ static void ptr_set(void *r_base, const void *p_key, const void *p_value) {
+ Object *obj = PtrToArg<Object *>::convert(r_base);
NULL_TEST(obj);
- obj->setvar(PtrToArg<Variant>::convert(key), PtrToArg<Variant>::convert(value));
+ obj->setvar(PtrToArg<Variant>::convert(p_key), PtrToArg<Variant>::convert(p_value));
}
- static bool has(const Variant *base, const Variant *key, bool *r_valid) {
- Object *obj = base->get_validated_object();
+ static bool has(const Variant *p_base, const Variant *p_key, bool *r_valid) {
+ Object *obj = p_base->get_validated_object();
if (!obj) {
*r_valid = false;
return false;
}
*r_valid = true;
bool exists;
- obj->getvar(*key, &exists);
+ obj->getvar(*p_key, &exists);
return exists;
}
- static uint32_t ptr_has(const void *base, const void *key) {
- const Object *obj = PtrToArg<Object *>::convert(base);
+ static uint32_t ptr_has(const void *p_base, const void *p_key) {
+ const Object *obj = PtrToArg<Object *>::convert(p_base);
ERR_FAIL_NULL_V(obj, false);
bool valid;
- obj->getvar(PtrToArg<Variant>::convert(key), &valid);
+ obj->getvar(PtrToArg<Variant>::convert(p_key), &valid);
return valid;
}
};
@@ -1182,47 +1182,47 @@ bool Variant::has_key(const Variant &p_key, bool &r_valid) const {
}
}
-void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid, VariantSetError *err_code) {
- if (err_code) {
- *err_code = VariantSetError::SET_OK;
+void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid, VariantSetError *r_err_code) {
+ if (r_err_code) {
+ *r_err_code = VariantSetError::SET_OK;
}
if (type == DICTIONARY || type == OBJECT) {
bool valid;
set_keyed(p_index, p_value, valid);
if (r_valid) {
*r_valid = valid;
- if (!valid && err_code) {
- *err_code = VariantSetError::SET_KEYED_ERR;
+ if (!valid && r_err_code) {
+ *r_err_code = VariantSetError::SET_KEYED_ERR;
}
}
} else {
bool valid = false;
if (p_index.get_type() == STRING_NAME) {
set_named(VariantInternalAccessor<StringName>::get(&p_index), p_value, valid);
- if (!valid && err_code) {
- *err_code = VariantSetError::SET_NAMED_ERR;
+ if (!valid && r_err_code) {
+ *r_err_code = VariantSetError::SET_NAMED_ERR;
}
} else if (p_index.get_type() == INT) {
bool obb;
set_indexed(VariantInternalAccessor<int64_t>::get(&p_index), p_value, valid, obb);
if (obb) {
valid = false;
- if (err_code) {
- *err_code = VariantSetError::SET_INDEXED_ERR;
+ if (r_err_code) {
+ *r_err_code = VariantSetError::SET_INDEXED_ERR;
}
}
} else if (p_index.get_type() == STRING) { // less efficient version of named
set_named(VariantInternalAccessor<String>::get(&p_index), p_value, valid);
- if (!valid && err_code) {
- *err_code = VariantSetError::SET_NAMED_ERR;
+ if (!valid && r_err_code) {
+ *r_err_code = VariantSetError::SET_NAMED_ERR;
}
} else if (p_index.get_type() == FLOAT) { // less efficient version of indexed
bool obb;
set_indexed(VariantInternalAccessor<double>::get(&p_index), p_value, valid, obb);
if (obb) {
valid = false;
- if (err_code) {
- *err_code = VariantSetError::SET_INDEXED_ERR;
+ if (r_err_code) {
+ *r_err_code = VariantSetError::SET_INDEXED_ERR;
}
}
}
@@ -1232,9 +1232,9 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid,
}
}
-Variant Variant::get(const Variant &p_index, bool *r_valid, VariantGetError *err_code) const {
- if (err_code) {
- *err_code = VariantGetError::GET_OK;
+Variant Variant::get(const Variant &p_index, bool *r_valid, VariantGetError *r_err_code) const {
+ if (r_err_code) {
+ *r_err_code = VariantGetError::GET_OK;
}
Variant ret;
if (type == DICTIONARY || type == OBJECT) {
@@ -1242,38 +1242,38 @@ Variant Variant::get(const Variant &p_index, bool *r_valid, VariantGetError *err
ret = get_keyed(p_index, valid);
if (r_valid) {
*r_valid = valid;
- if (!valid && err_code) {
- *err_code = VariantGetError::GET_KEYED_ERR;
+ if (!valid && r_err_code) {
+ *r_err_code = VariantGetError::GET_KEYED_ERR;
}
}
} else {
bool valid = false;
if (p_index.get_type() == STRING_NAME) {
ret = get_named(VariantInternalAccessor<StringName>::get(&p_index), valid);
- if (!valid && err_code) {
- *err_code = VariantGetError::GET_NAMED_ERR;
+ if (!valid && r_err_code) {
+ *r_err_code = VariantGetError::GET_NAMED_ERR;
}
} else if (p_index.get_type() == INT) {
bool obb;
ret = get_indexed(VariantInternalAccessor<int64_t>::get(&p_index), valid, obb);
if (obb) {
valid = false;
- if (err_code) {
- *err_code = VariantGetError::GET_INDEXED_ERR;
+ if (r_err_code) {
+ *r_err_code = VariantGetError::GET_INDEXED_ERR;
}
}
} else if (p_index.get_type() == STRING) { // less efficient version of named
ret = get_named(VariantInternalAccessor<String>::get(&p_index), valid);
- if (!valid && err_code) {
- *err_code = VariantGetError::GET_NAMED_ERR;
+ if (!valid && r_err_code) {
+ *r_err_code = VariantGetError::GET_NAMED_ERR;
}
} else if (p_index.get_type() == FLOAT) { // less efficient version of indexed
bool obb;
ret = get_indexed(VariantInternalAccessor<double>::get(&p_index), valid, obb);
if (obb) {
valid = false;
- if (err_code) {
- *err_code = VariantGetError::GET_INDEXED_ERR;
+ if (r_err_code) {
+ *r_err_code = VariantGetError::GET_INDEXED_ERR;
}
}
}
@@ -1310,8 +1310,8 @@ void Variant::get_property_list(List<PropertyInfo> *p_list) const {
}
}
-bool Variant::iter_init(Variant &r_iter, bool &valid) const {
- valid = true;
+bool Variant::iter_init(Variant &r_iter, bool &r_valid) const {
+ r_valid = true;
switch (type) {
case INT: {
r_iter = 0;
@@ -1367,14 +1367,14 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const {
} break;
case OBJECT: {
if (!_get_obj().obj) {
- valid = false;
+ r_valid = false;
return false;
}
#ifdef DEBUG_ENABLED
if (EngineDebugger::is_active() && !_get_obj().id.is_ref_counted() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
- valid = false;
+ r_valid = false;
return false;
}
@@ -1387,7 +1387,7 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const {
Variant ret = _get_obj().obj->callp(CoreStringName(_iter_init), refp, 1, ce);
if (ref.size() != 1 || ce.error != Callable::CallError::CALL_OK) {
- valid = false;
+ r_valid = false;
return false;
}
@@ -1512,12 +1512,12 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const {
}
}
- valid = false;
+ r_valid = false;
return false;
}
-bool Variant::iter_next(Variant &r_iter, bool &valid) const {
- valid = true;
+bool Variant::iter_next(Variant &r_iter, bool &r_valid) const {
+ r_valid = true;
switch (type) {
case INT: {
int64_t idx = r_iter;
@@ -1601,14 +1601,14 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const {
} break;
case OBJECT: {
if (!_get_obj().obj) {
- valid = false;
+ r_valid = false;
return false;
}
#ifdef DEBUG_ENABLED
if (EngineDebugger::is_active() && !_get_obj().id.is_ref_counted() && ObjectDB::get_instance(_get_obj().id) == nullptr) {
- valid = false;
+ r_valid = false;
return false;
}
@@ -1621,7 +1621,7 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const {
Variant ret = _get_obj().obj->callp(CoreStringName(_iter_next), refp, 1, ce);
if (ref.size() != 1 || ce.error != Callable::CallError::CALL_OK) {
- valid = false;
+ r_valid = false;
return false;
}
@@ -1770,7 +1770,7 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const {
}
}
- valid = false;
+ r_valid = false;
return false;
}
@@ -1979,25 +1979,25 @@ Variant Variant::duplicate_deep(ResourceDeepDuplicateMode p_deep_subresources_mo
return recursive_duplicate(true, p_deep_subresources_mode, 0);
}
-Variant Variant::recursive_duplicate(bool p_deep, ResourceDeepDuplicateMode p_deep_subresources_mode, int recursion_count) const {
+Variant Variant::recursive_duplicate(bool p_deep, ResourceDeepDuplicateMode p_deep_subresources_mode, int p_recursion_count) const {
switch (type) {
case OBJECT: {
// If the root target of duplicate() is a Resource, we can't early-reject because that
// resource itself must be duplicated, much as if Resource::duplicate() had been called.
- if (p_deep_subresources_mode == RESOURCE_DEEP_DUPLICATE_NONE && recursion_count > 0) {
+ if (p_deep_subresources_mode == RESOURCE_DEEP_DUPLICATE_NONE && p_recursion_count > 0) {
return *this;
}
Resource *res = Object::cast_to<Resource>(_get_obj().obj);
if (res) {
- return res->_duplicate_from_variant(p_deep, p_deep_subresources_mode, recursion_count);
+ return res->_duplicate_from_variant(p_deep, p_deep_subresources_mode, p_recursion_count);
} else {
return *this;
}
} break;
case DICTIONARY:
- return operator Dictionary().recursive_duplicate(p_deep, p_deep_subresources_mode, recursion_count);
+ return operator Dictionary().recursive_duplicate(p_deep, p_deep_subresources_mode, p_recursion_count);
case ARRAY:
- return operator Array().recursive_duplicate(p_deep, p_deep_subresources_mode, recursion_count);
+ return operator Array().recursive_duplicate(p_deep, p_deep_subresources_mode, p_recursion_count);
case PACKED_BYTE_ARRAY:
return operator Vector<uint8_t>().duplicate();
case PACKED_INT32_ARRAY:
diff --git a/core/variant/variant_setget.h b/core/variant/variant_setget.h
index 7c9017b2215..6e03de9197c 100644
--- a/core/variant/variant_setget.h
+++ b/core/variant/variant_setget.h
@@ -38,31 +38,31 @@
#define SETGET_STRUCT(m_base_type, m_member_type, m_member) \
struct VariantSetGet_##m_base_type##_##m_member { \
- static void get(const Variant *base, Variant *member) { \
- VariantTypeAdjust<m_member_type>::adjust(member); \
- VariantInternalAccessor<m_member_type>::get(member) = VariantInternalAccessor<m_base_type>::get(base).m_member; \
+ static void get(const Variant *p_base, Variant *r_member) { \
+ VariantTypeAdjust<m_member_type>::adjust(r_member); \
+ VariantInternalAccessor<m_member_type>::get(r_member) = VariantInternalAccessor<m_base_type>::get(p_base).m_member; \
} \
- static inline void validated_get(const Variant *base, Variant *member) { \
- VariantInternalAccessor<m_member_type>::get(member) = VariantInternalAccessor<m_base_type>::get(base).m_member; \
+ static inline void validated_get(const Variant *p_base, Variant *r_member) { \
+ VariantInternalAccessor<m_member_type>::get(r_member) = VariantInternalAccessor<m_base_type>::get(p_base).m_member; \
} \
- static void ptr_get(const void *base, void *member) { \
- PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(base).m_member, member); \
+ static void ptr_get(const void *p_base, void *r_member) { \
+ PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(p_base).m_member, r_member); \
} \
- static void set(Variant *base, const Variant *value, bool &valid) { \
- if (value->get_type() == GetTypeInfo<m_member_type>::VARIANT_TYPE) { \
- VariantInternalAccessor<m_base_type>::get(base).m_member = VariantInternalAccessor<m_member_type>::get(value); \
- valid = true; \
+ static void set(Variant *r_base, const Variant *p_value, bool &r_valid) { \
+ if (p_value->get_type() == GetTypeInfo<m_member_type>::VARIANT_TYPE) { \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_member = VariantInternalAccessor<m_member_type>::get(p_value); \
+ r_valid = true; \
} else { \
- valid = false; \
+ r_valid = false; \
} \
} \
- static inline void validated_set(Variant *base, const Variant *value) { \
- VariantInternalAccessor<m_base_type>::get(base).m_member = VariantInternalAccessor<m_member_type>::get(value); \
+ static inline void validated_set(Variant *r_base, const Variant *p_value) { \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_member = VariantInternalAccessor<m_member_type>::get(p_value); \
} \
- static void ptr_set(void *base, const void *member) { \
- m_base_type b = PtrToArg<m_base_type>::convert(base); \
- b.m_member = PtrToArg<m_member_type>::convert(member); \
- PtrToArg<m_base_type>::encode(b, base); \
+ static void ptr_set(void *r_base, const void *p_member) { \
+ m_base_type b = PtrToArg<m_base_type>::convert(r_base); \
+ b.m_member = PtrToArg<m_member_type>::convert(p_member); \
+ PtrToArg<m_base_type>::encode(b, r_base); \
} \
static Variant::Type get_type() { \
return GetTypeInfo<m_member_type>::VARIANT_TYPE; \
@@ -71,34 +71,34 @@
#define SETGET_NUMBER_STRUCT(m_base_type, m_member_type, m_member) \
struct VariantSetGet_##m_base_type##_##m_member { \
- static void get(const Variant *base, Variant *member) { \
- VariantTypeAdjust<m_member_type>::adjust(member); \
- VariantInternalAccessor<m_member_type>::get(member) = VariantInternalAccessor<m_base_type>::get(base).m_member; \
- } \
- static inline void validated_get(const Variant *base, Variant *member) { \
- VariantInternalAccessor<m_member_type>::get(member) = VariantInternalAccessor<m_base_type>::get(base).m_member; \
- } \
- static void ptr_get(const void *base, void *member) { \
- PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(base).m_member, member); \
- } \
- static void set(Variant *base, const Variant *value, bool &valid) { \
- if (value->get_type() == Variant::FLOAT) { \
- VariantInternalAccessor<m_base_type>::get(base).m_member = VariantInternalAccessor<double>::get(value); \
- valid = true; \
- } else if (value->get_type() == Variant::INT) { \
- VariantInternalAccessor<m_base_type>::get(base).m_member = VariantInternalAccessor<int64_t>::get(value); \
- valid = true; \
+ static void get(const Variant *p_base, Variant *r_member) { \
+ VariantTypeAdjust<m_member_type>::adjust(r_member); \
+ VariantInternalAccessor<m_member_type>::get(r_member) = VariantInternalAccessor<m_base_type>::get(p_base).m_member; \
+ } \
+ static inline void validated_get(const Variant *p_base, Variant *r_member) { \
+ VariantInternalAccessor<m_member_type>::get(r_member) = VariantInternalAccessor<m_base_type>::get(p_base).m_member; \
+ } \
+ static void ptr_get(const void *p_base, void *r_member) { \
+ PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(p_base).m_member, r_member); \
+ } \
+ static void set(Variant *r_base, const Variant *p_value, bool &r_valid) { \
+ if (p_value->get_type() == Variant::FLOAT) { \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_member = VariantInternalAccessor<double>::get(p_value); \
+ r_valid = true; \
+ } else if (p_value->get_type() == Variant::INT) { \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_member = VariantInternalAccessor<int64_t>::get(p_value); \
+ r_valid = true; \
} else { \
- valid = false; \
+ r_valid = false; \
} \
} \
- static inline void validated_set(Variant *base, const Variant *value) { \
- VariantInternalAccessor<m_base_type>::get(base).m_member = VariantInternalAccessor<m_member_type>::get(value); \
+ static inline void validated_set(Variant *r_base, const Variant *p_value) { \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_member = VariantInternalAccessor<m_member_type>::get(p_value); \
} \
- static void ptr_set(void *base, const void *member) { \
- m_base_type b = PtrToArg<m_base_type>::convert(base); \
- b.m_member = PtrToArg<m_member_type>::convert(member); \
- PtrToArg<m_base_type>::encode(b, base); \
+ static void ptr_set(void *r_base, const void *p_member) { \
+ m_base_type b = PtrToArg<m_base_type>::convert(r_base); \
+ b.m_member = PtrToArg<m_member_type>::convert(p_member); \
+ PtrToArg<m_base_type>::encode(b, r_base); \
} \
static Variant::Type get_type() { \
return GetTypeInfo<m_member_type>::VARIANT_TYPE; \
@@ -107,31 +107,31 @@
#define SETGET_STRUCT_CUSTOM(m_base_type, m_member_type, m_member, m_custom) \
struct VariantSetGet_##m_base_type##_##m_member { \
- static void get(const Variant *base, Variant *member) { \
- VariantTypeAdjust<m_member_type>::adjust(member); \
- VariantInternalAccessor<m_member_type>::get(member) = VariantInternalAccessor<m_base_type>::get(base).m_custom; \
+ static void get(const Variant *p_base, Variant *r_member) { \
+ VariantTypeAdjust<m_member_type>::adjust(r_member); \
+ VariantInternalAccessor<m_member_type>::get(r_member) = VariantInternalAccessor<m_base_type>::get(p_base).m_custom; \
} \
- static inline void validated_get(const Variant *base, Variant *member) { \
- VariantInternalAccessor<m_member_type>::get(member) = VariantInternalAccessor<m_base_type>::get(base).m_custom; \
+ static inline void validated_get(const Variant *p_base, Variant *r_member) { \
+ VariantInternalAccessor<m_member_type>::get(r_member) = VariantInternalAccessor<m_base_type>::get(p_base).m_custom; \
} \
- static void ptr_get(const void *base, void *member) { \
- PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(base).m_custom, member); \
+ static void ptr_get(const void *p_base, void *r_member) { \
+ PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(p_base).m_custom, r_member); \
} \
- static void set(Variant *base, const Variant *value, bool &valid) { \
- if (value->get_type() == GetTypeInfo<m_member_type>::VARIANT_TYPE) { \
- VariantInternalAccessor<m_base_type>::get(base).m_custom = VariantInternalAccessor<m_member_type>::get(value); \
- valid = true; \
+ static void set(Variant *r_base, const Variant *p_value, bool &r_valid) { \
+ if (p_value->get_type() == GetTypeInfo<m_member_type>::VARIANT_TYPE) { \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_custom = VariantInternalAccessor<m_member_type>::get(p_value); \
+ r_valid = true; \
} else { \
- valid = false; \
+ r_valid = false; \
} \
} \
- static inline void validated_set(Variant *base, const Variant *value) { \
- VariantInternalAccessor<m_base_type>::get(base).m_custom = VariantInternalAccessor<m_member_type>::get(value); \
+ static inline void validated_set(Variant *r_base, const Variant *p_value) { \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_custom = VariantInternalAccessor<m_member_type>::get(p_value); \
} \
- static void ptr_set(void *base, const void *member) { \
- m_base_type b = PtrToArg<m_base_type>::convert(base); \
- b.m_custom = PtrToArg<m_member_type>::convert(member); \
- PtrToArg<m_base_type>::encode(b, base); \
+ static void ptr_set(void *r_base, const void *p_member) { \
+ m_base_type b = PtrToArg<m_base_type>::convert(r_base); \
+ b.m_custom = PtrToArg<m_member_type>::convert(p_member); \
+ PtrToArg<m_base_type>::encode(b, r_base); \
} \
static Variant::Type get_type() { \
return GetTypeInfo<m_member_type>::VARIANT_TYPE; \
@@ -140,34 +140,34 @@
#define SETGET_NUMBER_STRUCT_CUSTOM(m_base_type, m_member_type, m_member, m_custom) \
struct VariantSetGet_##m_base_type##_##m_member { \
- static void get(const Variant *base, Variant *member) { \
- VariantTypeAdjust<m_member_type>::adjust(member); \
- VariantInternalAccessor<m_member_type>::get(member) = VariantInternalAccessor<m_base_type>::get(base).m_custom; \
- } \
- static inline void validated_get(const Variant *base, Variant *member) { \
- VariantInternalAccessor<m_member_type>::get(member) = VariantInternalAccessor<m_base_type>::get(base).m_custom; \
- } \
- static void ptr_get(const void *base, void *member) { \
- PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(base).m_custom, member); \
- } \
- static void set(Variant *base, const Variant *value, bool &valid) { \
- if (value->get_type() == Variant::FLOAT) { \
- VariantInternalAccessor<m_base_type>::get(base).m_custom = VariantInternalAccessor<double>::get(value); \
- valid = true; \
- } else if (value->get_type() == Variant::INT) { \
- VariantInternalAccessor<m_base_type>::get(base).m_custom = VariantInternalAccessor<int64_t>::get(value); \
- valid = true; \
+ static void get(const Variant *p_base, Variant *r_member) { \
+ VariantTypeAdjust<m_member_type>::adjust(r_member); \
+ VariantInternalAccessor<m_member_type>::get(r_member) = VariantInternalAccessor<m_base_type>::get(p_base).m_custom; \
+ } \
+ static inline void validated_get(const Variant *p_base, Variant *r_member) { \
+ VariantInternalAccessor<m_member_type>::get(r_member) = VariantInternalAccessor<m_base_type>::get(p_base).m_custom; \
+ } \
+ static void ptr_get(const void *p_base, void *r_member) { \
+ PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(p_base).m_custom, r_member); \
+ } \
+ static void set(Variant *r_base, const Variant *p_value, bool &r_valid) { \
+ if (p_value->get_type() == Variant::FLOAT) { \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_custom = VariantInternalAccessor<double>::get(p_value); \
+ r_valid = true; \
+ } else if (p_value->get_type() == Variant::INT) { \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_custom = VariantInternalAccessor<int64_t>::get(p_value); \
+ r_valid = true; \
} else { \
- valid = false; \
+ r_valid = false; \
} \
} \
- static inline void validated_set(Variant *base, const Variant *value) { \
- VariantInternalAccessor<m_base_type>::get(base).m_custom = VariantInternalAccessor<m_member_type>::get(value); \
+ static inline void validated_set(Variant *r_base, const Variant *p_value) { \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_custom = VariantInternalAccessor<m_member_type>::get(p_value); \
} \
- static void ptr_set(void *base, const void *member) { \
- m_base_type b = PtrToArg<m_base_type>::convert(base); \
- b.m_custom = PtrToArg<m_member_type>::convert(member); \
- PtrToArg<m_base_type>::encode(b, base); \
+ static void ptr_set(void *r_base, const void *p_member) { \
+ m_base_type b = PtrToArg<m_base_type>::convert(r_base); \
+ b.m_custom = PtrToArg<m_member_type>::convert(p_member); \
+ PtrToArg<m_base_type>::encode(b, r_base); \
} \
static Variant::Type get_type() { \
return GetTypeInfo<m_member_type>::VARIANT_TYPE; \
@@ -176,31 +176,31 @@
#define SETGET_STRUCT_FUNC(m_base_type, m_member_type, m_member, m_setter, m_getter) \
struct VariantSetGet_##m_base_type##_##m_member { \
- static void get(const Variant *base, Variant *member) { \
- VariantTypeAdjust<m_member_type>::adjust(member); \
- VariantInternalAccessor<m_member_type>::get(member) = VariantInternalAccessor<m_base_type>::get(base).m_getter(); \
+ static void get(const Variant *p_base, Variant *r_member) { \
+ VariantTypeAdjust<m_member_type>::adjust(r_member); \
+ VariantInternalAccessor<m_member_type>::get(r_member) = VariantInternalAccessor<m_base_type>::get(p_base).m_getter(); \
} \
- static inline void validated_get(const Variant *base, Variant *member) { \
- VariantInternalAccessor<m_member_type>::get(member) = VariantInternalAccessor<m_base_type>::get(base).m_getter(); \
+ static inline void validated_get(const Variant *p_base, Variant *r_member) { \
+ VariantInternalAccessor<m_member_type>::get(r_member) = VariantInternalAccessor<m_base_type>::get(p_base).m_getter(); \
} \
- static void ptr_get(const void *base, void *member) { \
- PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(base).m_getter(), member); \
+ static void ptr_get(const void *p_base, void *r_member) { \
+ PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(p_base).m_getter(), r_member); \
} \
- static void set(Variant *base, const Variant *value, bool &valid) { \
- if (value->get_type() == GetTypeInfo<m_member_type>::VARIANT_TYPE) { \
- VariantInternalAccessor<m_base_type>::get(base).m_setter(VariantInternalAccessor<m_member_type>::get(value)); \
- valid = true; \
+ static void set(Variant *r_base, const Variant *p_value, bool &r_valid) { \
+ if (p_value->get_type() == GetTypeInfo<m_member_type>::VARIANT_TYPE) { \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_setter(VariantInternalAccessor<m_member_type>::get(p_value)); \
+ r_valid = true; \
} else { \
- valid = false; \
+ r_valid = false; \
} \
} \
- static inline void validated_set(Variant *base, const Variant *value) { \
- VariantInternalAccessor<m_base_type>::get(base).m_setter(VariantInternalAccessor<m_member_type>::get(value)); \
+ static inline void validated_set(Variant *r_base, const Variant *p_value) { \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_setter(VariantInternalAccessor<m_member_type>::get(p_value)); \
} \
- static void ptr_set(void *base, const void *member) { \
- m_base_type b = PtrToArg<m_base_type>::convert(base); \
- b.m_setter(PtrToArg<m_member_type>::convert(member)); \
- PtrToArg<m_base_type>::encode(b, base); \
+ static void ptr_set(void *r_base, const void *p_member) { \
+ m_base_type b = PtrToArg<m_base_type>::convert(r_base); \
+ b.m_setter(PtrToArg<m_member_type>::convert(p_member)); \
+ PtrToArg<m_base_type>::encode(b, r_base); \
} \
static Variant::Type get_type() { \
return GetTypeInfo<m_member_type>::VARIANT_TYPE; \
@@ -209,34 +209,34 @@
#define SETGET_NUMBER_STRUCT_FUNC(m_base_type, m_member_type, m_member, m_setter, m_getter) \
struct VariantSetGet_##m_base_type##_##m_member { \
- static void get(const Variant *base, Variant *member) { \
- VariantTypeAdjust<m_member_type>::adjust(member); \
- VariantInternalAccessor<m_member_type>::get(member) = VariantInternalAccessor<m_base_type>::get(base).m_getter(); \
- } \
- static inline void validated_get(const Variant *base, Variant *member) { \
- VariantInternalAccessor<m_member_type>::get(member) = VariantInternalAccessor<m_base_type>::get(base).m_getter(); \
- } \
- static void ptr_get(const void *base, void *member) { \
- PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(base).m_getter(), member); \
- } \
- static void set(Variant *base, const Variant *value, bool &valid) { \
- if (value->get_type() == Variant::FLOAT) { \
- VariantInternalAccessor<m_base_type>::get(base).m_setter(VariantInternalAccessor<double>::get(value)); \
- valid = true; \
- } else if (value->get_type() == Variant::INT) { \
- VariantInternalAccessor<m_base_type>::get(base).m_setter(VariantInternalAccessor<int64_t>::get(value)); \
- valid = true; \
+ static void get(const Variant *p_base, Variant *r_member) { \
+ VariantTypeAdjust<m_member_type>::adjust(r_member); \
+ VariantInternalAccessor<m_member_type>::get(r_member) = VariantInternalAccessor<m_base_type>::get(p_base).m_getter(); \
+ } \
+ static inline void validated_get(const Variant *p_base, Variant *r_member) { \
+ VariantInternalAccessor<m_member_type>::get(r_member) = VariantInternalAccessor<m_base_type>::get(p_base).m_getter(); \
+ } \
+ static void ptr_get(const void *p_base, void *r_member) { \
+ PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(p_base).m_getter(), r_member); \
+ } \
+ static void set(Variant *r_base, const Variant *p_value, bool &r_valid) { \
+ if (p_value->get_type() == Variant::FLOAT) { \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_setter(VariantInternalAccessor<double>::get(p_value)); \
+ r_valid = true; \
+ } else if (p_value->get_type() == Variant::INT) { \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_setter(VariantInternalAccessor<int64_t>::get(p_value)); \
+ r_valid = true; \
} else { \
- valid = false; \
+ r_valid = false; \
} \
} \
- static inline void validated_set(Variant *base, const Variant *value) { \
- VariantInternalAccessor<m_base_type>::get(base).m_setter(VariantInternalAccessor<m_member_type>::get(value)); \
+ static inline void validated_set(Variant *r_base, const Variant *p_value) { \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_setter(VariantInternalAccessor<m_member_type>::get(p_value)); \
} \
- static void ptr_set(void *base, const void *member) { \
- m_base_type b = PtrToArg<m_base_type>::convert(base); \
- b.m_setter(PtrToArg<m_member_type>::convert(member)); \
- PtrToArg<m_base_type>::encode(b, base); \
+ static void ptr_set(void *r_base, const void *p_member) { \
+ m_base_type b = PtrToArg<m_base_type>::convert(r_base); \
+ b.m_setter(PtrToArg<m_member_type>::convert(p_member)); \
+ PtrToArg<m_base_type>::encode(b, r_base); \
} \
static Variant::Type get_type() { \
return GetTypeInfo<m_member_type>::VARIANT_TYPE; \
@@ -245,31 +245,31 @@
#define SETGET_STRUCT_FUNC_INDEX(m_base_type, m_member_type, m_member, m_setter, m_getter, m_index) \
struct VariantSetGet_##m_base_type##_##m_member { \
- static void get(const Variant *base, Variant *member) { \
- VariantTypeAdjust<m_member_type>::adjust(member); \
- VariantInternalAccessor<m_member_type>::get(member) = VariantInternalAccessor<m_base_type>::get(base).m_getter(m_index); \
+ static void get(const Variant *p_base, Variant *r_member) { \
+ VariantTypeAdjust<m_member_type>::adjust(r_member); \
+ VariantInternalAccessor<m_member_type>::get(r_member) = VariantInternalAccessor<m_base_type>::get(p_base).m_getter(m_index); \
} \
- static inline void validated_get(const Variant *base, Variant *member) { \
- VariantInternalAccessor<m_member_type>::get(member) = VariantInternalAccessor<m_base_type>::get(base).m_getter(m_index); \
+ static inline void validated_get(const Variant *p_base, Variant *r_member) { \
+ VariantInternalAccessor<m_member_type>::get(r_member) = VariantInternalAccessor<m_base_type>::get(p_base).m_getter(m_index); \
} \
- static void ptr_get(const void *base, void *member) { \
- PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(base).m_getter(m_index), member); \
+ static void ptr_get(const void *p_base, void *r_member) { \
+ PtrToArg<m_member_type>::encode(PtrToArg<m_base_type>::convert(p_base).m_getter(m_index), r_member); \
} \
- static void set(Variant *base, const Variant *value, bool &valid) { \
- if (value->get_type() == GetTypeInfo<m_member_type>::VARIANT_TYPE) { \
- VariantInternalAccessor<m_base_type>::get(base).m_setter(m_index, VariantInternalAccessor<m_member_type>::get(value)); \
- valid = true; \
+ static void set(Variant *r_base, const Variant *p_value, bool &r_valid) { \
+ if (p_value->get_type() == GetTypeInfo<m_member_type>::VARIANT_TYPE) { \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_setter(m_index, VariantInternalAccessor<m_member_type>::get(p_value)); \
+ r_valid = true; \
} else { \
- valid = false; \
+ r_valid = false; \
} \
} \
- static inline void validated_set(Variant *base, const Variant *value) { \
- VariantInternalAccessor<m_base_type>::get(base).m_setter(m_index, VariantInternalAccessor<m_member_type>::get(value)); \
+ static inline void validated_set(Variant *r_base, const Variant *p_value) { \
+ VariantInternalAccessor<m_base_type>::get(r_base).m_setter(m_index, VariantInternalAccessor<m_member_type>::get(p_value)); \
} \
- static void ptr_set(void *base, const void *member) { \
- m_base_type b = PtrToArg<m_base_type>::convert(base); \
- b.m_setter(m_index, PtrToArg<m_member_type>::convert(member)); \
- PtrToArg<m_base_type>::encode(b, base); \
+ static void ptr_set(void *r_base, const void *p_member) { \
+ m_base_type b = PtrToArg<m_base_type>::convert(r_base); \
+ b.m_setter(m_index, PtrToArg<m_member_type>::convert(p_member)); \
+ PtrToArg<m_base_type>::encode(b, r_base); \
} \
static Variant::Type get_type() { \
return GetTypeInfo<m_member_type>::VARIANT_TYPE; \
diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp
index 5f048ed4568..cd8bf87e4be 100644
--- a/core/variant/variant_utility.cpp
+++ b/core/variant/variant_utility.cpp
@@ -40,100 +40,100 @@
#include "core/variant/variant_parser.h"
// Math
-double VariantUtilityFunctions::sin(double arg) {
- return Math::sin(arg);
+double VariantUtilityFunctions::sin(double p_arg) {
+ return Math::sin(p_arg);
}
-double VariantUtilityFunctions::cos(double arg) {
- return Math::cos(arg);
+double VariantUtilityFunctions::cos(double p_arg) {
+ return Math::cos(p_arg);
}
-double VariantUtilityFunctions::tan(double arg) {
- return Math::tan(arg);
+double VariantUtilityFunctions::tan(double p_arg) {
+ return Math::tan(p_arg);
}
-double VariantUtilityFunctions::sinh(double arg) {
- return Math::sinh(arg);
+double VariantUtilityFunctions::sinh(double p_arg) {
+ return Math::sinh(p_arg);
}
-double VariantUtilityFunctions::cosh(double arg) {
- return Math::cosh(arg);
+double VariantUtilityFunctions::cosh(double p_arg) {
+ return Math::cosh(p_arg);
}
-double VariantUtilityFunctions::tanh(double arg) {
- return Math::tanh(arg);
+double VariantUtilityFunctions::tanh(double p_arg) {
+ return Math::tanh(p_arg);
}
-double VariantUtilityFunctions::asin(double arg) {
- return Math::asin(arg);
+double VariantUtilityFunctions::asin(double p_arg) {
+ return Math::asin(p_arg);
}
-double VariantUtilityFunctions::acos(double arg) {
- return Math::acos(arg);
+double VariantUtilityFunctions::acos(double p_arg) {
+ return Math::acos(p_arg);
}
-double VariantUtilityFunctions::atan(double arg) {
- return Math::atan(arg);
+double VariantUtilityFunctions::atan(double p_arg) {
+ return Math::atan(p_arg);
}
-double VariantUtilityFunctions::atan2(double y, double x) {
- return Math::atan2(y, x);
+double VariantUtilityFunctions::atan2(double p_y, double p_x) {
+ return Math::atan2(p_y, p_x);
}
-double VariantUtilityFunctions::asinh(double arg) {
- return Math::asinh(arg);
+double VariantUtilityFunctions::asinh(double p_arg) {
+ return Math::asinh(p_arg);
}
-double VariantUtilityFunctions::acosh(double arg) {
- return Math::acosh(arg);
+double VariantUtilityFunctions::acosh(double p_arg) {
+ return Math::acosh(p_arg);
}
-double VariantUtilityFunctions::atanh(double arg) {
- return Math::atanh(arg);
+double VariantUtilityFunctions::atanh(double p_arg) {
+ return Math::atanh(p_arg);
}
-double VariantUtilityFunctions::sqrt(double x) {
- return Math::sqrt(x);
+double VariantUtilityFunctions::sqrt(double p_x) {
+ return Math::sqrt(p_x);
}
-double VariantUtilityFunctions::fmod(double b, double r) {
- return Math::fmod(b, r);
+double VariantUtilityFunctions::fmod(double p_b, double p_r) {
+ return Math::fmod(p_b, p_r);
}
-double VariantUtilityFunctions::fposmod(double b, double r) {
- return Math::fposmod(b, r);
+double VariantUtilityFunctions::fposmod(double p_b, double p_r) {
+ return Math::fposmod(p_b, p_r);
}
-int64_t VariantUtilityFunctions::posmod(int64_t b, int64_t r) {
- return Math::posmod(b, r);
+int64_t VariantUtilityFunctions::posmod(int64_t p_b, int64_t p_r) {
+ return Math::posmod(p_b, p_r);
}
-Variant VariantUtilityFunctions::floor(const Variant &x, Callable::CallError &r_error) {
+Variant VariantUtilityFunctions::floor(const Variant &p_x, Callable::CallError &r_error) {
r_error.error = Callable::CallError::CALL_OK;
- switch (x.get_type()) {
+ switch (p_x.get_type()) {
case Variant::INT: {
- return VariantInternalAccessor<int64_t>::get(&x);
+ return VariantInternalAccessor<int64_t>::get(&p_x);
} break;
case Variant::FLOAT: {
- return Math::floor(VariantInternalAccessor<double>::get(&x));
+ return Math::floor(VariantInternalAccessor<double>::get(&p_x));
} break;
case Variant::VECTOR2: {
- return VariantInternalAccessor<Vector2>::get(&x).floor();
+ return VariantInternalAccessor<Vector2>::get(&p_x).floor();
} break;
case Variant::VECTOR2I: {
- return VariantInternalAccessor<Vector2i>::get(&x);
+ return VariantInternalAccessor<Vector2i>::get(&p_x);
} break;
case Variant::VECTOR3: {
- return VariantInternalAccessor<Vector3>::get(&x).floor();
+ return VariantInternalAccessor<Vector3>::get(&p_x).floor();
} break;
case Variant::VECTOR3I: {
- return VariantInternalAccessor<Vector3i>::get(&x);
+ return VariantInternalAccessor<Vector3i>::get(&p_x);
} break;
case Variant::VECTOR4: {
- return VariantInternalAccessor<Vector4>::get(&x).floor();
+ return VariantInternalAccessor<Vector4>::get(&p_x).floor();
} break;
case Variant::VECTOR4I: {
- return VariantInternalAccessor<Vector4i>::get(&x);
+ return VariantInternalAccessor<Vector4i>::get(&p_x);
} break;
default: {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
@@ -144,40 +144,40 @@ Variant VariantUtilityFunctions::floor(const Variant &x, Callable::CallError &r_
}
}
-double VariantUtilityFunctions::floorf(double x) {
- return Math::floor(x);
+double VariantUtilityFunctions::floorf(double p_x) {
+ return Math::floor(p_x);
}
-int64_t VariantUtilityFunctions::floori(double x) {
- return int64_t(Math::floor(x));
+int64_t VariantUtilityFunctions::floori(double p_x) {
+ return int64_t(Math::floor(p_x));
}
-Variant VariantUtilityFunctions::ceil(const Variant &x, Callable::CallError &r_error) {
+Variant VariantUtilityFunctions::ceil(const Variant &p_x, Callable::CallError &r_error) {
r_error.error = Callable::CallError::CALL_OK;
- switch (x.get_type()) {
+ switch (p_x.get_type()) {
case Variant::INT: {
- return VariantInternalAccessor<int64_t>::get(&x);
+ return VariantInternalAccessor<int64_t>::get(&p_x);
} break;
case Variant::FLOAT: {
- return Math::ceil(VariantInternalAccessor<double>::get(&x));
+ return Math::ceil(VariantInternalAccessor<double>::get(&p_x));
} break;
case Variant::VECTOR2: {
- return VariantInternalAccessor<Vector2>::get(&x).ceil();
+ return VariantInternalAccessor<Vector2>::get(&p_x).ceil();
} break;
case Variant::VECTOR2I: {
- return VariantInternalAccessor<Vector2i>::get(&x);
+ return VariantInternalAccessor<Vector2i>::get(&p_x);
} break;
case Variant::VECTOR3: {
- return VariantInternalAccessor<Vector3>::get(&x).ceil();
+ return VariantInternalAccessor<Vector3>::get(&p_x).ceil();
} break;
case Variant::VECTOR3I: {
- return VariantInternalAccessor<Vector3i>::get(&x);
+ return VariantInternalAccessor<Vector3i>::get(&p_x);
} break;
case Variant::VECTOR4: {
- return VariantInternalAccessor<Vector4>::get(&x).ceil();
+ return VariantInternalAccessor<Vector4>::get(&p_x).ceil();
} break;
case Variant::VECTOR4I: {
- return VariantInternalAccessor<Vector4i>::get(&x);
+ return VariantInternalAccessor<Vector4i>::get(&p_x);
} break;
default: {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
@@ -188,40 +188,40 @@ Variant VariantUtilityFunctions::ceil(const Variant &x, Callable::CallError &r_e
}
}
-double VariantUtilityFunctions::ceilf(double x) {
- return Math::ceil(x);
+double VariantUtilityFunctions::ceilf(double p_x) {
+ return Math::ceil(p_x);
}
-int64_t VariantUtilityFunctions::ceili(double x) {
- return int64_t(Math::ceil(x));
+int64_t VariantUtilityFunctions::ceili(double p_x) {
+ return int64_t(Math::ceil(p_x));
}
-Variant VariantUtilityFunctions::round(const Variant &x, Callable::CallError &r_error) {
+Variant VariantUtilityFunctions::round(const Variant &p_x, Callable::CallError &r_error) {
r_error.error = Callable::CallError::CALL_OK;
- switch (x.get_type()) {
+ switch (p_x.get_type()) {
case Variant::INT: {
- return VariantInternalAccessor<int64_t>::get(&x);
+ return VariantInternalAccessor<int64_t>::get(&p_x);
} break;
case Variant::FLOAT: {
- return Math::round(VariantInternalAccessor<double>::get(&x));
+ return Math::round(VariantInternalAccessor<double>::get(&p_x));
} break;
case Variant::VECTOR2: {
- return VariantInternalAccessor<Vector2>::get(&x).round();
+ return VariantInternalAccessor<Vector2>::get(&p_x).round();
} break;
case Variant::VECTOR2I: {
- return VariantInternalAccessor<Vector2i>::get(&x);
+ return VariantInternalAccessor<Vector2i>::get(&p_x);
} break;
case Variant::VECTOR3: {
- return VariantInternalAccessor<Vector3>::get(&x).round();
+ return VariantInternalAccessor<Vector3>::get(&p_x).round();
} break;
case Variant::VECTOR3I: {
- return VariantInternalAccessor<Vector3i>::get(&x);
+ return VariantInternalAccessor<Vector3i>::get(&p_x);
} break;
case Variant::VECTOR4: {
- return VariantInternalAccessor<Vector4>::get(&x).round();
+ return VariantInternalAccessor<Vector4>::get(&p_x).round();
} break;
case Variant::VECTOR4I: {
- return VariantInternalAccessor<Vector4i>::get(&x);
+ return VariantInternalAccessor<Vector4i>::get(&p_x);
} break;
default: {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
@@ -232,40 +232,40 @@ Variant VariantUtilityFunctions::round(const Variant &x, Callable::CallError &r_
}
}
-double VariantUtilityFunctions::roundf(double x) {
- return Math::round(x);
+double VariantUtilityFunctions::roundf(double p_x) {
+ return Math::round(p_x);
}
-int64_t VariantUtilityFunctions::roundi(double x) {
- return int64_t(Math::round(x));
+int64_t VariantUtilityFunctions::roundi(double p_x) {
+ return int64_t(Math::round(p_x));
}
-Variant VariantUtilityFunctions::abs(const Variant &x, Callable::CallError &r_error) {
+Variant VariantUtilityFunctions::abs(const Variant &p_x, Callable::CallError &r_error) {
r_error.error = Callable::CallError::CALL_OK;
- switch (x.get_type()) {
+ switch (p_x.get_type()) {
case Variant::INT: {
- return Math::abs(VariantInternalAccessor<int64_t>::get(&x));
+ return Math::abs(VariantInternalAccessor<int64_t>::get(&p_x));
} break;
case Variant::FLOAT: {
- return Math::abs(VariantInternalAccessor<double>::get(&x));
+ return Math::abs(VariantInternalAccessor<double>::get(&p_x));
} break;
case Variant::VECTOR2: {
- return VariantInternalAccessor<Vector2>::get(&x).abs();
+ return VariantInternalAccessor<Vector2>::get(&p_x).abs();
} break;
case Variant::VECTOR2I: {
- return VariantInternalAccessor<Vector2i>::get(&x).abs();
+ return VariantInternalAccessor<Vector2i>::get(&p_x).abs();
} break;
case Variant::VECTOR3: {
- return VariantInternalAccessor<Vector3>::get(&x).abs();
+ return VariantInternalAccessor<Vector3>::get(&p_x).abs();
} break;
case Variant::VECTOR3I: {
- return VariantInternalAccessor<Vector3i>::get(&x).abs();
+ return VariantInternalAccessor<Vector3i>::get(&p_x).abs();
} break;
case Variant::VECTOR4: {
- return VariantInternalAccessor<Vector4>::get(&x).abs();
+ return VariantInternalAccessor<Vector4>::get(&p_x).abs();
} break;
case Variant::VECTOR4I: {
- return VariantInternalAccessor<Vector4i>::get(&x).abs();
+ return VariantInternalAccessor<Vector4i>::get(&p_x).abs();
} break;
default: {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
@@ -276,40 +276,40 @@ Variant VariantUtilityFunctions::abs(const Variant &x, Callable::CallError &r_er
}
}
-double VariantUtilityFunctions::absf(double x) {
- return Math::abs(x);
+double VariantUtilityFunctions::absf(double p_x) {
+ return Math::abs(p_x);
}
-int64_t VariantUtilityFunctions::absi(int64_t x) {
- return Math::abs(x);
+int64_t VariantUtilityFunctions::absi(int64_t p_x) {
+ return Math::abs(p_x);
}
-Variant VariantUtilityFunctions::sign(const Variant &x, Callable::CallError &r_error) {
+Variant VariantUtilityFunctions::sign(const Variant &p_x, Callable::CallError &r_error) {
r_error.error = Callable::CallError::CALL_OK;
- switch (x.get_type()) {
+ switch (p_x.get_type()) {
case Variant::INT: {
- return SIGN(VariantInternalAccessor<int64_t>::get(&x));
+ return SIGN(VariantInternalAccessor<int64_t>::get(&p_x));
} break;
case Variant::FLOAT: {
- return SIGN(VariantInternalAccessor<double>::get(&x));
+ return SIGN(VariantInternalAccessor<double>::get(&p_x));
} break;
case Variant::VECTOR2: {
- return VariantInternalAccessor<Vector2>::get(&x).sign();
+ return VariantInternalAccessor<Vector2>::get(&p_x).sign();
} break;
case Variant::VECTOR2I: {
- return VariantInternalAccessor<Vector2i>::get(&x).sign();
+ return VariantInternalAccessor<Vector2i>::get(&p_x).sign();
} break;
case Variant::VECTOR3: {
- return VariantInternalAccessor<Vector3>::get(&x).sign();
+ return VariantInternalAccessor<Vector3>::get(&p_x).sign();
} break;
case Variant::VECTOR3I: {
- return VariantInternalAccessor<Vector3i>::get(&x).sign();
+ return VariantInternalAccessor<Vector3i>::get(&p_x).sign();
} break;
case Variant::VECTOR4: {
- return VariantInternalAccessor<Vector4>::get(&x).sign();
+ return VariantInternalAccessor<Vector4>::get(&p_x).sign();
} break;
case Variant::VECTOR4I: {
- return VariantInternalAccessor<Vector4i>::get(&x).sign();
+ return VariantInternalAccessor<Vector4i>::get(&p_x).sign();
} break;
default: {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
@@ -320,56 +320,56 @@ Variant VariantUtilityFunctions::sign(const Variant &x, Callable::CallError &r_e
}
}
-double VariantUtilityFunctions::signf(double x) {
- return SIGN(x);
+double VariantUtilityFunctions::signf(double p_x) {
+ return SIGN(p_x);
}
-int64_t VariantUtilityFunctions::signi(int64_t x) {
- return SIGN(x);
+int64_t VariantUtilityFunctions::signi(int64_t p_x) {
+ return SIGN(p_x);
}
-double VariantUtilityFunctions::pow(double x, double y) {
- return Math::pow(x, y);
+double VariantUtilityFunctions::pow(double p_x, double p_y) {
+ return Math::pow(p_x, p_y);
}
-double VariantUtilityFunctions::log(double x) {
- return Math::log(x);
+double VariantUtilityFunctions::log(double p_x) {
+ return Math::log(p_x);
}
-double VariantUtilityFunctions::exp(double x) {
- return Math::exp(x);
+double VariantUtilityFunctions::exp(double p_x) {
+ return Math::exp(p_x);
}
-bool VariantUtilityFunctions::is_nan(double x) {
- return Math::is_nan(x);
+bool VariantUtilityFunctions::is_nan(double p_x) {
+ return Math::is_nan(p_x);
}
-bool VariantUtilityFunctions::is_inf(double x) {
- return Math::is_inf(x);
+bool VariantUtilityFunctions::is_inf(double p_x) {
+ return Math::is_inf(p_x);
}
-bool VariantUtilityFunctions::is_equal_approx(double x, double y) {
- return Math::is_equal_approx(x, y);
+bool VariantUtilityFunctions::is_equal_approx(double p_x, double p_y) {
+ return Math::is_equal_approx(p_x, p_y);
}
-bool VariantUtilityFunctions::is_zero_approx(double x) {
- return Math::is_zero_approx(x);
+bool VariantUtilityFunctions::is_zero_approx(double p_x) {
+ return Math::is_zero_approx(p_x);
}
-bool VariantUtilityFunctions::is_finite(double x) {
- return Math::is_finite(x);
+bool VariantUtilityFunctions::is_finite(double p_x) {
+ return Math::is_finite(p_x);
}
-double VariantUtilityFunctions::ease(double x, double curve) {
- return Math::ease(x, curve);
+double VariantUtilityFunctions::ease(double p_x, double p_curve) {
+ return Math::ease(p_x, p_curve);
}
-int VariantUtilityFunctions::step_decimals(double step) {
- return Math::step_decimals(step);
+int VariantUtilityFunctions::step_decimals(double p_step) {
+ return Math::step_decimals(p_step);
}
-Variant VariantUtilityFunctions::snapped(const Variant &x, const Variant &step, Callable::CallError &r_error) {
- switch (x.get_type()) {
+Variant VariantUtilityFunctions::snapped(const Variant &p_x, const Variant &p_step, Callable::CallError &r_error) {
+ switch (p_x.get_type()) {
case Variant::INT:
case Variant::FLOAT:
case Variant::VECTOR2:
@@ -386,9 +386,9 @@ Variant VariantUtilityFunctions::snapped(const Variant &x, const Variant &step,
return R"(Argument "x" must be "int", "float", "Vector2", "Vector2i", "Vector3", "Vector3i", "Vector4", or "Vector4i".)";
}
- if (x.get_type() != step.get_type()) {
- if (x.get_type() == Variant::INT || x.get_type() == Variant::FLOAT) {
- if (step.get_type() != Variant::INT && step.get_type() != Variant::FLOAT) {
+ if (p_x.get_type() != p_step.get_type()) {
+ if (p_x.get_type() == Variant::INT || p_x.get_type() == Variant::FLOAT) {
+ if (p_step.get_type() != Variant::INT && p_step.get_type() != Variant::FLOAT) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 1;
r_error.expected = Variant::NIL;
@@ -397,36 +397,36 @@ Variant VariantUtilityFunctions::snapped(const Variant &x, const Variant &step,
} else {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 1;
- r_error.expected = x.get_type();
+ r_error.expected = p_x.get_type();
return Variant();
}
}
r_error.error = Callable::CallError::CALL_OK;
- switch (step.get_type()) {
+ switch (p_step.get_type()) {
case Variant::INT: {
- return snappedi(x, VariantInternalAccessor<int64_t>::get(&step));
+ return snappedi(p_x, VariantInternalAccessor<int64_t>::get(&p_step));
} break;
case Variant::FLOAT: {
- return snappedf(x, VariantInternalAccessor<double>::get(&step));
+ return snappedf(p_x, VariantInternalAccessor<double>::get(&p_step));
} break;
case Variant::VECTOR2: {
- return VariantInternalAccessor<Vector2>::get(&x).snapped(VariantInternalAccessor<Vector2>::get(&step));
+ return VariantInternalAccessor<Vector2>::get(&p_x).snapped(VariantInternalAccessor<Vector2>::get(&p_step));
} break;
case Variant::VECTOR2I: {
- return VariantInternalAccessor<Vector2i>::get(&x).snapped(VariantInternalAccessor<Vector2i>::get(&step));
+ return VariantInternalAccessor<Vector2i>::get(&p_x).snapped(VariantInternalAccessor<Vector2i>::get(&p_step));
} break;
case Variant::VECTOR3: {
- return VariantInternalAccessor<Vector3>::get(&x).snapped(VariantInternalAccessor<Vector3>::get(&step));
+ return VariantInternalAccessor<Vector3>::get(&p_x).snapped(VariantInternalAccessor<Vector3>::get(&p_step));
} break;
case Variant::VECTOR3I: {
- return VariantInternalAccessor<Vector3i>::get(&x).snapped(VariantInternalAccessor<Vector3i>::get(&step));
+ return VariantInternalAccessor<Vector3i>::get(&p_x).snapped(VariantInternalAccessor<Vector3i>::get(&p_step));
} break;
case Variant::VECTOR4: {
- return VariantInternalAccessor<Vector4>::get(&x).snapped(VariantInternalAccessor<Vector4>::get(&step));
+ return VariantInternalAccessor<Vector4>::get(&p_x).snapped(VariantInternalAccessor<Vector4>::get(&p_step));
} break;
case Variant::VECTOR4I: {
- return VariantInternalAccessor<Vector4i>::get(&x).snapped(VariantInternalAccessor<Vector4i>::get(&step));
+ return VariantInternalAccessor<Vector4i>::get(&p_x).snapped(VariantInternalAccessor<Vector4i>::get(&p_step));
} break;
default: {
return Variant(); // Already handled.
@@ -434,16 +434,16 @@ Variant VariantUtilityFunctions::snapped(const Variant &x, const Variant &step,
}
}
-double VariantUtilityFunctions::snappedf(double x, double step) {
- return Math::snapped(x, step);
+double VariantUtilityFunctions::snappedf(double p_x, double p_step) {
+ return Math::snapped(p_x, p_step);
}
-int64_t VariantUtilityFunctions::snappedi(double x, int64_t step) {
- return Math::snapped(x, step);
+int64_t VariantUtilityFunctions::snappedi(double p_x, int64_t p_step) {
+ return Math::snapped(p_x, p_step);
}
-Variant VariantUtilityFunctions::lerp(const Variant &from, const Variant &to, double weight, Callable::CallError &r_error) {
- switch (from.get_type()) {
+Variant VariantUtilityFunctions::lerp(const Variant &p_from, const Variant &p_to, double p_weight, Callable::CallError &r_error) {
+ switch (p_from.get_type()) {
case Variant::INT:
case Variant::FLOAT:
case Variant::VECTOR2:
@@ -462,44 +462,44 @@ Variant VariantUtilityFunctions::lerp(const Variant &from, const Variant &to, do
return R"(Argument "from" must be "int", "float", "Vector2", "Vector3", "Vector4", "Color", "Quaternion", "Basis", "Transform2D", or "Transform3D".)";
}
- if (from.get_type() != to.get_type()) {
+ if (p_from.get_type() != p_to.get_type()) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 1;
- r_error.expected = from.get_type();
+ r_error.expected = p_from.get_type();
return Variant();
}
r_error.error = Callable::CallError::CALL_OK;
- switch (from.get_type()) {
+ switch (p_from.get_type()) {
case Variant::INT: {
- return lerpf(VariantInternalAccessor<int64_t>::get(&from), to, weight);
+ return lerpf(VariantInternalAccessor<int64_t>::get(&p_from), p_to, p_weight);
} break;
case Variant::FLOAT: {
- return lerpf(VariantInternalAccessor<double>::get(&from), to, weight);
+ return lerpf(VariantInternalAccessor<double>::get(&p_from), p_to, p_weight);
} break;
case Variant::VECTOR2: {
- return VariantInternalAccessor<Vector2>::get(&from).lerp(VariantInternalAccessor<Vector2>::get(&to), weight);
+ return VariantInternalAccessor<Vector2>::get(&p_from).lerp(VariantInternalAccessor<Vector2>::get(&p_to), p_weight);
} break;
case Variant::VECTOR3: {
- return VariantInternalAccessor<Vector3>::get(&from).lerp(VariantInternalAccessor<Vector3>::get(&to), weight);
+ return VariantInternalAccessor<Vector3>::get(&p_from).lerp(VariantInternalAccessor<Vector3>::get(&p_to), p_weight);
} break;
case Variant::VECTOR4: {
- return VariantInternalAccessor<Vector4>::get(&from).lerp(VariantInternalAccessor<Vector4>::get(&to), weight);
+ return VariantInternalAccessor<Vector4>::get(&p_from).lerp(VariantInternalAccessor<Vector4>::get(&p_to), p_weight);
} break;
case Variant::QUATERNION: {
- return VariantInternalAccessor<Quaternion>::get(&from).slerp(VariantInternalAccessor<Quaternion>::get(&to), weight);
+ return VariantInternalAccessor<Quaternion>::get(&p_from).slerp(VariantInternalAccessor<Quaternion>::get(&p_to), p_weight);
} break;
case Variant::BASIS: {
- return VariantInternalAccessor<Basis>::get(&from).slerp(VariantInternalAccessor<Basis>::get(&to), weight);
+ return VariantInternalAccessor<Basis>::get(&p_from).slerp(VariantInternalAccessor<Basis>::get(&p_to), p_weight);
} break;
case Variant::TRANSFORM2D: {
- return VariantInternalAccessor<Transform2D>::get(&from).interpolate_with(VariantInternalAccessor<Transform2D>::get(&to), weight);
+ return VariantInternalAccessor<Transform2D>::get(&p_from).interpolate_with(VariantInternalAccessor<Transform2D>::get(&p_to), p_weight);
} break;
case Variant::TRANSFORM3D: {
- return VariantInternalAccessor<Transform3D>::get(&from).interpolate_with(VariantInternalAccessor<Transform3D>::get(&to), weight);
+ return VariantInternalAccessor<Transform3D>::get(&p_from).interpolate_with(VariantInternalAccessor<Transform3D>::get(&p_to), p_weight);
} break;
case Variant::COLOR: {
- return VariantInternalAccessor<Color>::get(&from).lerp(VariantInternalAccessor<Color>::get(&to), weight);
+ return VariantInternalAccessor<Color>::get(&p_from).lerp(VariantInternalAccessor<Color>::get(&p_to), p_weight);
} break;
default: {
return Variant(); // Already handled.
@@ -507,26 +507,26 @@ Variant VariantUtilityFunctions::lerp(const Variant &from, const Variant &to, do
}
}
-double VariantUtilityFunctions::lerpf(double from, double to, double weight) {
- return Math::lerp(from, to, weight);
+double VariantUtilityFunctions::lerpf(double p_from, double p_to, double p_weight) {
+ return Math::lerp(p_from, p_to, p_weight);
}
-double VariantUtilityFunctions::cubic_interpolate(double from, double to, double pre, double post, double weight) {
- return Math::cubic_interpolate(from, to, pre, post, weight);
+double VariantUtilityFunctions::cubic_interpolate(double p_from, double p_to, double p_pre, double p_post, double p_weight) {
+ return Math::cubic_interpolate(p_from, p_to, p_pre, p_post, p_weight);
}
-double VariantUtilityFunctions::cubic_interpolate_angle(double from, double to, double pre, double post, double weight) {
- return Math::cubic_interpolate_angle(from, to, pre, post, weight);
+double VariantUtilityFunctions::cubic_interpolate_angle(double p_from, double p_to, double p_pre, double p_post, double p_weight) {
+ return Math::cubic_interpolate_angle(p_from, p_to, p_pre, p_post, p_weight);
}
-double VariantUtilityFunctions::cubic_interpolate_in_time(double from, double to, double pre, double post, double weight,
- double to_t, double pre_t, double post_t) {
- return Math::cubic_interpolate_in_time(from, to, pre, post, weight, to_t, pre_t, post_t);
+double VariantUtilityFunctions::cubic_interpolate_in_time(double p_from, double p_to, double p_pre, double p_post, double p_weight,
+ double p_to_t, double p_pre_t, double p_post_t) {
+ return Math::cubic_interpolate_in_time(p_from, p_to, p_pre, p_post, p_weight, p_to_t, p_pre_t, p_post_t);
}
-double VariantUtilityFunctions::cubic_interpolate_angle_in_time(double from, double to, double pre, double post, double weight,
- double to_t, double pre_t, double post_t) {
- return Math::cubic_interpolate_angle_in_time(from, to, pre, post, weight, to_t, pre_t, post_t);
+double VariantUtilityFunctions::cubic_interpolate_angle_in_time(double p_from, double p_to, double p_pre, double p_post, double p_weight,
+ double p_to_t, double p_pre_t, double p_post_t) {
+ return Math::cubic_interpolate_angle_in_time(p_from, p_to, p_pre, p_post, p_weight, p_to_t, p_pre_t, p_post_t);
}
double VariantUtilityFunctions::bezier_interpolate(double p_start, double p_control_1, double p_control_2, double p_end, double p_t) {
@@ -537,48 +537,48 @@ double VariantUtilityFunctions::bezier_derivative(double p_start, double p_contr
return Math::bezier_derivative(p_start, p_control_1, p_control_2, p_end, p_t);
}
-double VariantUtilityFunctions::angle_difference(double from, double to) {
- return Math::angle_difference(from, to);
+double VariantUtilityFunctions::angle_difference(double p_from, double p_to) {
+ return Math::angle_difference(p_from, p_to);
}
-double VariantUtilityFunctions::lerp_angle(double from, double to, double weight) {
- return Math::lerp_angle(from, to, weight);
+double VariantUtilityFunctions::lerp_angle(double p_from, double p_to, double p_weight) {
+ return Math::lerp_angle(p_from, p_to, p_weight);
}
-double VariantUtilityFunctions::inverse_lerp(double from, double to, double weight) {
- return Math::inverse_lerp(from, to, weight);
+double VariantUtilityFunctions::inverse_lerp(double p_from, double p_to, double p_weight) {
+ return Math::inverse_lerp(p_from, p_to, p_weight);
}
-double VariantUtilityFunctions::remap(double value, double istart, double istop, double ostart, double ostop) {
- return Math::remap(value, istart, istop, ostart, ostop);
+double VariantUtilityFunctions::remap(double p_value, double p_istart, double p_istop, double p_ostart, double p_ostop) {
+ return Math::remap(p_value, p_istart, p_istop, p_ostart, p_ostop);
}
-double VariantUtilityFunctions::smoothstep(double from, double to, double val) {
- return Math::smoothstep(from, to, val);
+double VariantUtilityFunctions::smoothstep(double p_from, double p_to, double p_step) {
+ return Math::smoothstep(p_from, p_to, p_step);
}
-double VariantUtilityFunctions::move_toward(double from, double to, double delta) {
- return Math::move_toward(from, to, delta);
+double VariantUtilityFunctions::move_toward(double p_from, double p_to, double p_delta) {
+ return Math::move_toward(p_from, p_to, p_delta);
}
-double VariantUtilityFunctions::rotate_toward(double from, double to, double delta) {
- return Math::rotate_toward(from, to, delta);
+double VariantUtilityFunctions::rotate_toward(double p_from, double p_to, double p_delta) {
+ return Math::rotate_toward(p_from, p_to, p_delta);
}
-double VariantUtilityFunctions::deg_to_rad(double angle_deg) {
- return Math::deg_to_rad(angle_deg);
+double VariantUtilityFunctions::deg_to_rad(double p_angle_deg) {
+ return Math::deg_to_rad(p_angle_deg);
}
-double VariantUtilityFunctions::rad_to_deg(double angle_rad) {
- return Math::rad_to_deg(angle_rad);
+double VariantUtilityFunctions::rad_to_deg(double p_angle_rad) {
+ return Math::rad_to_deg(p_angle_rad);
}
-double VariantUtilityFunctions::linear_to_db(double linear) {
- return Math::linear_to_db(linear);
+double VariantUtilityFunctions::linear_to_db(double p_linear) {
+ return Math::linear_to_db(p_linear);
}
-double VariantUtilityFunctions::db_to_linear(double db) {
- return Math::db_to_linear(db);
+double VariantUtilityFunctions::db_to_linear(double p_db) {
+ return Math::db_to_linear(p_db);
}
Variant VariantUtilityFunctions::wrap(const Variant &p_x, const Variant &p_min, const Variant &p_max, Callable::CallError &r_error) {
@@ -627,16 +627,16 @@ Variant VariantUtilityFunctions::wrap(const Variant &p_x, const Variant &p_min,
return value;
}
-int64_t VariantUtilityFunctions::wrapi(int64_t value, int64_t min, int64_t max) {
- return Math::wrapi(value, min, max);
+int64_t VariantUtilityFunctions::wrapi(int64_t p_value, int64_t p_min, int64_t p_max) {
+ return Math::wrapi(p_value, p_min, p_max);
}
-double VariantUtilityFunctions::wrapf(double value, double min, double max) {
- return Math::wrapf(value, min, max);
+double VariantUtilityFunctions::wrapf(double p_value, double p_min, double p_max) {
+ return Math::wrapf(p_value, p_min, p_max);
}
-double VariantUtilityFunctions::pingpong(double value, double length) {
- return Math::pingpong(value, length);
+double VariantUtilityFunctions::pingpong(double p_value, double p_length) {
+ return Math::pingpong(p_value, p_length);
}
Variant VariantUtilityFunctions::max(const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
@@ -675,12 +675,12 @@ Variant VariantUtilityFunctions::max(const Variant **p_args, int p_argcount, Cal
return base;
}
-double VariantUtilityFunctions::maxf(double x, double y) {
- return MAX(x, y);
+double VariantUtilityFunctions::maxf(double p_x, double p_y) {
+ return MAX(p_x, p_y);
}
-int64_t VariantUtilityFunctions::maxi(int64_t x, int64_t y) {
- return MAX(x, y);
+int64_t VariantUtilityFunctions::maxi(int64_t p_x, int64_t p_y) {
+ return MAX(p_x, p_y);
}
Variant VariantUtilityFunctions::min(const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
@@ -719,21 +719,21 @@ Variant VariantUtilityFunctions::min(const Variant **p_args, int p_argcount, Cal
return base;
}
-double VariantUtilityFunctions::minf(double x, double y) {
- return MIN(x, y);
+double VariantUtilityFunctions::minf(double p_x, double p_y) {
+ return MIN(p_x, p_y);
}
-int64_t VariantUtilityFunctions::mini(int64_t x, int64_t y) {
- return MIN(x, y);
+int64_t VariantUtilityFunctions::mini(int64_t p_x, int64_t p_y) {
+ return MIN(p_x, p_y);
}
-Variant VariantUtilityFunctions::clamp(const Variant &x, const Variant &min, const Variant &max, Callable::CallError &r_error) {
- Variant value = x;
+Variant VariantUtilityFunctions::clamp(const Variant &p_x, const Variant &p_min, const Variant &p_max, Callable::CallError &r_error) {
+ Variant value = p_x;
Variant ret;
bool valid;
- Variant::evaluate(Variant::OP_LESS, value, min, ret, valid);
+ Variant::evaluate(Variant::OP_LESS, value, p_min, ret, valid);
if (!valid) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 1;
@@ -741,9 +741,9 @@ Variant VariantUtilityFunctions::clamp(const Variant &x, const Variant &min, con
return Variant();
}
if (ret.booleanize()) {
- value = min;
+ value = p_min;
}
- Variant::evaluate(Variant::OP_GREATER, value, max, ret, valid);
+ Variant::evaluate(Variant::OP_GREATER, value, p_max, ret, valid);
if (!valid) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 2;
@@ -751,7 +751,7 @@ Variant VariantUtilityFunctions::clamp(const Variant &x, const Variant &min, con
return Variant();
}
if (ret.booleanize()) {
- value = max;
+ value = p_max;
}
r_error.error = Callable::CallError::CALL_OK;
@@ -759,16 +759,16 @@ Variant VariantUtilityFunctions::clamp(const Variant &x, const Variant &min, con
return value;
}
-double VariantUtilityFunctions::clampf(double x, double min, double max) {
- return CLAMP(x, min, max);
+double VariantUtilityFunctions::clampf(double p_x, double p_min, double p_max) {
+ return CLAMP(p_x, p_min, p_max);
}
-int64_t VariantUtilityFunctions::clampi(int64_t x, int64_t min, int64_t max) {
- return CLAMP(x, min, max);
+int64_t VariantUtilityFunctions::clampi(int64_t p_x, int64_t p_min, int64_t p_max) {
+ return CLAMP(p_x, p_min, p_max);
}
-int64_t VariantUtilityFunctions::nearest_po2(int64_t x) {
- return Math::nearest_power_of_2_templated(uint64_t(x));
+int64_t VariantUtilityFunctions::nearest_po2(int64_t p_x) {
+ return Math::nearest_power_of_2_templated(uint64_t(p_x));
}
// Random
@@ -785,24 +785,24 @@ double VariantUtilityFunctions::randf() {
return Math::randf();
}
-double VariantUtilityFunctions::randfn(double mean, double deviation) {
- return Math::randfn(mean, deviation);
+double VariantUtilityFunctions::randfn(double p_mean, double p_deviation) {
+ return Math::randfn(p_mean, p_deviation);
}
-int64_t VariantUtilityFunctions::randi_range(int64_t from, int64_t to) {
- return Math::random((int32_t)from, (int32_t)to);
+int64_t VariantUtilityFunctions::randi_range(int64_t p_from, int64_t p_to) {
+ return Math::random((int32_t)p_from, (int32_t)p_to);
}
-double VariantUtilityFunctions::randf_range(double from, double to) {
- return Math::random(from, to);
+double VariantUtilityFunctions::randf_range(double p_from, double p_to) {
+ return Math::random(p_from, p_to);
}
-void VariantUtilityFunctions::seed(int64_t s) {
- return Math::seed(s);
+void VariantUtilityFunctions::seed(int64_t p_seed) {
+ return Math::seed(p_seed);
}
-PackedInt64Array VariantUtilityFunctions::rand_from_seed(int64_t seed) {
- uint64_t s = seed;
+PackedInt64Array VariantUtilityFunctions::rand_from_seed(int64_t p_seed) {
+ uint64_t s = p_seed;
PackedInt64Array arr;
arr.resize(2);
arr.write[0] = Math::rand_from_seed(&s);
@@ -812,25 +812,25 @@ PackedInt64Array VariantUtilityFunctions::rand_from_seed(int64_t seed) {
// Utility
-Variant VariantUtilityFunctions::weakref(const Variant &obj, Callable::CallError &r_error) {
- if (obj.get_type() == Variant::OBJECT) {
+Variant VariantUtilityFunctions::weakref(const Variant &p_obj, Callable::CallError &r_error) {
+ if (p_obj.get_type() == Variant::OBJECT) {
r_error.error = Callable::CallError::CALL_OK;
- if (obj.is_ref_counted()) {
+ if (p_obj.is_ref_counted()) {
Ref<WeakRef> wref = memnew(WeakRef);
- Ref<RefCounted> r = obj;
+ Ref<RefCounted> r = p_obj;
if (r.is_valid()) {
wref->set_ref(r);
}
return wref;
} else {
Ref<WeakRef> wref = memnew(WeakRef);
- Object *o = obj.get_validated_object();
+ Object *o = p_obj.get_validated_object();
if (o) {
wref->set_obj(o);
}
return wref;
}
- } else if (obj.get_type() == Variant::NIL) {
+ } else if (p_obj.get_type() == Variant::NIL) {
r_error.error = Callable::CallError::CALL_OK;
Ref<WeakRef> wref = memnew(WeakRef);
return wref;
@@ -842,8 +842,8 @@ Variant VariantUtilityFunctions::weakref(const Variant &obj, Callable::CallError
}
}
-int64_t VariantUtilityFunctions::_typeof(const Variant &obj) {
- return obj.get_type();
+int64_t VariantUtilityFunctions::_typeof(const Variant &p_obj) {
+ return p_obj.get_type();
}
Variant VariantUtilityFunctions::type_convert(const Variant &p_variant, const Variant::Type p_type) {
@@ -927,7 +927,7 @@ Variant VariantUtilityFunctions::type_convert(const Variant &p_variant, const Va
case Variant::Type::PACKED_VECTOR4_ARRAY:
return p_variant.operator PackedVector4Array();
case Variant::Type::VARIANT_MAX:
- ERR_PRINT("Invalid type argument to type_convert(), use the TYPE_* constants. Returning the unconverted Variant.");
+ ERR_PRINT("Invalid type argument p_to type_convert(), use the TYPE_* constants. Returning the unconverted Variant.");
}
return p_variant;
}
@@ -944,16 +944,16 @@ String VariantUtilityFunctions::str(const Variant **p_args, int p_arg_count, Cal
return join_string(p_args, p_arg_count);
}
-String VariantUtilityFunctions::error_string(Error error) {
- if (error < 0 || error >= ERR_MAX) {
+String VariantUtilityFunctions::error_string(Error p_error) {
+ if (p_error < 0 || p_error >= ERR_MAX) {
return String("(invalid error code)");
}
- return String(error_names[error]);
+ return String(error_names[p_error]);
}
String VariantUtilityFunctions::type_string(Variant::Type p_type) {
- ERR_FAIL_INDEX_V_MSG((int)p_type, (int)Variant::VARIANT_MAX, "<invalid type>", "Invalid type argument to type_string(), use the TYPE_* constants.");
+ ERR_FAIL_INDEX_V_MSG((int)p_type, (int)Variant::VARIANT_MAX, "<invalid type>", "Invalid type argument p_to type_string(), use the TYPE_* constants.");
return Variant::get_type_name(p_type);
}
@@ -969,7 +969,7 @@ void VariantUtilityFunctions::print_rich(const Variant **p_args, int p_arg_count
void VariantUtilityFunctions::_print_verbose(const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
if (OS::get_singleton()->is_stdout_verbose()) {
- // No need to use `print_verbose()` as this call already only happens
+ // No need p_to use `print_verbose()` as this call already only happens
// when verbose mode is enabled. This avoids performing string argument concatenation
// when not needed.
print_line(join_string(p_args, p_arg_count));
@@ -1159,15 +1159,15 @@ String VariantUtilityFunctions::join_string(const Variant **p_args, int p_arg_co
}
#ifdef DEBUG_ENABLED
-#define VCALLR *ret = p_func(VariantCasterAndValidate<P>::cast(p_args, Is, r_error)...)
+#define VCALLR *r_ret = p_func(VariantCasterAndValidate<P>::cast(p_args, Is, r_error)...)
#define VCALL p_func(VariantCasterAndValidate<P>::cast(p_args, Is, r_error)...)
#else
-#define VCALLR *ret = p_func(VariantCaster<P>::cast(*p_args[Is])...)
+#define VCALLR *r_ret = p_func(VariantCaster<P>::cast(*p_args[Is])...)
#define VCALL p_func(VariantCaster<P>::cast(*p_args[Is])...)
#endif // DEBUG_ENABLED
template <typename R, typename... P, size_t... Is>
-static _FORCE_INLINE_ void call_helperpr(R (*p_func)(P...), Variant *ret, const Variant **p_args, Callable::CallError &r_error, IndexSequence<Is...>) {
+static _FORCE_INLINE_ void call_helperpr(R (*p_func)(P...), Variant *r_ret, const Variant **p_args, Callable::CallError &r_error, IndexSequence<Is...>) {
r_error.error = Callable::CallError::CALL_OK;
VCALLR;
(void)p_args; // avoid gcc warning
@@ -1175,30 +1175,30 @@ static _FORCE_INLINE_ void call_helperpr(R (*p_func)(P...), Variant *ret, const
}
template <typename R, typename... P, size_t... Is>
-static _FORCE_INLINE_ void validated_call_helperpr(R (*p_func)(P...), Variant *ret, const Variant **p_args, IndexSequence<Is...>) {
- *ret = p_func(VariantCaster<P>::cast(*p_args[Is])...);
+static _FORCE_INLINE_ void validated_call_helperpr(R (*p_func)(P...), Variant *r_ret, const Variant **p_args, IndexSequence<Is...>) {
+ *r_ret = p_func(VariantCaster<P>::cast(*p_args[Is])...);
(void)p_args;
}
template <typename R, typename... P, size_t... Is>
-static _FORCE_INLINE_ void ptr_call_helperpr(R (*p_func)(P...), void *ret, const void **p_args, IndexSequence<Is...>) {
- PtrToArg<R>::encode(p_func(PtrToArg<P>::convert(p_args[Is])...), ret);
+static _FORCE_INLINE_ void ptr_call_helperpr(R (*p_func)(P...), void *r_ret, const void **p_args, IndexSequence<Is...>) {
+ PtrToArg<R>::encode(p_func(PtrToArg<P>::convert(p_args[Is])...), r_ret);
(void)p_args;
}
template <typename R, typename... P>
-static _FORCE_INLINE_ void call_helperr(R (*p_func)(P...), Variant *ret, const Variant **p_args, Callable::CallError &r_error) {
- call_helperpr(p_func, ret, p_args, r_error, BuildIndexSequence<sizeof...(P)>{});
+static _FORCE_INLINE_ void call_helperr(R (*p_func)(P...), Variant *r_ret, const Variant **p_args, Callable::CallError &r_error) {
+ call_helperpr(p_func, r_ret, p_args, r_error, BuildIndexSequence<sizeof...(P)>{});
}
template <typename R, typename... P>
-static _FORCE_INLINE_ void validated_call_helperr(R (*p_func)(P...), Variant *ret, const Variant **p_args) {
- validated_call_helperpr(p_func, ret, p_args, BuildIndexSequence<sizeof...(P)>{});
+static _FORCE_INLINE_ void validated_call_helperr(R (*p_func)(P...), Variant *r_ret, const Variant **p_args) {
+ validated_call_helperpr(p_func, r_ret, p_args, BuildIndexSequence<sizeof...(P)>{});
}
template <typename R, typename... P>
-static _FORCE_INLINE_ void ptr_call_helperr(R (*p_func)(P...), void *ret, const void **p_args) {
- ptr_call_helperpr(p_func, ret, p_args, BuildIndexSequence<sizeof...(P)>{});
+static _FORCE_INLINE_ void ptr_call_helperr(R (*p_func)(P...), void *r_ret, const void **p_args) {
+ ptr_call_helperpr(p_func, r_ret, p_args, BuildIndexSequence<sizeof...(P)>{});
}
template <typename R, typename... P>
@@ -1277,8 +1277,8 @@ static _FORCE_INLINE_ Variant::Type get_ret_type_helper(void (*p_func)(P...)) {
static void validated_call(Variant *r_ret, const Variant **p_args, int p_argcount) { \
validated_call_helperr(VariantUtilityFunctions::m_func, r_ret, p_args); \
} \
- static void ptrcall(void *ret, const void **p_args, int p_argcount) { \
- ptr_call_helperr(VariantUtilityFunctions::m_func, ret, p_args); \
+ static void ptrcall(void *r_ret, const void **p_args, int p_argcount) { \
+ ptr_call_helperr(VariantUtilityFunctions::m_func, r_ret, p_args); \
} \
static int get_argument_count() { \
return get_arg_count_helperr(VariantUtilityFunctions::m_func); \
@@ -1312,9 +1312,9 @@ static _FORCE_INLINE_ Variant::Type get_ret_type_helper(void (*p_func)(P...)) {
Callable::CallError ce; \
*r_ret = VariantUtilityFunctions::m_func(*p_args[0], ce); \
} \
- static void ptrcall(void *ret, const void **p_args, int p_argcount) { \
+ static void ptrcall(void *r_ret, const void **p_args, int p_argcount) { \
Callable::CallError ce; \
- PtrToArg<Variant>::encode(VariantUtilityFunctions::m_func(PtrToArg<Variant>::convert(p_args[0]), ce), ret); \
+ PtrToArg<Variant>::encode(VariantUtilityFunctions::m_func(PtrToArg<Variant>::convert(p_args[0]), ce), r_ret); \
} \
static int get_argument_count() { \
return 1; \
@@ -1348,11 +1348,11 @@ static _FORCE_INLINE_ Variant::Type get_ret_type_helper(void (*p_func)(P...)) {
Callable::CallError ce; \
*r_ret = VariantUtilityFunctions::m_func(*p_args[0], *p_args[1], ce); \
} \
- static void ptrcall(void *ret, const void **p_args, int p_argcount) { \
+ static void ptrcall(void *r_ret, const void **p_args, int p_argcount) { \
Callable::CallError ce; \
Variant r; \
r = VariantUtilityFunctions::m_func(PtrToArg<Variant>::convert(p_args[0]), PtrToArg<Variant>::convert(p_args[1]), ce); \
- PtrToArg<Variant>::encode(r, ret); \
+ PtrToArg<Variant>::encode(r, r_ret); \
} \
static int get_argument_count() { \
return 2; \
@@ -1386,11 +1386,11 @@ static _FORCE_INLINE_ Variant::Type get_ret_type_helper(void (*p_func)(P...)) {
Callable::CallError ce; \
*r_ret = VariantUtilityFunctions::m_func(*p_args[0], *p_args[1], *p_args[2], ce); \
} \
- static void ptrcall(void *ret, const void **p_args, int p_argcount) { \
+ static void ptrcall(void *r_ret, const void **p_args, int p_argcount) { \
Callable::CallError ce; \
Variant r; \
r = VariantUtilityFunctions::m_func(PtrToArg<Variant>::convert(p_args[0]), PtrToArg<Variant>::convert(p_args[1]), PtrToArg<Variant>::convert(p_args[2]), ce); \
- PtrToArg<Variant>::encode(r, ret); \
+ PtrToArg<Variant>::encode(r, r_ret); \
} \
static int get_argument_count() { \
return 3; \
@@ -1424,7 +1424,7 @@ static _FORCE_INLINE_ Variant::Type get_ret_type_helper(void (*p_func)(P...)) {
Callable::CallError c; \
*r_ret = VariantUtilityFunctions::m_func(p_args, p_argcount, c); \
} \
- static void ptrcall(void *ret, const void **p_args, int p_argcount) { \
+ static void ptrcall(void *r_ret, const void **p_args, int p_argcount) { \
Vector<Variant> args; \
for (int i = 0; i < p_argcount; i++) { \
args.push_back(PtrToArg<Variant>::convert(p_args[i])); \
@@ -1435,7 +1435,7 @@ static _FORCE_INLINE_ Variant::Type get_ret_type_helper(void (*p_func)(P...)) {
} \
Variant r; \
validated_call(&r, (const Variant **)argsp.ptr(), p_argcount); \
- PtrToArg<Variant>::encode(r, ret); \
+ PtrToArg<Variant>::encode(r, r_ret); \
} \
static int get_argument_count() { \
return 2; \
@@ -1469,7 +1469,7 @@ static _FORCE_INLINE_ Variant::Type get_ret_type_helper(void (*p_func)(P...)) {
Callable::CallError c; \
*r_ret = VariantUtilityFunctions::m_func(p_args, p_argcount, c); \
} \
- static void ptrcall(void *ret, const void **p_args, int p_argcount) { \
+ static void ptrcall(void *r_ret, const void **p_args, int p_argcount) { \
Vector<Variant> args; \
for (int i = 0; i < p_argcount; i++) { \
args.push_back(PtrToArg<Variant>::convert(p_args[i])); \
@@ -1480,7 +1480,7 @@ static _FORCE_INLINE_ Variant::Type get_ret_type_helper(void (*p_func)(P...)) {
} \
Variant r; \
validated_call(&r, (const Variant **)argsp.ptr(), p_argcount); \
- PtrToArg<String>::encode(r.operator String(), ret); \
+ PtrToArg<String>::encode(r.operator String(), r_ret); \
} \
static int get_argument_count() { \
return 1; \
@@ -1514,7 +1514,7 @@ static _FORCE_INLINE_ Variant::Type get_ret_type_helper(void (*p_func)(P...)) {
Callable::CallError c; \
VariantUtilityFunctions::m_func_cname(p_args, p_argcount, c); \
} \
- static void ptrcall(void *ret, const void **p_args, int p_argcount) { \
+ static void ptrcall(void *r_ret, const void **p_args, int p_argcount) { \
Vector<Variant> args; \
for (int i = 0; i < p_argcount; i++) { \
args.push_back(PtrToArg<Variant>::convert(p_args[i])); \
@@ -1558,7 +1558,7 @@ static _FORCE_INLINE_ Variant::Type get_ret_type_helper(void (*p_func)(P...)) {
static void validated_call(Variant *r_ret, const Variant **p_args, int p_argcount) { \
validated_call_helper(VariantUtilityFunctions::m_func, p_args); \
} \
- static void ptrcall(void *ret, const void **p_args, int p_argcount) { \
+ static void ptrcall(void *r_ret, const void **p_args, int p_argcount) { \
ptr_call_helper(VariantUtilityFunctions::m_func, p_args); \
} \
static int get_argument_count() { \
@@ -1599,7 +1599,7 @@ static AHashMap<StringName, VariantUtilityFunctionInfo> utility_function_table;
static List<StringName> utility_function_name_table;
template <typename T>
-static void register_utility_function(const String &p_name, const Vector<String> &argnames) {
+static void register_utility_function(const String &p_name, const Vector<String> &p_argnames) {
String name = p_name;
if (name.begins_with("_")) {
name = name.substr(1);
@@ -1612,10 +1612,10 @@ static void register_utility_function(const String &p_name, const Vector<String>
bfi.validated_call_utility = T::validated_call;
bfi.ptr_call_utility = T::ptrcall;
bfi.is_vararg = T::is_vararg();
- bfi.argnames = argnames;
+ bfi.argnames = p_argnames;
bfi.argcount = T::get_argument_count();
if (!bfi.is_vararg) {
- ERR_FAIL_COND_MSG(argnames.size() != bfi.argcount, vformat("Wrong number of arguments binding utility function: '%s'.", name));
+ ERR_FAIL_COND_MSG(p_argnames.size() != bfi.argcount, vformat("Wrong number of arguments binding utility function: '%s'.", name));
}
bfi.get_arg_type = T::get_argument_type;
bfi.return_type = T::get_return_type();
@@ -1854,10 +1854,10 @@ MethodInfo Variant::get_utility_function_info(const StringName &p_name) {
info.flags |= METHOD_FLAG_VARARG;
}
for (int i = 0; i < bfi->argnames.size(); ++i) {
- PropertyInfo arg;
- arg.type = bfi->get_arg_type(i);
- arg.name = bfi->argnames[i];
- info.arguments.push_back(arg);
+ PropertyInfo p_arg;
+ p_arg.type = bfi->get_arg_type(i);
+ p_arg.name = bfi->argnames[i];
+ info.arguments.push_back(p_arg);
}
}
return info;
diff --git a/core/variant/variant_utility.h b/core/variant/variant_utility.h
index d8a6fafdb8c..5972c3c73ca 100644
--- a/core/variant/variant_utility.h
+++ b/core/variant/variant_utility.h
@@ -34,101 +34,101 @@
struct VariantUtilityFunctions {
// Math
- static double sin(double arg);
- static double cos(double arg);
- static double tan(double arg);
- static double sinh(double arg);
- static double cosh(double arg);
- static double tanh(double arg);
- static double asin(double arg);
- static double acos(double arg);
- static double atan(double arg);
- static double atan2(double y, double x);
- static double asinh(double arg);
- static double acosh(double arg);
- static double atanh(double arg);
- static double sqrt(double x);
- static double fmod(double b, double r);
- static double fposmod(double b, double r);
- static int64_t posmod(int64_t b, int64_t r);
- static Variant floor(const Variant &x, Callable::CallError &r_error);
- static double floorf(double x);
- static int64_t floori(double x);
- static Variant ceil(const Variant &x, Callable::CallError &r_error);
- static double ceilf(double x);
- static int64_t ceili(double x);
- static Variant round(const Variant &x, Callable::CallError &r_error);
- static double roundf(double x);
- static int64_t roundi(double x);
- static Variant abs(const Variant &x, Callable::CallError &r_error);
- static double absf(double x);
- static int64_t absi(int64_t x);
- static Variant sign(const Variant &x, Callable::CallError &r_error);
- static double signf(double x);
- static int64_t signi(int64_t x);
- static double pow(double x, double y);
- static double log(double x);
- static double exp(double x);
- static bool is_nan(double x);
- static bool is_inf(double x);
- static bool is_equal_approx(double x, double y);
- static bool is_zero_approx(double x);
- static bool is_finite(double x);
- static double ease(double x, double curve);
- static int step_decimals(double step);
- static Variant snapped(const Variant &x, const Variant &step, Callable::CallError &r_error);
- static double snappedf(double x, double step);
- static int64_t snappedi(double x, int64_t step);
- static Variant lerp(const Variant &from, const Variant &to, double weight, Callable::CallError &r_error);
- static double lerpf(double from, double to, double weight);
- static double cubic_interpolate(double from, double to, double pre, double post, double weight);
- static double cubic_interpolate_angle(double from, double to, double pre, double post, double weight);
- static double cubic_interpolate_in_time(double from, double to, double pre, double post, double weight,
- double to_t, double pre_t, double post_t);
- static double cubic_interpolate_angle_in_time(double from, double to, double pre, double post, double weight,
- double to_t, double pre_t, double post_t);
+ static double sin(double p_arg);
+ static double cos(double p_arg);
+ static double tan(double p_arg);
+ static double sinh(double p_arg);
+ static double cosh(double p_arg);
+ static double tanh(double p_arg);
+ static double asin(double p_arg);
+ static double acos(double p_arg);
+ static double atan(double p_arg);
+ static double atan2(double p_y, double p_x);
+ static double asinh(double p_arg);
+ static double acosh(double p_arg);
+ static double atanh(double p_arg);
+ static double sqrt(double p_x);
+ static double fmod(double p_b, double p_r);
+ static double fposmod(double p_b, double p_r);
+ static int64_t posmod(int64_t p_b, int64_t p_r);
+ static Variant floor(const Variant &p_x, Callable::CallError &r_error);
+ static double floorf(double p_x);
+ static int64_t floori(double p_x);
+ static Variant ceil(const Variant &p_x, Callable::CallError &r_error);
+ static double ceilf(double p_x);
+ static int64_t ceili(double p_x);
+ static Variant round(const Variant &p_x, Callable::CallError &r_error);
+ static double roundf(double p_x);
+ static int64_t roundi(double p_x);
+ static Variant abs(const Variant &p_x, Callable::CallError &r_error);
+ static double absf(double p_x);
+ static int64_t absi(int64_t p_x);
+ static Variant sign(const Variant &p_x, Callable::CallError &r_error);
+ static double signf(double p_x);
+ static int64_t signi(int64_t p_x);
+ static double pow(double p_x, double p_y);
+ static double log(double p_x);
+ static double exp(double p_x);
+ static bool is_nan(double p_x);
+ static bool is_inf(double p_x);
+ static bool is_equal_approx(double p_x, double p_y);
+ static bool is_zero_approx(double p_x);
+ static bool is_finite(double p_x);
+ static double ease(double p_x, double p_curve);
+ static int step_decimals(double p_step);
+ static Variant snapped(const Variant &p_x, const Variant &p_step, Callable::CallError &r_error);
+ static double snappedf(double p_x, double p_step);
+ static int64_t snappedi(double p_x, int64_t p_step);
+ static Variant lerp(const Variant &p_from, const Variant &p_to, double p_weight, Callable::CallError &r_error);
+ static double lerpf(double p_from, double p_to, double p_weight);
+ static double cubic_interpolate(double p_from, double p_to, double p_pre, double p_post, double p_weight);
+ static double cubic_interpolate_angle(double p_from, double p_to, double p_pre, double p_post, double p_weight);
+ static double cubic_interpolate_in_time(double p_from, double p_to, double p_pre, double p_post, double p_weight,
+ double p_to_t, double p_pre_t, double p_post_t);
+ static double cubic_interpolate_angle_in_time(double p_from, double p_to, double p_pre, double p_post, double p_weight,
+ double p_to_t, double p_pre_t, double p_post_t);
static double bezier_interpolate(double p_start, double p_control_1, double p_control_2, double p_end, double p_t);
static double bezier_derivative(double p_start, double p_control_1, double p_control_2, double p_end, double p_t);
- static double angle_difference(double from, double to);
- static double lerp_angle(double from, double to, double weight);
- static double inverse_lerp(double from, double to, double weight);
- static double remap(double value, double istart, double istop, double ostart, double ostop);
- static double smoothstep(double from, double to, double val);
- static double move_toward(double from, double to, double delta);
- static double rotate_toward(double from, double to, double delta);
- static double deg_to_rad(double angle_deg);
- static double rad_to_deg(double angle_rad);
- static double linear_to_db(double linear);
- static double db_to_linear(double db);
+ static double angle_difference(double p_from, double p_to);
+ static double lerp_angle(double p_from, double p_to, double p_weight);
+ static double inverse_lerp(double p_from, double p_to, double p_weight);
+ static double remap(double p_value, double p_istart, double p_istop, double p_ostart, double p_ostop);
+ static double smoothstep(double p_from, double p_to, double p_val);
+ static double move_toward(double p_from, double p_to, double p_delta);
+ static double rotate_toward(double p_from, double p_to, double p_delta);
+ static double deg_to_rad(double p_angle_deg);
+ static double rad_to_deg(double p_angle_rad);
+ static double linear_to_db(double p_linear);
+ static double db_to_linear(double p_db);
static Variant wrap(const Variant &p_x, const Variant &p_min, const Variant &p_max, Callable::CallError &r_error);
- static int64_t wrapi(int64_t value, int64_t min, int64_t max);
- static double wrapf(double value, double min, double max);
- static double pingpong(double value, double length);
+ static int64_t wrapi(int64_t p_value, int64_t p_min, int64_t p_max);
+ static double wrapf(double p_value, double p_min, double p_max);
+ static double pingpong(double p_value, double p_length);
static Variant max(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
- static double maxf(double x, double y);
- static int64_t maxi(int64_t x, int64_t y);
+ static double maxf(double p_x, double p_y);
+ static int64_t maxi(int64_t p_x, int64_t p_y);
static Variant min(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
- static double minf(double x, double y);
- static int64_t mini(int64_t x, int64_t y);
- static Variant clamp(const Variant &x, const Variant &min, const Variant &max, Callable::CallError &r_error);
- static double clampf(double x, double min, double max);
- static int64_t clampi(int64_t x, int64_t min, int64_t max);
- static int64_t nearest_po2(int64_t x);
+ static double minf(double p_x, double p_y);
+ static int64_t mini(int64_t p_x, int64_t p_y);
+ static Variant clamp(const Variant &p_x, const Variant &p_min, const Variant &p_max, Callable::CallError &r_error);
+ static double clampf(double p_x, double p_min, double p_max);
+ static int64_t clampi(int64_t p_x, int64_t p_min, int64_t p_max);
+ static int64_t nearest_po2(int64_t p_x);
// Random
static void randomize();
static int64_t randi();
static double randf();
- static double randfn(double mean, double deviation);
- static int64_t randi_range(int64_t from, int64_t to);
- static double randf_range(double from, double to);
- static void seed(int64_t s);
- static PackedInt64Array rand_from_seed(int64_t seed);
+ static double randfn(double p_mean, double p_deviation);
+ static int64_t randi_range(int64_t p_from, int64_t p_to);
+ static double randf_range(double p_from, double p_to);
+ static void seed(int64_t p_seed);
+ static PackedInt64Array rand_from_seed(int64_t p_seed);
// Utility
- static Variant weakref(const Variant &obj, Callable::CallError &r_error);
- static int64_t _typeof(const Variant &obj);
+ static Variant weakref(const Variant &p_obj, Callable::CallError &r_error);
+ static int64_t _typeof(const Variant &p_obj);
static Variant type_convert(const Variant &p_variant, const Variant::Type p_type);
static String str(const Variant **p_args, int p_arg_count, Callable::CallError &r_error);
- static String error_string(Error error);
+ static String error_string(Error p_error);
static String type_string(Variant::Type p_type);
static void print(const Variant **p_args, int p_arg_count, Callable::CallError &r_error);
static void print_rich(const Variant **p_args, int p_arg_count, Callable::CallError &r_error);
diff --git a/misc/scripts/ucaps_fetch.py b/misc/scripts/ucaps_fetch.py
index d173dfa17ce..27ed978708f 100755
--- a/misc/scripts/ucaps_fetch.py
+++ b/misc/scripts/ucaps_fetch.py
@@ -66,7 +66,7 @@ def generate_ucaps_fetch() -> None:
source += make_cap_table("caps_table", "LTU_LEN", lower_to_upper)
source += make_cap_table("reverse_caps_table", "UTL_LEN", upper_to_lower)
- source += """static int _find_upper(int ch) {
+ source += """static int _find_upper(int p_char) {
\tint low = 0;
\tint high = LTU_LEN - 1;
\tint middle;
@@ -74,19 +74,19 @@ def generate_ucaps_fetch() -> None:
\twhile (low <= high) {
\t\tmiddle = (low + high) / 2;
-\t\tif (ch < caps_table[middle][0]) {
+\t\tif (p_char < caps_table[middle][0]) {
\t\t\thigh = middle - 1; // Search low end of array.
-\t\t} else if (caps_table[middle][0] < ch) {
+\t\t} else if (caps_table[middle][0] < p_char) {
\t\t\tlow = middle + 1; // Search high end of array.
\t\t} else {
\t\t\treturn caps_table[middle][1];
\t\t}
\t}
-\treturn ch;
+\treturn p_char;
}
-static int _find_lower(int ch) {
+static int _find_lower(int p_char) {
\tint low = 0;
\tint high = UTL_LEN - 1;
\tint middle;
@@ -94,16 +94,16 @@ static int _find_lower(int ch) {
\twhile (low <= high) {
\t\tmiddle = (low + high) / 2;
-\t\tif (ch < reverse_caps_table[middle][0]) {
+\t\tif (p_char < reverse_caps_table[middle][0]) {
\t\t\thigh = middle - 1; // Search low end of array.
-\t\t} else if (reverse_caps_table[middle][0] < ch) {
+\t\t} else if (reverse_caps_table[middle][0] < p_char) {
\t\t\tlow = middle + 1; // Search high end of array.
\t\t} else {
\t\t\treturn reverse_caps_table[middle][1];
\t\t}
\t}
-\treturn ch;
+\treturn p_char;
}
"""