diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/color.cpp | 2 | ||||
-rw-r--r-- | core/command_queue_mt.h | 4 | ||||
-rw-r--r-- | core/image.cpp | 4 | ||||
-rw-r--r-- | core/input_map.cpp | 2 | ||||
-rw-r--r-- | core/io/file_access_encrypted.cpp | 4 | ||||
-rw-r--r-- | core/io/file_access_network.cpp | 11 | ||||
-rw-r--r-- | core/io/http_client.cpp | 6 | ||||
-rw-r--r-- | core/io/image_loader.cpp | 3 | ||||
-rw-r--r-- | core/io/xml_parser.cpp | 2 | ||||
-rw-r--r-- | core/list.h | 3 | ||||
-rw-r--r-- | core/math/expression.cpp | 9 | ||||
-rw-r--r-- | core/math/expression.h | 1 | ||||
-rw-r--r-- | core/math/math_funcs.h | 2 | ||||
-rw-r--r-- | core/math/vector2.cpp | 7 | ||||
-rw-r--r-- | core/math/vector2.h | 1 | ||||
-rw-r--r-- | core/math/vector3.cpp | 7 | ||||
-rw-r--r-- | core/math/vector3.h | 1 | ||||
-rw-r--r-- | core/os/input_event.cpp | 13 | ||||
-rw-r--r-- | core/os/input_event.h | 4 | ||||
-rw-r--r-- | core/print_string.cpp | 2 | ||||
-rw-r--r-- | core/project_settings.cpp | 18 | ||||
-rw-r--r-- | core/script_language.h | 4 | ||||
-rw-r--r-- | core/sort_array.h | 6 | ||||
-rw-r--r-- | core/ustring.cpp | 25 | ||||
-rw-r--r-- | core/variant_call.cpp | 12 | ||||
-rw-r--r-- | core/vector.h | 2 |
26 files changed, 106 insertions, 49 deletions
diff --git a/core/color.cpp b/core/color.cpp index efd2941b47..8959fce4e3 100644 --- a/core/color.cpp +++ b/core/color.cpp @@ -525,7 +525,7 @@ Color Color::from_hsv(float p_h, float p_s, float p_v, float p_a) const { float Color::gray() const { ERR_EXPLAIN("Color.gray() is deprecated and will be removed in a future version. Use Color.get_v() for a better grayscale approximation."); - WARN_DEPRECATED + WARN_DEPRECATED; return (r + g + b) / 3.0; } diff --git a/core/command_queue_mt.h b/core/command_queue_mt.h index 59eabd8786..798fa4394d 100644 --- a/core/command_queue_mt.h +++ b/core/command_queue_mt.h @@ -406,8 +406,10 @@ class CommandQueueMT { tryagain: // tried to read an empty queue - if (read_ptr == write_ptr) + if (read_ptr == write_ptr) { + if (p_lock) unlock(); return false; + } uint32_t size_ptr = read_ptr; uint32_t size = *(uint32_t *)&command_mem[read_ptr] >> 1; diff --git a/core/image.cpp b/core/image.cpp index 30af724de9..c85d7f6bcc 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -749,7 +749,7 @@ static void _scale_lanczos(const uint8_t *__restrict p_src, uint8_t *__restrict float scale_factor = MAX(x_scale, 1); // A larger kernel is required only when downscaling int32_t half_kernel = LANCZOS_TYPE * scale_factor; - float *kernel = memnew_arr(float, half_kernel * 2 - 1); + float *kernel = memnew_arr(float, half_kernel * 2); for (int32_t buffer_x = 0; buffer_x < dst_width; buffer_x++) { @@ -800,7 +800,7 @@ static void _scale_lanczos(const uint8_t *__restrict p_src, uint8_t *__restrict float scale_factor = MAX(y_scale, 1); int32_t half_kernel = LANCZOS_TYPE * scale_factor; - float *kernel = memnew_arr(float, half_kernel * 2 - 1); + float *kernel = memnew_arr(float, half_kernel * 2); for (int32_t dst_y = 0; dst_y < dst_height; dst_y++) { diff --git a/core/input_map.cpp b/core/input_map.cpp index 15f68f9c2a..012c6a7c4f 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) ? 1.0f : 0.0f; + *p_strength = (*p_pressed) ? input_event_action->get_strength() : 0.0f; return input_event_action->get_action() == p_action; } diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp index 3ff9fa569c..7dea749a43 100644 --- a/core/io/file_access_encrypted.cpp +++ b/core/io/file_access_encrypted.cpp @@ -308,8 +308,8 @@ uint32_t FileAccessEncrypted::_get_unix_permissions(const String &p_file) { } Error FileAccessEncrypted::_set_unix_permissions(const String &p_file, uint32_t p_permissions) { - - return FAILED; + ERR_PRINT("Setting UNIX permissions on encrypted files is not implemented yet"); + return ERR_UNAVAILABLE; } FileAccessEncrypted::FileAccessEncrypted() { diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index 722e62c54e..5dd167c581 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -118,7 +118,10 @@ void FileAccessNetworkClient::_thread_func() { FileAccessNetwork *fa = NULL; if (response != FileAccessNetwork::RESPONSE_DATA) { - ERR_FAIL_COND(!accesses.has(id)); + if (!accesses.has(id)) { + unlock_mutex(); + ERR_FAIL_COND(!accesses.has(id)); + } } if (accesses.has(id)) @@ -498,13 +501,13 @@ uint64_t FileAccessNetwork::_get_modified_time(const String &p_file) { } uint32_t FileAccessNetwork::_get_unix_permissions(const String &p_file) { - //could be implemented, not sure if worth it + ERR_PRINT("Getting UNIX permissions from network drives is not implemented yet"); return 0; } Error FileAccessNetwork::_set_unix_permissions(const String &p_file, uint32_t p_permissions) { - - return FAILED; + ERR_PRINT("Setting UNIX permissions on network drives is not implemented yet"); + return ERR_UNAVAILABLE; } void FileAccessNetwork::configure() { diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index ce2054db36..891fb7b0ca 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -346,6 +346,12 @@ Error HTTPClient::poll() { } else { // We are already handshaking, which means we can use your already active SSL connection ssl = static_cast<Ref<StreamPeerSSL> >(connection); + if (ssl.is_null()) { + close(); + status = STATUS_SSL_HANDSHAKE_ERROR; + return ERR_CANT_CONNECT; + } + ssl->poll(); // Try to finish the handshake } diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp index a5a0738140..a759e615c7 100644 --- a/core/io/image_loader.cpp +++ b/core/io/image_loader.cpp @@ -65,6 +65,9 @@ Error ImageLoader::load_image(String p_file, Ref<Image> p_image, FileAccess *p_c if (!loader[i]->recognize(extension)) continue; Error err = loader[i]->load_image(p_image, f, p_force_linear, p_scale); + if (err != OK) { + ERR_PRINTS("Error loading image: " + p_file); + } if (err != ERR_FILE_UNRECOGNIZED) { diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp index 4638ddcc09..f55af5a96a 100644 --- a/core/io/xml_parser.cpp +++ b/core/io/xml_parser.cpp @@ -348,7 +348,7 @@ uint64_t XMLParser::get_node_offset() const { Error XMLParser::seek(uint64_t p_pos) { - ERR_FAIL_COND_V(!data, ERR_FILE_EOF) + ERR_FAIL_COND_V(!data, ERR_FILE_EOF); ERR_FAIL_COND_V(p_pos >= length, ERR_FILE_EOF); P = data + p_pos; diff --git a/core/list.h b/core/list.h index 103a82a31d..d1b528562d 100644 --- a/core/list.h +++ b/core/list.h @@ -602,9 +602,6 @@ public: Element *next = current->next_ptr; - //disconnect - current->next_ptr = NULL; - if (from != current) { current->prev_ptr = NULL; diff --git a/core/math/expression.cpp b/core/math/expression.cpp index 079c9b524f..e484e9194d 100644 --- a/core/math/expression.cpp +++ b/core/math/expression.cpp @@ -70,6 +70,7 @@ const char *Expression::func_name[Expression::FUNC_MAX] = { "inverse_lerp", "range_lerp", "smoothstep", + "move_toward", "dectime", "randomize", "randi", @@ -189,6 +190,7 @@ int Expression::get_func_argument_count(BuiltinFunc p_func) { case MATH_LERP: case MATH_INVERSE_LERP: case MATH_SMOOTHSTEP: + case MATH_MOVE_TOWARD: case MATH_DECTIME: case MATH_WRAP: case MATH_WRAPF: @@ -407,6 +409,13 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant VALIDATE_ARG_NUM(2); *r_return = Math::smoothstep((double)*p_inputs[0], (double)*p_inputs[1], (double)*p_inputs[2]); } break; + case MATH_MOVE_TOWARD: { + + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + VALIDATE_ARG_NUM(2); + *r_return = Math::move_toward((double)*p_inputs[0], (double)*p_inputs[1], (double)*p_inputs[2]); + } break; case MATH_DECTIME: { VALIDATE_ARG_NUM(0); diff --git a/core/math/expression.h b/core/math/expression.h index f20619f0b6..79f6f3989d 100644 --- a/core/math/expression.h +++ b/core/math/expression.h @@ -68,6 +68,7 @@ public: MATH_INVERSE_LERP, MATH_RANGE_LERP, MATH_SMOOTHSTEP, + MATH_MOVE_TOWARD, MATH_DECTIME, MATH_RANDOMIZE, MATH_RAND, diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index 82b5b56c01..0e3bd8a318 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -224,6 +224,8 @@ public: float x = CLAMP((p_weight - p_from) / (p_to - p_from), 0.0f, 1.0f); return x * x * (3.0f - 2.0f * x); } + static _ALWAYS_INLINE_ double move_toward(double p_from, double p_to, double p_delta) { return abs(p_to - p_from) <= p_delta ? p_to : p_from + SGN(p_to - p_from) * p_delta; } + static _ALWAYS_INLINE_ float move_toward(float p_from, float p_to, float p_delta) { return abs(p_to - p_from) <= p_delta ? p_to : p_from + SGN(p_to - p_from) * p_delta; } static _ALWAYS_INLINE_ double linear2db(double p_linear) { return Math::log(p_linear) * 8.6858896380650365530225783783321; } static _ALWAYS_INLINE_ float linear2db(float p_linear) { return Math::log(p_linear) * 8.6858896380650365530225783783321; } diff --git a/core/math/vector2.cpp b/core/math/vector2.cpp index 5c1ea5943d..779a28be66 100644 --- a/core/math/vector2.cpp +++ b/core/math/vector2.cpp @@ -164,6 +164,13 @@ Vector2 Vector2::cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, c return out; } +Vector2 Vector2::move_toward(const Vector2 &p_to, const real_t p_delta) const { + Vector2 v = *this; + Vector2 vd = p_to - v; + real_t len = vd.length(); + return len <= p_delta || len < CMP_EPSILON ? p_to : v + vd / len * p_delta; +} + // slide returns the component of the vector along the given plane, specified by its normal vector. Vector2 Vector2::slide(const Vector2 &p_normal) const { #ifdef MATH_CHECKS diff --git a/core/math/vector2.h b/core/math/vector2.h index a0c6024c9f..78a1641c1e 100644 --- a/core/math/vector2.h +++ b/core/math/vector2.h @@ -79,6 +79,7 @@ struct Vector2 { _FORCE_INLINE_ Vector2 linear_interpolate(const Vector2 &p_b, real_t p_t) const; _FORCE_INLINE_ Vector2 slerp(const Vector2 &p_b, real_t p_t) const; Vector2 cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, const Vector2 &p_post_b, real_t p_t) const; + Vector2 move_toward(const Vector2 &p_to, const real_t p_delta) const; Vector2 slide(const Vector2 &p_normal) const; Vector2 bounce(const Vector2 &p_normal) const; diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp index 1c28934422..73927821cf 100644 --- a/core/math/vector3.cpp +++ b/core/math/vector3.cpp @@ -127,6 +127,13 @@ Vector3 Vector3::cubic_interpolate(const Vector3 &p_b, const Vector3 &p_pre_a, c return out; } +Vector3 Vector3::move_toward(const Vector3 &p_to, const real_t p_delta) const { + Vector3 v = *this; + Vector3 vd = p_to - v; + real_t len = vd.length(); + return len <= p_delta || len < CMP_EPSILON ? p_to : v + vd / len * p_delta; +} + Vector3::operator String() const { return (rtos(x) + ", " + rtos(y) + ", " + rtos(z)); diff --git a/core/math/vector3.h b/core/math/vector3.h index 21fc09653f..6423147282 100644 --- a/core/math/vector3.h +++ b/core/math/vector3.h @@ -94,6 +94,7 @@ struct Vector3 { _FORCE_INLINE_ Vector3 slerp(const Vector3 &p_b, real_t p_t) const; Vector3 cubic_interpolate(const Vector3 &p_b, const Vector3 &p_pre_a, const Vector3 &p_post_b, real_t p_t) const; Vector3 cubic_interpolaten(const Vector3 &p_b, const Vector3 &p_pre_a, const Vector3 &p_post_b, real_t p_t) const; + Vector3 move_toward(const Vector3 &p_to, const real_t p_delta) const; _FORCE_INLINE_ Vector3 cross(const Vector3 &p_b) const; _FORCE_INLINE_ real_t dot(const Vector3 &p_b) const; diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index a072017353..9c5066da3d 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -1010,6 +1010,14 @@ bool InputEventAction::is_pressed() const { return pressed; } +void InputEventAction::set_strength(float p_strength) { + strength = CLAMP(p_strength, 0.0f, 1.0f); +} + +float InputEventAction::get_strength() const { + return strength; +} + bool InputEventAction::shortcut_match(const Ref<InputEvent> &p_event) const { if (p_event.is_null()) return false; @@ -1051,14 +1059,19 @@ void InputEventAction::_bind_methods() { ClassDB::bind_method(D_METHOD("set_pressed", "pressed"), &InputEventAction::set_pressed); //ClassDB::bind_method(D_METHOD("is_pressed"), &InputEventAction::is_pressed); + ClassDB::bind_method(D_METHOD("set_strength", "strength"), &InputEventAction::set_strength); + ClassDB::bind_method(D_METHOD("get_strength"), &InputEventAction::get_strength); + // ClassDB::bind_method(D_METHOD("is_action", "name"), &InputEventAction::is_action); ADD_PROPERTY(PropertyInfo(Variant::STRING, "action"), "set_action", "get_action"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "strength", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_strength", "get_strength"); } InputEventAction::InputEventAction() { pressed = false; + strength = 1.0f; } ///////////////////////////// diff --git a/core/os/input_event.h b/core/os/input_event.h index ba01516519..7a9a1f71c3 100644 --- a/core/os/input_event.h +++ b/core/os/input_event.h @@ -475,6 +475,7 @@ class InputEventAction : public InputEvent { StringName action; bool pressed; + float strength; protected: static void _bind_methods(); @@ -486,6 +487,9 @@ public: void set_pressed(bool p_pressed); virtual bool is_pressed() const; + void set_strength(float p_strength); + float get_strength() const; + virtual bool is_action(const StringName &p_action) const; virtual bool action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float p_deadzone) const; diff --git a/core/print_string.cpp b/core/print_string.cpp index d91d49f53b..3271744af3 100644 --- a/core/print_string.cpp +++ b/core/print_string.cpp @@ -68,8 +68,8 @@ void remove_print_handler(PrintHandlerList *p_handler) { } //OS::get_singleton()->print("print handler list is %p\n",print_handler_list); - ERR_FAIL_COND(l == NULL); _global_unlock(); + ERR_FAIL_COND(l == NULL); } void print_line(String p_string) { diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 6cfa69fba9..0508806a35 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -75,11 +75,19 @@ String ProjectSettings::localize_path(const String &p_path) const { memdelete(dir); - if (!cwd.begins_with(resource_path)) { + // Ensure that we end with a '/'. + // This is important to ensure that we do not wrongly localize the resource path + // in an absolute path that just happens to contain this string but points to a + // different folder (e.g. "/my/project" as resource_path would be contained in + // "/my/project_data", even though the latter is not part of res://. + // `plus_file("")` is an easy way to ensure we have a trailing '/'. + const String res_path = resource_path.plus_file(""); + + if (!cwd.begins_with(res_path)) { return p_path; }; - return cwd.replace_first(resource_path, "res:/"); + return cwd.replace_first(res_path, "res://"); } else { memdelete(dir); @@ -481,7 +489,7 @@ Error ProjectSettings::_load_settings_binary(const String p_path) { memdelete(f); ERR_EXPLAIN("Corrupted header in binary project.binary (not ECFG)"); - ERR_FAIL_V(ERR_FILE_CORRUPT;) + ERR_FAIL_V(ERR_FILE_CORRUPT); } uint32_t count = f->get_32(); @@ -628,7 +636,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str if (err != OK) { ERR_EXPLAIN("Couldn't save project.binary at " + p_file); - ERR_FAIL_COND_V(err, err) + ERR_FAIL_COND_V(err, err); } uint8_t hdr[4] = { 'E', 'C', 'F', 'G' }; @@ -720,7 +728,7 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Map<Strin if (err) { ERR_EXPLAIN("Couldn't save project.godot - " + p_file); - ERR_FAIL_COND_V(err, err) + ERR_FAIL_COND_V(err, err); } file->store_line("; Engine configuration file."); diff --git a/core/script_language.h b/core/script_language.h index b2dab666c4..b0c60b4e90 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -250,7 +250,7 @@ public: virtual Error open_in_external_editor(const Ref<Script> &p_script, int p_line, int p_col) { return ERR_UNAVAILABLE; } virtual bool overrides_external_editor() { return false; } - virtual Error complete_code(const String &p_code, const String &p_base_path, Object *p_owner, List<String> *r_options, bool &r_force, String &r_call_hint) { return ERR_UNAVAILABLE; } + virtual Error complete_code(const String &p_code, const String &p_path, Object *p_owner, List<String> *r_options, bool &r_force, String &r_call_hint) { return ERR_UNAVAILABLE; } struct LookupResult { enum Type { @@ -269,7 +269,7 @@ public: int location; }; - virtual Error lookup_code(const String &p_code, const String &p_symbol, const String &p_base_path, Object *p_owner, LookupResult &r_result) { return ERR_UNAVAILABLE; } + virtual Error lookup_code(const String &p_code, const String &p_symbol, const String &p_path, Object *p_owner, LookupResult &r_result) { return ERR_UNAVAILABLE; } virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const = 0; virtual void add_global_constant(const StringName &p_variable, const Variant &p_value) = 0; diff --git a/core/sort_array.h b/core/sort_array.h index 0f258aec3e..8660ee3333 100644 --- a/core/sort_array.h +++ b/core/sort_array.h @@ -179,14 +179,14 @@ public: while (true) { while (compare(p_array[p_first], p_pivot)) { if (Validate) { - ERR_BAD_COMPARE(p_first == unmodified_last - 1) + ERR_BAD_COMPARE(p_first == unmodified_last - 1); } p_first++; } p_last--; while (compare(p_pivot, p_array[p_last])) { if (Validate) { - ERR_BAD_COMPARE(p_last == unmodified_first) + ERR_BAD_COMPARE(p_last == unmodified_first); } p_last--; } @@ -259,7 +259,7 @@ public: int next = p_last - 1; while (compare(p_value, p_array[next])) { if (Validate) { - ERR_BAD_COMPARE(next == 0) + ERR_BAD_COMPARE(next == 0); } p_array[p_last] = p_array[next]; p_last = next; diff --git a/core/ustring.cpp b/core/ustring.cpp index 8c9633a0db..741c825448 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3088,29 +3088,16 @@ String String::strip_edges(bool left, bool right) const { String String::strip_escapes() const { - int len = length(); - int beg = 0, end = len; - + String new_string; for (int i = 0; i < length(); i++) { - if (operator[](i) <= 31) - beg++; - else - break; - } - - for (int i = (int)(length() - 1); i >= 0; i--) { - - if (operator[](i) <= 31) - end--; - else - break; + // Escape characters on first page of the ASCII table, before 32 (Space). + if (operator[](i) < 32) + continue; + new_string += operator[](i); } - if (beg == 0 && end == len) - return *this; - - return substr(beg, end - beg); + return new_string; } String String::lstrip(const String &p_chars) const { diff --git a/core/variant_call.cpp b/core/variant_call.cpp index f9f73b4e51..b3a4a13b08 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -265,6 +265,7 @@ struct _VariantCall { VCALL_LOCALMEM1R(String, right); VCALL_LOCALMEM0R(String, dedent); VCALL_LOCALMEM2R(String, strip_edges); + VCALL_LOCALMEM0R(String, strip_escapes); VCALL_LOCALMEM1R(String, lstrip); VCALL_LOCALMEM1R(String, rstrip); VCALL_LOCALMEM0R(String, get_extension); @@ -347,6 +348,7 @@ struct _VariantCall { VCALL_LOCALMEM2R(Vector2, linear_interpolate); VCALL_LOCALMEM2R(Vector2, slerp); VCALL_LOCALMEM4R(Vector2, cubic_interpolate); + VCALL_LOCALMEM2R(Vector2, move_toward); VCALL_LOCALMEM1R(Vector2, rotated); VCALL_LOCALMEM0R(Vector2, tangent); VCALL_LOCALMEM0R(Vector2, floor); @@ -388,6 +390,7 @@ struct _VariantCall { VCALL_LOCALMEM2R(Vector3, linear_interpolate); VCALL_LOCALMEM2R(Vector3, slerp); VCALL_LOCALMEM4R(Vector3, cubic_interpolate); + VCALL_LOCALMEM2R(Vector3, move_toward); VCALL_LOCALMEM1R(Vector3, dot); VCALL_LOCALMEM1R(Vector3, cross); VCALL_LOCALMEM1R(Vector3, outer); @@ -1516,9 +1519,9 @@ void register_variant_methods() { ADDFUNC2R(STRING, STRING, String, replacen, STRING, "what", STRING, "forwhat", varray()); ADDFUNC2R(STRING, STRING, String, insert, INT, "position", STRING, "what", varray()); ADDFUNC0R(STRING, STRING, String, capitalize, varray()); - ADDFUNC3R(STRING, POOL_STRING_ARRAY, String, split, STRING, "divisor", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0)); - ADDFUNC3R(STRING, POOL_STRING_ARRAY, String, rsplit, STRING, "divisor", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0)); - ADDFUNC2R(STRING, POOL_REAL_ARRAY, String, split_floats, STRING, "divisor", BOOL, "allow_empty", varray(true)); + ADDFUNC3R(STRING, POOL_STRING_ARRAY, String, split, STRING, "delimiter", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0)); + ADDFUNC3R(STRING, POOL_STRING_ARRAY, String, rsplit, STRING, "delimiter", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0)); + ADDFUNC2R(STRING, POOL_REAL_ARRAY, String, split_floats, STRING, "delimiter", BOOL, "allow_empty", varray(true)); ADDFUNC0R(STRING, STRING, String, to_upper, varray()); ADDFUNC0R(STRING, STRING, String, to_lower, varray()); @@ -1526,6 +1529,7 @@ void register_variant_methods() { ADDFUNC1R(STRING, STRING, String, left, INT, "position", varray()); ADDFUNC1R(STRING, STRING, String, right, INT, "position", varray()); ADDFUNC2R(STRING, STRING, String, strip_edges, BOOL, "left", BOOL, "right", varray(true, true)); + ADDFUNC0R(STRING, STRING, String, strip_escapes, varray()); ADDFUNC1R(STRING, STRING, String, lstrip, STRING, "chars", varray()); ADDFUNC1R(STRING, STRING, String, rstrip, STRING, "chars", varray()); ADDFUNC0R(STRING, STRING, String, get_extension, varray()); @@ -1583,6 +1587,7 @@ void register_variant_methods() { ADDFUNC2R(VECTOR2, VECTOR2, Vector2, linear_interpolate, VECTOR2, "b", REAL, "t", varray()); ADDFUNC2R(VECTOR2, VECTOR2, Vector2, slerp, VECTOR2, "b", REAL, "t", varray()); ADDFUNC4R(VECTOR2, VECTOR2, Vector2, cubic_interpolate, VECTOR2, "b", VECTOR2, "pre_a", VECTOR2, "post_b", REAL, "t", varray()); + ADDFUNC2R(VECTOR2, VECTOR2, Vector2, move_toward, VECTOR2, "to", REAL, "delta", varray()); ADDFUNC1R(VECTOR2, VECTOR2, Vector2, rotated, REAL, "phi", varray()); ADDFUNC0R(VECTOR2, VECTOR2, Vector2, tangent, varray()); ADDFUNC0R(VECTOR2, VECTOR2, Vector2, floor, varray()); @@ -1624,6 +1629,7 @@ void register_variant_methods() { ADDFUNC2R(VECTOR3, VECTOR3, Vector3, slerp, VECTOR3, "b", REAL, "t", varray()); ADDFUNC4R(VECTOR3, VECTOR3, Vector3, cubic_interpolate, VECTOR3, "b", VECTOR3, "pre_a", VECTOR3, "post_b", REAL, "t", varray()); ADDFUNC1R(VECTOR3, VECTOR3, Vector3, direction_to, VECTOR3, "b", varray()); + ADDFUNC2R(VECTOR3, VECTOR3, Vector3, move_toward, VECTOR3, "to", REAL, "delta", varray()); ADDFUNC1R(VECTOR3, REAL, Vector3, dot, VECTOR3, "b", varray()); ADDFUNC1R(VECTOR3, VECTOR3, Vector3, cross, VECTOR3, "b", varray()); ADDFUNC1R(VECTOR3, BASIS, Vector3, outer, VECTOR3, "b", varray()); diff --git a/core/vector.h b/core/vector.h index 93ee003519..e6bb4a96fc 100644 --- a/core/vector.h +++ b/core/vector.h @@ -150,7 +150,7 @@ template <class T> bool Vector<T>::push_back(const T &p_elem) { Error err = resize(size() + 1); - ERR_FAIL_COND_V(err, true) + ERR_FAIL_COND_V(err, true); set(size() - 1, p_elem); return false; |