summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/bind/core_bind.cpp5
-rw-r--r--core/bind/core_bind.h1
-rw-r--r--core/engine.cpp1
-rw-r--r--core/engine.h2
-rw-r--r--core/image.cpp54
-rw-r--r--core/input_map.cpp2
-rw-r--r--core/io/resource_format_binary.cpp2
-rw-r--r--core/io/resource_saver.cpp1
-rw-r--r--core/io/stream_peer.cpp4
-rw-r--r--core/math/bsp_tree.cpp4
-rw-r--r--core/math/expression.cpp23
-rw-r--r--core/math/expression.h2
-rw-r--r--core/math/math_funcs.h18
-rw-r--r--core/object.cpp9
-rw-r--r--core/object.h9
-rw-r--r--core/pool_allocator.cpp2
-rw-r--r--core/pool_vector.h4
-rw-r--r--core/string_name.cpp3
-rw-r--r--core/variant.cpp4
-rw-r--r--core/variant_call.cpp2
-rw-r--r--core/variant_op.cpp2
-rw-r--r--core/variant_parser.cpp2
22 files changed, 99 insertions, 57 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 34bbdb2c75..b41b84ab1e 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -2941,6 +2941,10 @@ float _Engine::get_physics_jitter_fix() const {
return Engine::get_singleton()->get_physics_jitter_fix();
}
+float _Engine::get_physics_interpolation_fraction() const {
+ return Engine::get_singleton()->get_physics_interpolation_fraction();
+}
+
void _Engine::set_target_fps(int p_fps) {
Engine::get_singleton()->set_target_fps(p_fps);
}
@@ -3029,6 +3033,7 @@ void _Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_iterations_per_second"), &_Engine::get_iterations_per_second);
ClassDB::bind_method(D_METHOD("set_physics_jitter_fix", "physics_jitter_fix"), &_Engine::set_physics_jitter_fix);
ClassDB::bind_method(D_METHOD("get_physics_jitter_fix"), &_Engine::get_physics_jitter_fix);
+ ClassDB::bind_method(D_METHOD("get_physics_interpolation_fraction"), &_Engine::get_physics_interpolation_fraction);
ClassDB::bind_method(D_METHOD("set_target_fps", "target_fps"), &_Engine::set_target_fps);
ClassDB::bind_method(D_METHOD("get_target_fps"), &_Engine::get_target_fps);
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 3be5a08752..f0f86e003f 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -746,6 +746,7 @@ public:
void set_physics_jitter_fix(float p_threshold);
float get_physics_jitter_fix() const;
+ float get_physics_interpolation_fraction() const;
void set_target_fps(int p_fps);
int get_target_fps() const;
diff --git a/core/engine.cpp b/core/engine.cpp
index 2d8473fbd9..0dd0459403 100644
--- a/core/engine.cpp
+++ b/core/engine.cpp
@@ -227,6 +227,7 @@ Engine::Engine() {
frames_drawn = 0;
ips = 60;
physics_jitter_fix = 0.5;
+ _physics_interpolation_fraction = 0.0f;
_frame_delay = 0;
_fps = 1;
_target_fps = 0;
diff --git a/core/engine.h b/core/engine.h
index 15665fee29..192e8e67a0 100644
--- a/core/engine.h
+++ b/core/engine.h
@@ -63,6 +63,7 @@ private:
float _time_scale;
bool _pixel_snap;
uint64_t _physics_frames;
+ float _physics_interpolation_fraction;
uint64_t _idle_frames;
bool _in_physics;
@@ -95,6 +96,7 @@ public:
bool is_in_physics_frame() const { return _in_physics; }
uint64_t get_idle_frame_ticks() const { return _frame_ticks; }
float get_idle_frame_step() const { return _frame_step; }
+ float get_physics_interpolation_fraction() const { return _physics_interpolation_fraction; }
void set_time_scale(float p_scale);
float get_time_scale() const;
diff --git a/core/image.cpp b/core/image.cpp
index a88395204a..10778eced6 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -240,27 +240,27 @@ int Image::get_format_block_size(Format p_format) {
case FORMAT_RGTC_RG: { //bc5 case case FORMAT_DXT1:
return 4;
- } break;
+ }
case FORMAT_PVRTC2:
case FORMAT_PVRTC2A: {
return 4;
- } break;
+ }
case FORMAT_PVRTC4A:
case FORMAT_PVRTC4: {
return 4;
- } break;
+ }
case FORMAT_ETC: {
return 4;
- } break;
+ }
case FORMAT_BPTC_RGBA:
case FORMAT_BPTC_RGBF:
case FORMAT_BPTC_RGBFU: {
return 4;
- } break;
+ }
case FORMAT_ETC2_R11: //etc2
case FORMAT_ETC2_R11S: //signed: NOT srgb.
case FORMAT_ETC2_RG11:
@@ -270,7 +270,7 @@ int Image::get_format_block_size(Format p_format) {
case FORMAT_ETC2_RGB8A1: {
return 4;
- } break;
+ }
default: {
}
}
@@ -852,7 +852,7 @@ static void _scale_lanczos(const uint8_t *__restrict p_src, uint8_t *__restrict
static void _overlay(const uint8_t *__restrict p_src, uint8_t *__restrict p_dst, float p_alpha, uint32_t p_width, uint32_t p_height, uint32_t p_pixel_size) {
- uint16_t alpha = CLAMP((uint16_t)(p_alpha * 256.0f), 0, 256);
+ uint16_t alpha = MIN((uint16_t)(p_alpha * 256.0f), 256);
for (uint32_t i = 0; i < p_width * p_height * p_pixel_size; i++) {
@@ -2421,38 +2421,36 @@ Color Image::get_pixel(int p_x, int p_y) const {
case FORMAT_L8: {
float l = ptr[ofs] / 255.0;
return Color(l, l, l, 1);
- } break;
+ }
case FORMAT_LA8: {
float l = ptr[ofs * 2 + 0] / 255.0;
float a = ptr[ofs * 2 + 1] / 255.0;
return Color(l, l, l, a);
- } break;
+ }
case FORMAT_R8: {
float r = ptr[ofs] / 255.0;
return Color(r, 0, 0, 1);
- } break;
+ }
case FORMAT_RG8: {
float r = ptr[ofs * 2 + 0] / 255.0;
float g = ptr[ofs * 2 + 1] / 255.0;
return Color(r, g, 0, 1);
- } break;
+ }
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;
return Color(r, g, b, 1);
-
- } break;
+ }
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;
return Color(r, g, b, a);
-
- } break;
+ }
case FORMAT_RGBA4444: {
uint16_t u = ((uint16_t *)ptr)[ofs];
float r = (u & 0xF) / 15.0;
@@ -2460,8 +2458,7 @@ Color Image::get_pixel(int p_x, int p_y) const {
float b = ((u >> 8) & 0xF) / 15.0;
float a = ((u >> 12) & 0xF) / 15.0;
return Color(r, g, b, a);
-
- } break;
+ }
case FORMAT_RGBA5551: {
uint16_t u = ((uint16_t *)ptr)[ofs];
@@ -2470,25 +2467,25 @@ Color Image::get_pixel(int p_x, int p_y) const {
float b = ((u >> 10) & 0x1F) / 15.0;
float a = ((u >> 15) & 0x1) / 1.0;
return Color(r, g, b, a);
- } break;
+ }
case FORMAT_RF: {
float r = ((float *)ptr)[ofs];
return Color(r, 0, 0, 1);
- } break;
+ }
case FORMAT_RGF: {
float r = ((float *)ptr)[ofs * 2 + 0];
float g = ((float *)ptr)[ofs * 2 + 1];
return Color(r, g, 0, 1);
- } break;
+ }
case FORMAT_RGBF: {
float r = ((float *)ptr)[ofs * 3 + 0];
float g = ((float *)ptr)[ofs * 3 + 1];
float b = ((float *)ptr)[ofs * 3 + 2];
return Color(r, g, b, 1);
- } break;
+ }
case FORMAT_RGBAF: {
float r = ((float *)ptr)[ofs * 4 + 0];
@@ -2496,25 +2493,25 @@ Color Image::get_pixel(int p_x, int p_y) const {
float b = ((float *)ptr)[ofs * 4 + 2];
float a = ((float *)ptr)[ofs * 4 + 3];
return Color(r, g, b, a);
- } break;
+ }
case FORMAT_RH: {
uint16_t r = ((uint16_t *)ptr)[ofs];
return Color(Math::half_to_float(r), 0, 0, 1);
- } break;
+ }
case FORMAT_RGH: {
uint16_t r = ((uint16_t *)ptr)[ofs * 2 + 0];
uint16_t g = ((uint16_t *)ptr)[ofs * 2 + 1];
return Color(Math::half_to_float(r), Math::half_to_float(g), 0, 1);
- } break;
+ }
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];
return Color(Math::half_to_float(r), Math::half_to_float(g), Math::half_to_float(b), 1);
- } break;
+ }
case FORMAT_RGBAH: {
uint16_t r = ((uint16_t *)ptr)[ofs * 4 + 0];
@@ -2522,18 +2519,15 @@ Color Image::get_pixel(int p_x, int p_y) const {
uint16_t b = ((uint16_t *)ptr)[ofs * 4 + 2];
uint16_t a = ((uint16_t *)ptr)[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));
- } break;
+ }
case FORMAT_RGBE9995: {
return Color::from_rgbe9995(((uint32_t *)ptr)[ofs]);
-
- } break;
+ }
default: {
ERR_EXPLAIN("Can't get_pixel() on compressed image, sorry.");
ERR_FAIL_V(Color());
}
}
-
- return Color();
}
void Image::set_pixelv(const Point2 &p_dst, const Color &p_color) {
diff --git a/core/input_map.cpp b/core/input_map.cpp
index 04911787a8..165999f081 100644
--- a/core/input_map.cpp
+++ b/core/input_map.cpp
@@ -202,7 +202,7 @@ bool InputMap::event_get_action_status(const Ref<InputEvent> &p_event, const Str
if (p_pressed != NULL)
*p_pressed = input_event_action->is_pressed();
if (p_strength != NULL)
- *p_strength = (*p_pressed) ? input_event_action->get_strength() : 0.0f;
+ *p_strength = (p_pressed != NULL && *p_pressed) ? input_event_action->get_strength() : 0.0f;
return input_event_action->get_action() == p_action;
}
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 861e34e415..38bef2768e 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -712,8 +712,8 @@ Error ResourceInteractiveLoaderBinary::poll() {
if (!obj) {
error = ERR_FILE_CORRUPT;
ERR_EXPLAIN(local_path + ":Resource of unrecognized type in file: " + t);
+ ERR_FAIL_V(ERR_FILE_CORRUPT);
}
- ERR_FAIL_COND_V(!obj, ERR_FILE_CORRUPT);
Resource *r = Object::cast_to<Resource>(obj);
if (!r) {
diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp
index 0cecca904d..e2c1c3402a 100644
--- a/core/io/resource_saver.cpp
+++ b/core/io/resource_saver.cpp
@@ -137,7 +137,6 @@ Error ResourceSaver::save(const String &p_path, const RES &p_resource, uint32_t
save_callback(p_resource, p_path);
return OK;
- } else {
}
}
diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp
index acf72dbba5..84b8554d54 100644
--- a/core/io/stream_peer.cpp
+++ b/core/io/stream_peer.cpp
@@ -369,7 +369,9 @@ Variant StreamPeer::get_var(bool p_allow_objects) {
ERR_FAIL_COND_V(err != OK, Variant());
Variant ret;
- decode_variant(ret, var.ptr(), len, NULL, p_allow_objects);
+ err = decode_variant(ret, var.ptr(), len, NULL, p_allow_objects);
+ ERR_FAIL_COND_V(err != OK, Variant());
+
return ret;
}
diff --git a/core/math/bsp_tree.cpp b/core/math/bsp_tree.cpp
index a12f9fee2e..cfa698282e 100644
--- a/core/math/bsp_tree.cpp
+++ b/core/math/bsp_tree.cpp
@@ -192,7 +192,7 @@ int BSP_Tree::get_points_inside(const Vector3 *p_points, int p_point_count) cons
#ifdef DEBUG_ENABLED
int plane_count = planes.size();
uint16_t plane = nodesptr[idx].plane;
- ERR_FAIL_INDEX_V(plane, plane_count, false);
+ ERR_FAIL_UNSIGNED_INDEX_V(plane, plane_count, false);
#endif
idx = planesptr[nodesptr[idx].plane].is_point_over(point) ? nodes[idx].over : nodes[idx].under;
@@ -258,7 +258,7 @@ bool BSP_Tree::point_is_inside(const Vector3 &p_point) const {
#ifdef DEBUG_ENABLED
int plane_count = planes.size();
uint16_t plane = nodesptr[idx].plane;
- ERR_FAIL_INDEX_V(plane, plane_count, false);
+ ERR_FAIL_UNSIGNED_INDEX_V(plane, plane_count, false);
#endif
bool over = planesptr[nodesptr[idx].plane].is_point_over(p_point);
diff --git a/core/math/expression.cpp b/core/math/expression.cpp
index b52658e2cf..15eea1d308 100644
--- a/core/math/expression.cpp
+++ b/core/math/expression.cpp
@@ -52,6 +52,7 @@ const char *Expression::func_name[Expression::FUNC_MAX] = {
"sqrt",
"fmod",
"fposmod",
+ "posmod",
"floor",
"ceil",
"round",
@@ -67,6 +68,7 @@ const char *Expression::func_name[Expression::FUNC_MAX] = {
"step_decimals",
"stepify",
"lerp",
+ "lerp_angle",
"inverse_lerp",
"range_lerp",
"smoothstep",
@@ -175,6 +177,7 @@ int Expression::get_func_argument_count(BuiltinFunc p_func) {
case MATH_ATAN2:
case MATH_FMOD:
case MATH_FPOSMOD:
+ case MATH_POSMOD:
case MATH_POW:
case MATH_EASE:
case MATH_STEPIFY:
@@ -188,6 +191,7 @@ int Expression::get_func_argument_count(BuiltinFunc p_func) {
case COLORN:
return 2;
case MATH_LERP:
+ case MATH_LERP_ANGLE:
case MATH_INVERSE_LERP:
case MATH_SMOOTHSTEP:
case MATH_MOVE_TOWARD:
@@ -283,6 +287,12 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant
VALIDATE_ARG_NUM(1);
*r_return = Math::fposmod((double)*p_inputs[0], (double)*p_inputs[1]);
} break;
+ case MATH_POSMOD: {
+
+ VALIDATE_ARG_NUM(0);
+ VALIDATE_ARG_NUM(1);
+ *r_return = Math::posmod((int)*p_inputs[0], (int)*p_inputs[1]);
+ } break;
case MATH_FLOOR: {
VALIDATE_ARG_NUM(0);
@@ -387,6 +397,13 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant
VALIDATE_ARG_NUM(2);
*r_return = Math::lerp((double)*p_inputs[0], (double)*p_inputs[1], (double)*p_inputs[2]);
} break;
+ case MATH_LERP_ANGLE: {
+
+ VALIDATE_ARG_NUM(0);
+ VALIDATE_ARG_NUM(1);
+ VALIDATE_ARG_NUM(2);
+ *r_return = Math::lerp_angle((double)*p_inputs[0], (double)*p_inputs[1], (double)*p_inputs[2]);
+ } break;
case MATH_INVERSE_LERP: {
VALIDATE_ARG_NUM(0);
@@ -793,17 +810,13 @@ Error Expression::_get_token(Token &r_token) {
#define GET_CHAR() (str_ofs >= expression.length() ? 0 : expression[str_ofs++])
CharType cchar = GET_CHAR();
- if (cchar == 0) {
- r_token.type = TK_EOF;
- return OK;
- }
switch (cchar) {
case 0: {
r_token.type = TK_EOF;
return OK;
- } break;
+ };
case '{': {
r_token.type = TK_CURLY_BRACKET_OPEN;
diff --git a/core/math/expression.h b/core/math/expression.h
index 1113bb6587..833220592c 100644
--- a/core/math/expression.h
+++ b/core/math/expression.h
@@ -51,6 +51,7 @@ public:
MATH_SQRT,
MATH_FMOD,
MATH_FPOSMOD,
+ MATH_POSMOD,
MATH_FLOOR,
MATH_CEIL,
MATH_ROUND,
@@ -66,6 +67,7 @@ public:
MATH_STEP_DECIMALS,
MATH_STEPIFY,
MATH_LERP,
+ MATH_LERP_ANGLE,
MATH_INVERSE_LERP,
MATH_RANGE_LERP,
MATH_SMOOTHSTEP,
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h
index 0e3bd8a318..b8b5151802 100644
--- a/core/math/math_funcs.h
+++ b/core/math/math_funcs.h
@@ -198,6 +198,13 @@ public:
value += 0.0;
return value;
}
+ static _ALWAYS_INLINE_ int posmod(int p_x, int p_y) {
+ int value = p_x % p_y;
+ if ((value < 0 && p_y > 0) || (value > 0 && p_y < 0)) {
+ value += p_y;
+ }
+ return value;
+ }
static _ALWAYS_INLINE_ double deg2rad(double p_y) { return p_y * Math_PI / 180.0; }
static _ALWAYS_INLINE_ float deg2rad(float p_y) { return p_y * Math_PI / 180.0; }
@@ -208,6 +215,17 @@ public:
static _ALWAYS_INLINE_ double lerp(double p_from, double p_to, double p_weight) { return p_from + (p_to - p_from) * p_weight; }
static _ALWAYS_INLINE_ float lerp(float p_from, float p_to, float p_weight) { return p_from + (p_to - p_from) * p_weight; }
+ static _ALWAYS_INLINE_ double lerp_angle(double p_from, double p_to, double p_weight) {
+ double difference = fmod(p_to - p_from, Math_TAU);
+ double distance = fmod(2.0 * difference, Math_TAU) - difference;
+ return p_from + distance * p_weight;
+ }
+ static _ALWAYS_INLINE_ float lerp_angle(float p_from, float p_to, float p_weight) {
+ float difference = fmod(p_to - p_from, (float)Math_TAU);
+ float distance = fmod(2.0f * difference, (float)Math_TAU) - difference;
+ return p_from + distance * p_weight;
+ }
+
static _ALWAYS_INLINE_ double inverse_lerp(double p_from, double p_to, double p_value) { return (p_value - p_from) / (p_to - p_from); }
static _ALWAYS_INLINE_ float inverse_lerp(float p_from, float p_to, float p_value) { return (p_value - p_from) / (p_to - p_from); }
diff --git a/core/object.cpp b/core/object.cpp
index 3367d6b6c3..67ab27c190 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -635,9 +635,12 @@ void Object::get_property_list(List<PropertyInfo> *p_list, bool p_reversed) cons
#endif
p_list->push_back(PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script", PROPERTY_USAGE_DEFAULT));
}
- if (!metadata.empty()) {
- p_list->push_back(PropertyInfo(Variant::DICTIONARY, "__meta__", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
- }
+
+#ifdef TOOLS_ENABLED
+ p_list->push_back(PropertyInfo(Variant::NIL, "Metadata", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_GROUP));
+#endif
+ p_list->push_back(PropertyInfo(Variant::DICTIONARY, "__meta__", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT));
+
if (script_instance && !p_reversed) {
p_list->push_back(PropertyInfo(Variant::NIL, "Script Variables", PROPERTY_HINT_NONE, String(), PROPERTY_USAGE_CATEGORY));
script_instance->get_property_list(p_list);
diff --git a/core/object.h b/core/object.h
index 1e0b22c086..e6c5b7c5b9 100644
--- a/core/object.h
+++ b/core/object.h
@@ -179,6 +179,15 @@ struct PropertyInfo {
usage(PROPERTY_USAGE_DEFAULT) {
}
+ bool operator==(const PropertyInfo &p_info) const {
+ return ((type == p_info.type) &&
+ (name == p_info.name) &&
+ (class_name == p_info.class_name) &&
+ (hint == p_info.hint) &&
+ (hint_string == p_info.hint_string) &&
+ (usage == p_info.usage));
+ }
+
bool operator<(const PropertyInfo &p_info) const {
return name < p_info.name;
}
diff --git a/core/pool_allocator.cpp b/core/pool_allocator.cpp
index 094352b5cc..9b342ef913 100644
--- a/core/pool_allocator.cpp
+++ b/core/pool_allocator.cpp
@@ -611,7 +611,7 @@ PoolAllocator::PoolAllocator(void *p_mem, int p_size, int p_align, bool p_needs_
PoolAllocator::PoolAllocator(int p_align, int p_size, bool p_needs_locking, int p_max_entries) {
ERR_FAIL_COND(p_align < 1);
- mem_ptr = Memory::alloc_static(p_size + p_align, "PoolAllocator()");
+ mem_ptr = Memory::alloc_static(p_size + p_align, true);
uint8_t *mem8 = (uint8_t *)mem_ptr;
uint64_t ofs = (uint64_t)mem8;
if (ofs % p_align)
diff --git a/core/pool_vector.h b/core/pool_vector.h
index 98a52c6938..3d28d86803 100644
--- a/core/pool_vector.h
+++ b/core/pool_vector.h
@@ -458,7 +458,7 @@ public:
bool is_locked() const { return alloc && alloc->lock > 0; }
- inline const T operator[](int p_index) const;
+ inline T operator[](int p_index) const;
Error resize(int p_size);
@@ -502,7 +502,7 @@ void PoolVector<T>::push_back(const T &p_val) {
}
template <class T>
-const T PoolVector<T>::operator[](int p_index) const {
+T PoolVector<T>::operator[](int p_index) const {
CRASH_BAD_INDEX(p_index, size());
diff --git a/core/string_name.cpp b/core/string_name.cpp
index 10b71ad3ac..b1a8bfb849 100644
--- a/core/string_name.cpp
+++ b/core/string_name.cpp
@@ -205,7 +205,6 @@ StringName::StringName(const char *p_name) {
// exists
lock->unlock();
return;
- } else {
}
}
@@ -253,7 +252,6 @@ StringName::StringName(const StaticCString &p_static_string) {
// exists
lock->unlock();
return;
- } else {
}
}
@@ -301,7 +299,6 @@ StringName::StringName(const String &p_name) {
// exists
lock->unlock();
return;
- } else {
}
}
diff --git a/core/variant.cpp b/core/variant.cpp
index fe9623d068..1574af5239 100644
--- a/core/variant.cpp
+++ b/core/variant.cpp
@@ -1834,8 +1834,6 @@ inline DA _convert_array_from_variant(const Variant &p_variant) {
return DA();
}
}
-
- return DA();
}
Variant::operator Array() const {
@@ -2299,7 +2297,7 @@ Variant::Variant(const Object *p_object) {
Variant::Variant(const Dictionary &p_dictionary) {
type = DICTIONARY;
- memnew_placement(_data._mem, (Dictionary)(p_dictionary));
+ memnew_placement(_data._mem, Dictionary(p_dictionary));
}
Variant::Variant(const Array &p_array) {
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 3fdd18a630..b637e745af 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -70,7 +70,7 @@ struct _VariantCall {
for (int i = 0; i < arg_count; i++) {
- if (!tptr[i] || tptr[i] == p_args[i]->type)
+ if (tptr[i] == Variant::NIL || tptr[i] == p_args[i]->type)
continue; // all good
if (!Variant::can_convert(p_args[i]->type, tptr[i])) {
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index d677c7776a..ea9e29e744 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -2613,7 +2613,7 @@ bool Variant::in(const Variant &p_index, bool *r_valid) const {
if (r_valid) {
*r_valid = false;
}
- return "Attempted get on stray pointer.";
+ return true; // Attempted get on stray pointer.
}
}
#endif
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp
index d5513bc2d7..07212ec669 100644
--- a/core/variant_parser.cpp
+++ b/core/variant_parser.cpp
@@ -1537,8 +1537,6 @@ Error VariantParser::parse_tag_assign_eof(Stream *p_stream, int &line, String &r
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);
- if (err) {
- }
return err;
}
} else if (c == '\n') {