summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/bind/core_bind.cpp36
-rw-r--r--core/bind/core_bind.h4
-rw-r--r--core/class_db.cpp41
-rw-r--r--core/class_db.h2
-rw-r--r--core/color.cpp107
-rw-r--r--core/color.h12
-rw-r--r--core/dictionary.cpp21
-rw-r--r--core/image.cpp2
-rw-r--r--core/io/file_access_network.cpp2
-rw-r--r--core/io/http_client.cpp3
-rw-r--r--core/io/marshalls.cpp2
-rw-r--r--core/io/networked_multiplayer_peer.cpp4
-rw-r--r--core/io/networked_multiplayer_peer.h1
-rw-r--r--core/io/packet_peer.cpp14
-rw-r--r--core/io/packet_peer.h1
-rw-r--r--core/io/resource_loader.cpp3
-rw-r--r--core/io/stream_peer.cpp30
-rw-r--r--core/io/stream_peer.h2
-rw-r--r--core/io/stream_peer_ssl.cpp1
-rw-r--r--core/io/stream_peer_ssl.h1
-rw-r--r--core/io/stream_peer_tcp.cpp1
-rw-r--r--core/io/stream_peer_tcp.h2
-rw-r--r--core/list.h2
-rw-r--r--core/make_binders.py2
-rw-r--r--core/math/octree.h2
-rw-r--r--core/math/triangulate.cpp2
-rw-r--r--core/method_bind.h2
-rw-r--r--core/oa_hash_map.h2
-rw-r--r--core/object.cpp4
-rw-r--r--core/object.h4
-rw-r--r--core/os/file_access.cpp3
-rw-r--r--core/os/input_event.h4
-rw-r--r--core/os/os.cpp11
-rw-r--r--core/os/os.h2
-rw-r--r--core/project_settings.cpp2
-rw-r--r--core/project_settings.h6
-rw-r--r--core/resource.cpp2
-rw-r--r--core/safe_refcount.cpp8
-rw-r--r--core/script_debugger_local.cpp3
-rw-r--r--core/script_debugger_remote.cpp8
-rw-r--r--core/script_language.cpp2
-rw-r--r--core/script_language.h2
-rw-r--r--core/string_buffer.cpp103
-rw-r--r--core/string_buffer.h82
-rw-r--r--core/string_builder.cpp3
-rw-r--r--core/translation.cpp2
-rw-r--r--core/ustring.cpp22
-rw-r--r--core/variant_call.cpp10
-rw-r--r--core/variant_parser.cpp6
49 files changed, 352 insertions, 241 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index c7b08b8242..8f1a57e363 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -264,6 +264,10 @@ Size2 _OS::get_window_size() const {
return OS::get_singleton()->get_window_size();
}
+Size2 _OS::get_real_window_size() const {
+ return OS::get_singleton()->get_real_window_size();
+}
+
void _OS::set_window_size(const Size2 &p_size) {
OS::get_singleton()->set_window_size(p_size);
}
@@ -929,6 +933,11 @@ void _OS::request_attention() {
OS::get_singleton()->request_attention();
}
+void _OS::center_window() {
+
+ OS::get_singleton()->center_window();
+}
+
bool _OS::is_debug_build() const {
#ifdef DEBUG_ENABLED
@@ -1017,6 +1026,8 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_window_maximized", "enabled"), &_OS::set_window_maximized);
ClassDB::bind_method(D_METHOD("is_window_maximized"), &_OS::is_window_maximized);
ClassDB::bind_method(D_METHOD("request_attention"), &_OS::request_attention);
+ ClassDB::bind_method(D_METHOD("get_real_window_size"), &_OS::get_real_window_size);
+ ClassDB::bind_method(D_METHOD("center_window"), &_OS::center_window);
ClassDB::bind_method(D_METHOD("set_borderless_window", "borderless"), &_OS::set_borderless_window);
ClassDB::bind_method(D_METHOD("get_borderless_window"), &_OS::get_borderless_window);
@@ -1129,6 +1140,22 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_power_seconds_left"), &_OS::get_power_seconds_left);
ClassDB::bind_method(D_METHOD("get_power_percent_left"), &_OS::get_power_percent_left);
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "clipboard"), "set_clipboard", "get_clipboard");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "current_screen"), "set_current_screen", "get_current_screen");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "exit_code"), "set_exit_code", "get_exit_code");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "vsync_enabled"), "set_use_vsync", "is_vsync_enabled");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "low_processor_usage_mode"), "set_low_processor_usage_mode", "is_in_low_processor_usage_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keep_screen_on"), "set_keep_screen_on", "is_keep_screen_on");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "screen_orientation", PROPERTY_HINT_ENUM, "Landscape,Portrait,Reverse Landscape,Reverse Portrait,Sensor Landscape,Sensor Portrait,Sensor"), "set_screen_orientation", "get_screen_orientation");
+ ADD_GROUP("Window", "window_");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_borderless"), "set_borderless_window", "get_borderless_window");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_fullscreen"), "set_window_fullscreen", "is_window_fullscreen");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_maximized"), "set_window_maximized", "is_window_maximized");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_minimized"), "set_window_minimized", "is_window_minimized");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_resizable"), "set_window_resizable", "is_window_resizable");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "window_position"), "set_window_position", "get_window_position");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "window_size"), "set_window_size", "get_window_size");
+
BIND_ENUM_CONSTANT(DAY_SUNDAY);
BIND_ENUM_CONSTANT(DAY_MONDAY);
BIND_ENUM_CONSTANT(DAY_TUESDAY);
@@ -1808,6 +1835,8 @@ void _File::_bind_methods() {
ClassDB::bind_method(D_METHOD("file_exists", "path"), &_File::file_exists);
ClassDB::bind_method(D_METHOD("get_modified_time", "file"), &_File::get_modified_time);
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "endian_swap"), "set_endian_swap", "get_endian_swap");
+
BIND_ENUM_CONSTANT(READ);
BIND_ENUM_CONSTANT(WRITE);
BIND_ENUM_CONSTANT(READ_WRITE);
@@ -2567,7 +2596,7 @@ void _Engine::set_target_fps(int p_fps) {
Engine::get_singleton()->set_target_fps(p_fps);
}
-float _Engine::get_target_fps() const {
+int _Engine::get_target_fps() const {
return Engine::get_singleton()->get_target_fps();
}
@@ -2649,6 +2678,11 @@ void _Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_editor_hint", "enabled"), &_Engine::set_editor_hint);
ClassDB::bind_method(D_METHOD("is_editor_hint"), &_Engine::is_editor_hint);
+
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_hint"), "set_editor_hint", "is_editor_hint");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "iterations_per_second"), "set_iterations_per_second", "get_iterations_per_second");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "target_fps"), "set_target_fps", "get_target_fps");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "time_scale"), "set_time_scale", "get_time_scale");
}
_Engine *_Engine::singleton = NULL;
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index bc5b8ea04c..6b688a65f8 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -155,6 +155,7 @@ public:
virtual Point2 get_window_position() const;
virtual void set_window_position(const Point2 &p_position);
virtual Size2 get_window_size() const;
+ virtual Size2 get_real_window_size() const;
virtual void set_window_size(const Size2 &p_size);
virtual void set_window_fullscreen(bool p_enabled);
virtual bool is_window_fullscreen() const;
@@ -165,6 +166,7 @@ public:
virtual void set_window_maximized(bool p_enabled);
virtual bool is_window_maximized() const;
virtual void request_attention();
+ virtual void center_window();
virtual void set_borderless_window(bool p_borderless);
virtual bool get_borderless_window() const;
@@ -656,7 +658,7 @@ public:
int get_iterations_per_second() const;
void set_target_fps(int p_fps);
- float get_target_fps() const;
+ int get_target_fps() const;
float get_frames_per_second() const;
diff --git a/core/class_db.cpp b/core/class_db.cpp
index d2cd362792..afcc8de0f2 100644
--- a/core/class_db.cpp
+++ b/core/class_db.cpp
@@ -207,6 +207,47 @@ MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_
return md;
}
+MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10, const char *p_arg11, const char *p_arg12) {
+
+ MethodDefinition md;
+ md.name = StaticCString::create(p_name);
+ md.args.resize(12);
+ md.args[0] = StaticCString::create(p_arg1);
+ md.args[1] = StaticCString::create(p_arg2);
+ md.args[2] = StaticCString::create(p_arg3);
+ md.args[3] = StaticCString::create(p_arg4);
+ md.args[4] = StaticCString::create(p_arg5);
+ md.args[5] = StaticCString::create(p_arg6);
+ md.args[6] = StaticCString::create(p_arg7);
+ md.args[7] = StaticCString::create(p_arg8);
+ md.args[8] = StaticCString::create(p_arg9);
+ md.args[9] = StaticCString::create(p_arg10);
+ md.args[10] = StaticCString::create(p_arg11);
+ md.args[11] = StaticCString::create(p_arg12);
+ return md;
+}
+
+MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10, const char *p_arg11, const char *p_arg12, const char *p_arg13) {
+
+ MethodDefinition md;
+ md.name = StaticCString::create(p_name);
+ md.args.resize(13);
+ md.args[0] = StaticCString::create(p_arg1);
+ md.args[1] = StaticCString::create(p_arg2);
+ md.args[2] = StaticCString::create(p_arg3);
+ md.args[3] = StaticCString::create(p_arg4);
+ md.args[4] = StaticCString::create(p_arg5);
+ md.args[5] = StaticCString::create(p_arg6);
+ md.args[6] = StaticCString::create(p_arg7);
+ md.args[7] = StaticCString::create(p_arg8);
+ md.args[8] = StaticCString::create(p_arg9);
+ md.args[9] = StaticCString::create(p_arg10);
+ md.args[10] = StaticCString::create(p_arg11);
+ md.args[11] = StaticCString::create(p_arg12);
+ md.args[12] = StaticCString::create(p_arg13);
+ return md;
+}
+
#endif
ClassDB::APIType ClassDB::current_api = API_CORE;
diff --git a/core/class_db.h b/core/class_db.h
index 14e36e459b..d74317239b 100644
--- a/core/class_db.h
+++ b/core/class_db.h
@@ -68,6 +68,8 @@ MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_
MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9);
MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10);
MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10, const char *p_arg11);
+MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10, const char *p_arg11, const char *p_arg12);
+MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10, const char *p_arg11, const char *p_arg12, const char *p_arg13);
#else
diff --git a/core/color.cpp b/core/color.cpp
index 7278b5c4ee..a0568d26ed 100644
--- a/core/color.cpp
+++ b/core/color.cpp
@@ -413,96 +413,95 @@ Color::operator String() const {
Color Color::operator+(const Color &p_color) const {
return Color(
- CLAMP(r + p_color.r, 0.0, 1.0),
- CLAMP(g + p_color.g, 0.0, 1.0),
- CLAMP(b + p_color.b, 0.0, 1.0),
- CLAMP(a + p_color.a, 0.0, 1.0));
+ r + p_color.r,
+ g + p_color.g,
+ b + p_color.b,
+ a + p_color.a);
}
void Color::operator+=(const Color &p_color) {
- r = CLAMP(r + p_color.r, 0.0, 1.0);
- g = CLAMP(g + p_color.g, 0.0, 1.0);
- b = CLAMP(b + p_color.b, 0.0, 1.0);
- a = CLAMP(a + p_color.a, 0.0, 1.0);
+ r = r + p_color.r;
+ g = g + p_color.g;
+ b = b + p_color.b;
+ a = a + p_color.a;
}
Color Color::operator-(const Color &p_color) const {
return Color(
- CLAMP(r - p_color.r, 0.0, 1.0),
- CLAMP(g - p_color.g, 0.0, 1.0),
- CLAMP(b - p_color.b, 0.0, 1.0),
- CLAMP(a - p_color.a, 0.0, 1.0));
+ r - p_color.r,
+ g - p_color.g,
+ b - p_color.b,
+ a - p_color.a);
}
void Color::operator-=(const Color &p_color) {
- r = CLAMP(r - p_color.r, 0.0, 1.0);
- g = CLAMP(g - p_color.g, 0.0, 1.0);
- b = CLAMP(b - p_color.b, 0.0, 1.0);
- a = CLAMP(a - p_color.a, 0.0, 1.0);
+ r = r - p_color.r;
+ g = g - p_color.g;
+ b = b - p_color.b;
+ a = a - p_color.a;
}
Color Color::operator*(const Color &p_color) const {
return Color(
- CLAMP(r * p_color.r, 0.0, 1.0),
- CLAMP(g * p_color.g, 0.0, 1.0),
- CLAMP(b * p_color.b, 0.0, 1.0),
- CLAMP(a * p_color.a, 0.0, 1.0));
+ r * p_color.r,
+ g * p_color.g,
+ b * p_color.b,
+ a * p_color.a);
}
Color Color::operator*(const real_t &rvalue) const {
return Color(
- CLAMP(r * rvalue, 0.0, 1.0),
- CLAMP(g * rvalue, 0.0, 1.0),
- CLAMP(b * rvalue, 0.0, 1.0),
- CLAMP(a * rvalue, 0.0, 1.0));
+ r * rvalue,
+ g * rvalue,
+ b * rvalue,
+ a * rvalue);
}
void Color::operator*=(const Color &p_color) {
- r = CLAMP(r * p_color.r, 0.0, 1.0);
- g = CLAMP(g * p_color.g, 0.0, 1.0);
- b = CLAMP(b * p_color.b, 0.0, 1.0);
- a = CLAMP(a * p_color.a, 0.0, 1.0);
+ r = r * p_color.r;
+ g = g * p_color.g;
+ b = b * p_color.b;
+ a = a * p_color.a;
}
void Color::operator*=(const real_t &rvalue) {
- r = CLAMP(r * rvalue, 0.0, 1.0);
- g = CLAMP(g * rvalue, 0.0, 1.0);
- b = CLAMP(b * rvalue, 0.0, 1.0);
- a = CLAMP(a * rvalue, 0.0, 1.0);
-};
+ r = r * rvalue;
+ g = g * rvalue;
+ b = b * rvalue;
+ a = a * rvalue;
+}
Color Color::operator/(const Color &p_color) const {
return Color(
- p_color.r == 0 ? 1 : CLAMP(r / p_color.r, 0.0, 1.0),
- p_color.g == 0 ? 1 : CLAMP(g / p_color.g, 0.0, 1.0),
- p_color.b == 0 ? 1 : CLAMP(b / p_color.b, 0.0, 1.0),
- p_color.a == 0 ? 1 : CLAMP(a / p_color.a, 0.0, 1.0));
+ r / p_color.r,
+ g / p_color.g,
+ b / p_color.b,
+ a / p_color.a);
}
Color Color::operator/(const real_t &rvalue) const {
- if (rvalue == 0) return Color(1.0, 1.0, 1.0, 1.0);
return Color(
- CLAMP(r / rvalue, 0.0, 1.0),
- CLAMP(g / rvalue, 0.0, 1.0),
- CLAMP(b / rvalue, 0.0, 1.0),
- CLAMP(a / rvalue, 0.0, 1.0));
+ r / rvalue,
+ g / rvalue,
+ b / rvalue,
+ a / rvalue);
}
void Color::operator/=(const Color &p_color) {
- r = p_color.r == 0 ? 1 : CLAMP(r / p_color.r, 0.0, 1.0);
- g = p_color.g == 0 ? 1 : CLAMP(g / p_color.g, 0.0, 1.0);
- b = p_color.b == 0 ? 1 : CLAMP(b / p_color.b, 0.0, 1.0);
- a = p_color.a == 0 ? 1 : CLAMP(a / p_color.a, 0.0, 1.0);
+ r = r / p_color.r;
+ g = g / p_color.g;
+ b = b / p_color.b;
+ a = a / p_color.a;
}
void Color::operator/=(const real_t &rvalue) {
@@ -513,18 +512,18 @@ void Color::operator/=(const real_t &rvalue) {
b = 1.0;
a = 1.0;
} else {
- r = CLAMP(r / rvalue, 0.0, 1.0);
- g = CLAMP(g / rvalue, 0.0, 1.0);
- b = CLAMP(b / rvalue, 0.0, 1.0);
- a = CLAMP(a / rvalue, 0.0, 1.0);
+ r = r / rvalue;
+ g = g / rvalue;
+ b = b / rvalue;
+ a = a / rvalue;
}
};
Color Color::operator-() const {
return Color(
- CLAMP(1.0 - r, 0.0, 1.0),
- CLAMP(1.0 - g, 0.0, 1.0),
- CLAMP(1.0 - b, 0.0, 1.0),
- CLAMP(1.0 - a, 0.0, 1.0));
+ 1.0 - r,
+ 1.0 - g,
+ 1.0 - b,
+ 1.0 - a);
}
diff --git a/core/color.h b/core/color.h
index 0ff4fe6edd..9af8fb0a78 100644
--- a/core/color.h
+++ b/core/color.h
@@ -105,18 +105,18 @@ struct Color {
_FORCE_INLINE_ Color darkened(float p_amount) const {
Color res = *this;
- res.r = CLAMP(res.r * (1.0f - p_amount), 0.0, 1.0);
- res.g = CLAMP(res.g * (1.0f - p_amount), 0.0, 1.0);
- res.b = CLAMP(res.b * (1.0f - p_amount), 0.0, 1.0);
+ res.r = res.r * (1.0f - p_amount);
+ res.g = res.g * (1.0f - p_amount);
+ res.b = res.b * (1.0f - p_amount);
return res;
}
_FORCE_INLINE_ Color lightened(float p_amount) const {
Color res = *this;
- res.r = CLAMP(res.r + (1.0f - res.r) * p_amount, 0.0, 1.0);
- res.g = CLAMP(res.g + (1.0f - res.g) * p_amount, 0.0, 1.0);
- res.b = CLAMP(res.b + (1.0f - res.b) * p_amount, 0.0, 1.0);
+ res.r = res.r + (1.0f - res.r) * p_amount;
+ res.g = res.g + (1.0f - res.g) * p_amount;
+ res.b = res.b + (1.0f - res.b) * p_amount;
return res;
}
diff --git a/core/dictionary.cpp b/core/dictionary.cpp
index ae1af86b77..e3f4aa5f28 100644
--- a/core/dictionary.cpp
+++ b/core/dictionary.cpp
@@ -34,15 +34,10 @@
#include "safe_refcount.h"
#include "variant.h"
-struct _DictionaryVariantHash {
-
- static _FORCE_INLINE_ uint32_t hash(const Variant &p_variant) { return p_variant.hash(); }
-};
-
struct DictionaryPrivate {
SafeRefCount refcount;
- OrderedHashMap<Variant, Variant, _DictionaryVariantHash> variant_map;
+ OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator> variant_map;
};
void Dictionary::get_key_list(List<Variant> *p_keys) const {
@@ -50,7 +45,7 @@ void Dictionary::get_key_list(List<Variant> *p_keys) const {
if (_p->variant_map.empty())
return;
- for (OrderedHashMap<Variant, Variant, _DictionaryVariantHash>::Element E = _p->variant_map.front(); E; E = E.next()) {
+ for (OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.front(); E; E = E.next()) {
p_keys->push_back(E.key());
}
}
@@ -66,7 +61,7 @@ const Variant &Dictionary::operator[](const Variant &p_key) const {
}
const Variant *Dictionary::getptr(const Variant &p_key) const {
- OrderedHashMap<Variant, Variant, _DictionaryVariantHash>::ConstElement E = ((const OrderedHashMap<Variant, Variant, _DictionaryVariantHash> *)&_p->variant_map)->find(p_key);
+ OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::ConstElement E = ((const OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator> *)&_p->variant_map)->find(p_key);
if (!E)
return NULL;
@@ -75,7 +70,7 @@ const Variant *Dictionary::getptr(const Variant &p_key) const {
Variant *Dictionary::getptr(const Variant &p_key) {
- OrderedHashMap<Variant, Variant, _DictionaryVariantHash>::Element E = _p->variant_map.find(p_key);
+ OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.find(p_key);
if (!E)
return NULL;
@@ -84,7 +79,7 @@ Variant *Dictionary::getptr(const Variant &p_key) {
Variant Dictionary::get_valid(const Variant &p_key) const {
- OrderedHashMap<Variant, Variant, _DictionaryVariantHash>::ConstElement E = ((const OrderedHashMap<Variant, Variant, _DictionaryVariantHash> *)&_p->variant_map)->find(p_key);
+ OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::ConstElement E = ((const OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator> *)&_p->variant_map)->find(p_key);
if (!E)
return Variant();
@@ -177,7 +172,7 @@ Array Dictionary::keys() const {
return varr;
int i = 0;
- for (OrderedHashMap<Variant, Variant, _DictionaryVariantHash>::Element E = _p->variant_map.front(); E; E = E.next()) {
+ for (OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.front(); E; E = E.next()) {
varr[i] = E.key();
i++;
}
@@ -193,7 +188,7 @@ Array Dictionary::values() const {
return varr;
int i = 0;
- for (OrderedHashMap<Variant, Variant, _DictionaryVariantHash>::Element E = _p->variant_map.front(); E; E = E.next()) {
+ for (OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.front(); E; E = E.next()) {
varr[i] = E.get();
i++;
}
@@ -209,7 +204,7 @@ const Variant *Dictionary::next(const Variant *p_key) const {
return &_p->variant_map.front().key();
return NULL;
}
- OrderedHashMap<Variant, Variant, _DictionaryVariantHash>::Element E = _p->variant_map.find(*p_key);
+ OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.find(*p_key);
if (E && E.next())
return &E.next().key();
diff --git a/core/image.cpp b/core/image.cpp
index 41d70e6df6..07e705265d 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -775,7 +775,7 @@ void Image::crop_from_point(int p_x, int p_y, int p_width, int p_height) {
ERR_FAIL_COND(p_y + p_height > MAX_HEIGHT);
/* to save memory, cropping should be done in-place, however, since this function
- will most likely either not be used much, or in critical areas, for now it wont, because
+ will most likely either not be used much, or in critical areas, for now it won't, because
it's a waste of time. */
if (p_width == width && p_height == height && p_x == 0 && p_y == 0)
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index 7b2bccdfec..ef886cdb3c 100644
--- a/core/io/file_access_network.cpp
+++ b/core/io/file_access_network.cpp
@@ -83,7 +83,7 @@ int64_t FileAccessNetworkClient::get_64() {
void FileAccessNetworkClient::_thread_func() {
- client->set_nodelay(true);
+ client->set_no_delay(true);
while (!quit) {
DEBUG_PRINT("SEM WAIT - " + itos(sem->get()));
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 54743d37af..a9eb9466b7 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -682,6 +682,9 @@ void HTTPClient::_bind_methods() {
ClassDB::bind_method(D_METHOD("query_string_from_dict", "fields"), &HTTPClient::query_string_from_dict);
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "blocking_mode_enabled"), "set_blocking_mode", "is_blocking_mode_enabled");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "connection", PROPERTY_HINT_RESOURCE_TYPE, "StreamPeer", 0), "set_connection", "get_connection");
+
BIND_ENUM_CONSTANT(METHOD_GET);
BIND_ENUM_CONSTANT(METHOD_HEAD);
BIND_ENUM_CONSTANT(METHOD_POST);
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 35b9a8610c..9e21287780 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -333,7 +333,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
len -= 12;
buf += 12;
- if (flags & 2) // Obsolete format with property seperate from subpath
+ if (flags & 2) // Obsolete format with property separate from subpath
subnamecount++;
uint32_t total = namecount + subnamecount;
diff --git a/core/io/networked_multiplayer_peer.cpp b/core/io/networked_multiplayer_peer.cpp
index dbfb6d9a81..6354eef8b5 100644
--- a/core/io/networked_multiplayer_peer.cpp
+++ b/core/io/networked_multiplayer_peer.cpp
@@ -33,6 +33,7 @@
void NetworkedMultiplayerPeer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_transfer_mode", "mode"), &NetworkedMultiplayerPeer::set_transfer_mode);
+ ClassDB::bind_method(D_METHOD("get_transfer_mode"), &NetworkedMultiplayerPeer::get_transfer_mode);
ClassDB::bind_method(D_METHOD("set_target_peer", "id"), &NetworkedMultiplayerPeer::set_target_peer);
ClassDB::bind_method(D_METHOD("get_packet_peer"), &NetworkedMultiplayerPeer::get_packet_peer);
@@ -45,6 +46,9 @@ void NetworkedMultiplayerPeer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_refuse_new_connections", "enable"), &NetworkedMultiplayerPeer::set_refuse_new_connections);
ClassDB::bind_method(D_METHOD("is_refusing_new_connections"), &NetworkedMultiplayerPeer::is_refusing_new_connections);
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "refuse_new_connections"), "set_refuse_new_connections", "is_refusing_new_connections");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "transfer_mode", PROPERTY_HINT_ENUM, "Unreliable,Unreliable Ordered,Reliable"), "set_transfer_mode", "get_transfer_mode");
+
BIND_ENUM_CONSTANT(TRANSFER_MODE_UNRELIABLE);
BIND_ENUM_CONSTANT(TRANSFER_MODE_UNRELIABLE_ORDERED);
BIND_ENUM_CONSTANT(TRANSFER_MODE_RELIABLE);
diff --git a/core/io/networked_multiplayer_peer.h b/core/io/networked_multiplayer_peer.h
index 057b933dc9..66089c27b9 100644
--- a/core/io/networked_multiplayer_peer.h
+++ b/core/io/networked_multiplayer_peer.h
@@ -58,6 +58,7 @@ public:
};
virtual void set_transfer_mode(TransferMode p_mode) = 0;
+ virtual TransferMode get_transfer_mode() const = 0;
virtual void set_target_peer(int p_peer_id) = 0;
virtual int get_packet_peer() const = 0;
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index 9cfa04346c..bd851ebb6d 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -141,6 +141,8 @@ void PacketPeer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_allow_object_decoding", "enable"), &PacketPeer::set_allow_object_decoding);
ClassDB::bind_method(D_METHOD("is_object_decoding_allowed"), &PacketPeer::is_object_decoding_allowed);
+
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_object_decoding"), "set_allow_object_decoding", "is_object_decoding_allowed");
};
/***************/
@@ -153,11 +155,16 @@ void PacketPeerStream::_set_stream_peer(REF p_peer) {
void PacketPeerStream::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_stream_peer", "peer"), &PacketPeerStream::_set_stream_peer);
+ ClassDB::bind_method(D_METHOD("set_stream_peer", "peer"), &PacketPeerStream::set_stream_peer);
+ ClassDB::bind_method(D_METHOD("get_stream_peer"), &PacketPeerStream::get_stream_peer);
ClassDB::bind_method(D_METHOD("set_input_buffer_max_size", "max_size_bytes"), &PacketPeerStream::set_input_buffer_max_size);
ClassDB::bind_method(D_METHOD("set_output_buffer_max_size", "max_size_bytes"), &PacketPeerStream::set_output_buffer_max_size);
ClassDB::bind_method(D_METHOD("get_input_buffer_max_size"), &PacketPeerStream::get_input_buffer_max_size);
ClassDB::bind_method(D_METHOD("get_output_buffer_max_size"), &PacketPeerStream::get_output_buffer_max_size);
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "input_buffer_max_size"), "set_input_buffer_max_size", "get_input_buffer_max_size");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "output_buffer_max_size"), "set_output_buffer_max_size", "get_output_buffer_max_size");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream_peer", PROPERTY_HINT_RESOURCE_TYPE, "StreamPeer", 0), "set_stream_peer", "get_stream_peer");
}
Error PacketPeerStream::_poll_buffer() const {
@@ -262,6 +269,11 @@ void PacketPeerStream::set_stream_peer(const Ref<StreamPeer> &p_peer) {
peer = p_peer;
}
+Ref<StreamPeer> PacketPeerStream::get_stream_peer() const {
+
+ return peer;
+}
+
void PacketPeerStream::set_input_buffer_max_size(int p_max_size) {
//warning may lose packets
diff --git a/core/io/packet_peer.h b/core/io/packet_peer.h
index 6636d56959..b10152e96b 100644
--- a/core/io/packet_peer.h
+++ b/core/io/packet_peer.h
@@ -98,6 +98,7 @@ public:
virtual int get_max_packet_size() const;
void set_stream_peer(const Ref<StreamPeer> &p_peer);
+ Ref<StreamPeer> get_stream_peer() const;
void set_input_buffer_max_size(int p_max_size);
int get_input_buffer_max_size() const;
void set_output_buffer_max_size(int p_max_size);
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 87add585eb..1351030d1e 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -202,7 +202,8 @@ RES ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p
if (OS::get_singleton()->is_stdout_verbose())
print_line("load resource: " + local_path + " (cached)");
-
+ if (r_error)
+ *r_error = OK;
return RES(ResourceCache::get(local_path));
}
diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp
index f142abd3a4..927b9f6366 100644
--- a/core/io/stream_peer.cpp
+++ b/core/io/stream_peer.cpp
@@ -310,7 +310,7 @@ float StreamPeer::get_float() {
return decode_float(buf);
}
-float StreamPeer::get_double() {
+double StreamPeer::get_double() {
uint8_t buf[8];
get_data(buf, 8);
@@ -375,18 +375,18 @@ void StreamPeer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_big_endian", "enable"), &StreamPeer::set_big_endian);
ClassDB::bind_method(D_METHOD("is_big_endian_enabled"), &StreamPeer::is_big_endian_enabled);
- ClassDB::bind_method(D_METHOD("put_8", "val"), &StreamPeer::put_8);
- ClassDB::bind_method(D_METHOD("put_u8", "val"), &StreamPeer::put_u8);
- ClassDB::bind_method(D_METHOD("put_16", "val"), &StreamPeer::put_16);
- ClassDB::bind_method(D_METHOD("put_u16", "val"), &StreamPeer::put_u16);
- ClassDB::bind_method(D_METHOD("put_32", "val"), &StreamPeer::put_32);
- ClassDB::bind_method(D_METHOD("put_u32", "val"), &StreamPeer::put_u32);
- ClassDB::bind_method(D_METHOD("put_64", "val"), &StreamPeer::put_64);
- ClassDB::bind_method(D_METHOD("put_u64", "val"), &StreamPeer::put_u64);
- ClassDB::bind_method(D_METHOD("put_float", "val"), &StreamPeer::put_float);
- ClassDB::bind_method(D_METHOD("put_double", "val"), &StreamPeer::put_double);
- ClassDB::bind_method(D_METHOD("put_utf8_string", "val"), &StreamPeer::put_utf8_string);
- ClassDB::bind_method(D_METHOD("put_var", "val"), &StreamPeer::put_var);
+ ClassDB::bind_method(D_METHOD("put_8", "value"), &StreamPeer::put_8);
+ ClassDB::bind_method(D_METHOD("put_u8", "value"), &StreamPeer::put_u8);
+ ClassDB::bind_method(D_METHOD("put_16", "value"), &StreamPeer::put_16);
+ ClassDB::bind_method(D_METHOD("put_u16", "value"), &StreamPeer::put_u16);
+ ClassDB::bind_method(D_METHOD("put_32", "value"), &StreamPeer::put_32);
+ ClassDB::bind_method(D_METHOD("put_u32", "value"), &StreamPeer::put_u32);
+ ClassDB::bind_method(D_METHOD("put_64", "value"), &StreamPeer::put_64);
+ ClassDB::bind_method(D_METHOD("put_u64", "value"), &StreamPeer::put_u64);
+ ClassDB::bind_method(D_METHOD("put_float", "value"), &StreamPeer::put_float);
+ ClassDB::bind_method(D_METHOD("put_double", "value"), &StreamPeer::put_double);
+ ClassDB::bind_method(D_METHOD("put_utf8_string", "value"), &StreamPeer::put_utf8_string);
+ ClassDB::bind_method(D_METHOD("put_var", "value"), &StreamPeer::put_var);
ClassDB::bind_method(D_METHOD("get_8"), &StreamPeer::get_8);
ClassDB::bind_method(D_METHOD("get_u8"), &StreamPeer::get_u8);
@@ -401,6 +401,8 @@ void StreamPeer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_string", "bytes"), &StreamPeer::get_string);
ClassDB::bind_method(D_METHOD("get_utf8_string", "bytes"), &StreamPeer::get_utf8_string);
ClassDB::bind_method(D_METHOD("get_var"), &StreamPeer::get_var);
+
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "big_endian"), "set_big_endian", "is_big_endian_enabled");
}
////////////////////////////////
@@ -414,6 +416,8 @@ void StreamPeerBuffer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_data_array"), &StreamPeerBuffer::get_data_array);
ClassDB::bind_method(D_METHOD("clear"), &StreamPeerBuffer::clear);
ClassDB::bind_method(D_METHOD("duplicate"), &StreamPeerBuffer::duplicate);
+
+ ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data_array"), "set_data_array", "get_data_array");
}
Error StreamPeerBuffer::put_data(const uint8_t *p_data, int p_bytes) {
diff --git a/core/io/stream_peer.h b/core/io/stream_peer.h
index ff9ae788ec..605b0a7980 100644
--- a/core/io/stream_peer.h
+++ b/core/io/stream_peer.h
@@ -83,7 +83,7 @@ public:
uint64_t get_u64();
int64_t get_64();
float get_float();
- float get_double();
+ double get_double();
String get_string(int p_bytes);
String get_utf8_string(int p_bytes);
Variant get_var();
diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp
index 633b353102..07a01ff99f 100644
--- a/core/io/stream_peer_ssl.cpp
+++ b/core/io/stream_peer_ssl.cpp
@@ -52,6 +52,7 @@ bool StreamPeerSSL::is_available() {
void StreamPeerSSL::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("poll"), &StreamPeerSSL::poll);
ClassDB::bind_method(D_METHOD("accept_stream", "stream"), &StreamPeerSSL::accept_stream);
ClassDB::bind_method(D_METHOD("connect_to_stream", "stream", "validate_certs", "for_hostname"), &StreamPeerSSL::connect_to_stream, DEFVAL(false), DEFVAL(String()));
ClassDB::bind_method(D_METHOD("get_status"), &StreamPeerSSL::get_status);
diff --git a/core/io/stream_peer_ssl.h b/core/io/stream_peer_ssl.h
index e4d14ebdfd..f903438c28 100644
--- a/core/io/stream_peer_ssl.h
+++ b/core/io/stream_peer_ssl.h
@@ -57,6 +57,7 @@ public:
STATUS_ERROR_HOSTNAME_MISMATCH
};
+ virtual void poll() = 0;
virtual Error accept_stream(Ref<StreamPeer> p_base) = 0;
virtual Error connect_to_stream(Ref<StreamPeer> p_base, bool p_validate_certs = false, const String &p_for_hostname = String()) = 0;
virtual Status get_status() const = 0;
diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp
index 9cfa810034..5d008904ff 100644
--- a/core/io/stream_peer_tcp.cpp
+++ b/core/io/stream_peer_tcp.cpp
@@ -55,6 +55,7 @@ void StreamPeerTCP::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_connected_host"), &StreamPeerTCP::get_connected_host);
ClassDB::bind_method(D_METHOD("get_connected_port"), &StreamPeerTCP::get_connected_port);
ClassDB::bind_method(D_METHOD("disconnect_from_host"), &StreamPeerTCP::disconnect_from_host);
+ ClassDB::bind_method(D_METHOD("set_no_delay", "enabled"), &StreamPeerTCP::set_no_delay);
BIND_ENUM_CONSTANT(STATUS_NONE);
BIND_ENUM_CONSTANT(STATUS_CONNECTING);
diff --git a/core/io/stream_peer_tcp.h b/core/io/stream_peer_tcp.h
index fc84525c5f..8a16d820f2 100644
--- a/core/io/stream_peer_tcp.h
+++ b/core/io/stream_peer_tcp.h
@@ -65,7 +65,7 @@ public:
virtual void disconnect_from_host() = 0;
virtual IP_Address get_connected_host() const = 0;
virtual uint16_t get_connected_port() const = 0;
- virtual void set_nodelay(bool p_enabled) = 0;
+ virtual void set_no_delay(bool p_enabled) = 0;
static Ref<StreamPeerTCP> create_ref();
static StreamPeerTCP *create();
diff --git a/core/list.h b/core/list.h
index a00372e39f..f977df4634 100644
--- a/core/list.h
+++ b/core/list.h
@@ -388,7 +388,7 @@ public:
};
/**
- * return wether the list is empty
+ * return whether the list is empty
*/
_FORCE_INLINE_ bool empty() const {
diff --git a/core/make_binders.py b/core/make_binders.py
index 6f42c6e8eb..1e581f8ce3 100644
--- a/core/make_binders.py
+++ b/core/make_binders.py
@@ -244,7 +244,7 @@ def make_version(template, nargs, argmax, const, ret):
def run(target, source, env):
- versions = 11
+ versions = 13
versions_ext = 6
text = ""
text_ext = ""
diff --git a/core/math/octree.h b/core/math/octree.h
index 7411e4aa52..4e3d6257f0 100644
--- a/core/math/octree.h
+++ b/core/math/octree.h
@@ -612,7 +612,7 @@ bool Octree<T, use_pairs, AL>::_remove_element_from_octant(Element *p_element, O
bool unpaired = false;
if (use_pairs && p_octant->last_pass != pass) {
- // check wether we should unpair stuff
+ // check whether we should unpair stuff
// always test pairable
typename List<Element *, AL>::Element *E = p_octant->pairable_elements.front();
while (E) {
diff --git a/core/math/triangulate.cpp b/core/math/triangulate.cpp
index 957e16f92c..5bae74ac7e 100644
--- a/core/math/triangulate.cpp
+++ b/core/math/triangulate.cpp
@@ -74,7 +74,7 @@ bool Triangulate::is_inside_triangle(real_t Ax, real_t Ay,
cCROSSap = cx * apy - cy * apx;
bCROSScp = bx * cpy - by * cpx;
- return ((aCROSSbp >= 0.0) && (bCROSScp >= 0.0) && (cCROSSap >= 0.0));
+ return ((aCROSSbp > 0.0) && (bCROSScp > 0.0) && (cCROSSap > 0.0));
};
bool Triangulate::snip(const Vector<Vector2> &p_contour, int u, int v, int w, int n, const Vector<int> &V) {
diff --git a/core/method_bind.h b/core/method_bind.h
index 2e5712c3fe..e02d64c935 100644
--- a/core/method_bind.h
+++ b/core/method_bind.h
@@ -243,7 +243,7 @@ public:
PropertyInfo get_argument_info(int p_argument) const;
PropertyInfo get_return_info() const;
- void set_argument_names(const Vector<StringName> &p_names); //set by class, db, cant be inferred otherwise
+ void set_argument_names(const Vector<StringName> &p_names); //set by class, db, can't be inferred otherwise
Vector<StringName> get_argument_names() const;
#endif
diff --git a/core/oa_hash_map.h b/core/oa_hash_map.h
index c3b32af545..280aea6a14 100644
--- a/core/oa_hash_map.h
+++ b/core/oa_hash_map.h
@@ -36,7 +36,7 @@
#include "os/copymem.h"
#include "os/memory.h"
-// uncomment this to disable intial local storage.
+// uncomment this to disable initial local storage.
#define OA_HASH_MAP_INITIAL_LOCAL_STORAGE
/**
diff --git a/core/object.cpp b/core/object.cpp
index f9d733c11f..aaa37e6cf2 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -605,11 +605,11 @@ void Object::get_property_list(List<PropertyInfo> *p_list, bool p_reversed) cons
p_list->push_back(PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_STORE_IF_NONZERO));
#ifdef TOOLS_ENABLED
if (editor_section_folding.size()) {
- p_list->push_back(PropertyInfo(Variant::ARRAY, CoreStringNames::get_singleton()->_sections_unfolded, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
+ p_list->push_back(PropertyInfo(Variant::ARRAY, CoreStringNames::get_singleton()->_sections_unfolded, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
}
#endif
if (!metadata.empty())
- p_list->push_back(PropertyInfo(Variant::DICTIONARY, "__meta__", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_STORE_IF_NONZERO));
+ p_list->push_back(PropertyInfo(Variant::DICTIONARY, "__meta__", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_STORE_IF_NONZERO));
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 5de87b8a7d..8306b5a356 100644
--- a/core/object.h
+++ b/core/object.h
@@ -86,6 +86,7 @@ enum PropertyHint {
PROPERTY_HINT_PROPERTY_OF_SCRIPT, ///< a property of a script & base
PROPERTY_HINT_OBJECT_TOO_BIG, ///< object is too big to send
PROPERTY_HINT_MAX,
+ // When updating PropertyHint, also sync the hardcoded list in VisualScriptEditorVariableEdit
};
enum PropertyUsageFlags {
@@ -111,10 +112,11 @@ enum PropertyUsageFlags {
PROPERTY_USAGE_CLASS_IS_ENUM = 1 << 18,
PROPERTY_USAGE_NIL_IS_VARIANT = 1 << 19,
PROPERTY_USAGE_INTERNAL = 1 << 20,
+ PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE = 1 << 21, // If the object is duplicated also this property will be duplicated
PROPERTY_USAGE_DEFAULT = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_NETWORK,
PROPERTY_USAGE_DEFAULT_INTL = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_NETWORK | PROPERTY_USAGE_INTERNATIONALIZED,
- PROPERTY_USAGE_NOEDITOR = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_NETWORK | PROPERTY_USAGE_INTERNAL,
+ PROPERTY_USAGE_NOEDITOR = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_NETWORK,
};
#define ADD_SIGNAL(m_signal) ClassDB::add_signal(get_class_static(), m_signal)
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp
index 368b4ad09d..033b4b12b9 100644
--- a/core/os/file_access.cpp
+++ b/core/os/file_access.cpp
@@ -479,6 +479,9 @@ void FileAccess::store_double(double p_dest) {
uint64_t FileAccess::get_modified_time(const String &p_file) {
+ if (PackedData::get_singleton() && !PackedData::get_singleton()->is_disabled() && PackedData::get_singleton()->has_path(p_file))
+ return 0;
+
FileAccess *fa = create_for_path(p_file);
ERR_FAIL_COND_V(!fa, 0);
diff --git a/core/os/input_event.h b/core/os/input_event.h
index 72057659d2..ad754d0d1f 100644
--- a/core/os/input_event.h
+++ b/core/os/input_event.h
@@ -110,8 +110,8 @@ enum JoystickList {
JOY_WII_C = JOY_BUTTON_5,
JOY_WII_Z = JOY_BUTTON_6,
- JOY_WII_MINUS = JOY_BUTTON_9,
- JOY_WII_PLUS = JOY_BUTTON_10,
+ JOY_WII_MINUS = JOY_BUTTON_10,
+ JOY_WII_PLUS = JOY_BUTTON_11,
// end of history
diff --git a/core/os/os.cpp b/core/os/os.cpp
index c6e5de703c..422acf95dc 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -616,6 +616,17 @@ bool OS::has_feature(const String &p_feature) {
return false;
}
+void OS::center_window() {
+
+ if (is_window_fullscreen()) return;
+
+ Size2 scr = get_screen_size(get_current_screen());
+ Size2 wnd = get_real_window_size();
+ int x = scr.width / 2 - wnd.width / 2;
+ int y = scr.height / 2 - wnd.height / 2;
+ set_window_position(Vector2(x, y));
+}
+
OS::OS() {
void *volatile stack_bottom;
diff --git a/core/os/os.h b/core/os/os.h
index 248e1dbefa..1ec488df06 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -182,6 +182,7 @@ public:
virtual Point2 get_window_position() const { return Vector2(); }
virtual void set_window_position(const Point2 &p_position) {}
virtual Size2 get_window_size() const = 0;
+ virtual Size2 get_real_window_size() const { return get_window_size(); }
virtual void set_window_size(const Size2 p_size) {}
virtual void set_window_fullscreen(bool p_enabled) {}
virtual bool is_window_fullscreen() const { return true; }
@@ -192,6 +193,7 @@ public:
virtual void set_window_maximized(bool p_enabled) {}
virtual bool is_window_maximized() const { return true; }
virtual void request_attention() {}
+ virtual void center_window();
virtual void set_borderless_window(bool p_borderless) {}
virtual bool get_borderless_window() { return 0; }
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 0c19de382c..0991c0df68 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -167,7 +167,7 @@ bool ProjectSettings::_set(const StringName &p_name, const Variant &p_value) {
}
if (props.has(p_name)) {
- if (!props[p_name].overrided)
+ if (!props[p_name].overridden)
props[p_name].variant = p_value;
} else {
diff --git a/core/project_settings.h b/core/project_settings.h
index e85092e431..eba53441cf 100644
--- a/core/project_settings.h
+++ b/core/project_settings.h
@@ -58,19 +58,19 @@ protected:
Variant variant;
Variant initial;
bool hide_from_editor;
- bool overrided;
+ bool overridden;
VariantContainer() :
order(0),
persist(false),
hide_from_editor(false),
- overrided(false) {
+ overridden(false) {
}
VariantContainer(const Variant &p_variant, int p_order, bool p_persist = false) :
order(p_order),
persist(p_persist),
variant(p_variant),
hide_from_editor(false),
- overrided(false) {
+ overridden(false) {
}
};
diff --git a/core/resource.cpp b/core/resource.cpp
index 38f938932c..2eeed50d9d 100644
--- a/core/resource.cpp
+++ b/core/resource.cpp
@@ -74,7 +74,7 @@ void Resource::set_path(const String &p_path, bool p_take_over) {
bool exists = ResourceCache::resources.has(p_path);
ResourceCache::lock->read_unlock();
- ERR_EXPLAIN("Another resource is loaded from path: " + p_path);
+ ERR_EXPLAIN("Another resource is loaded from path: " + p_path + " (possible cyclic resource inclusion)");
ERR_FAIL_COND(exists);
}
}
diff --git a/core/safe_refcount.cpp b/core/safe_refcount.cpp
index ff2f17103c..3b203f6977 100644
--- a/core/safe_refcount.cpp
+++ b/core/safe_refcount.cpp
@@ -119,8 +119,8 @@ _ALWAYS_INLINE_ uint64_t _atomic_exchange_if_greater_impl(register uint64_t *pw,
// The actual advertised functions; they'll call the right implementation
-uint32_t atomic_conditional_increment(register uint32_t *counter) {
- return _atomic_conditional_increment_impl(counter);
+uint32_t atomic_conditional_increment(register uint32_t *pw) {
+ return _atomic_conditional_increment_impl(pw);
}
uint32_t atomic_decrement(register uint32_t *pw) {
@@ -143,8 +143,8 @@ uint32_t atomic_exchange_if_greater(register uint32_t *pw, register uint32_t val
return _atomic_exchange_if_greater_impl(pw, val);
}
-uint64_t atomic_conditional_increment(register uint64_t *counter) {
- return _atomic_conditional_increment_impl(counter);
+uint64_t atomic_conditional_increment(register uint64_t *pw) {
+ return _atomic_conditional_increment_impl(pw);
}
uint64_t atomic_decrement(register uint64_t *pw) {
diff --git a/core/script_debugger_local.cpp b/core/script_debugger_local.cpp
index 0da377453e..c0e115e300 100644
--- a/core/script_debugger_local.cpp
+++ b/core/script_debugger_local.cpp
@@ -291,7 +291,8 @@ void ScriptDebuggerLocal::profiling_end() {
void ScriptDebuggerLocal::send_message(const String &p_message, const Array &p_args) {
- print_line("MESSAGE: '" + p_message + "' - " + String(Variant(p_args)));
+ // This needs to be cleaned up entirely.
+ // print_line("MESSAGE: '" + p_message + "' - " + String(Variant(p_args)));
}
void ScriptDebuggerLocal::send_error(const String &p_func, const String &p_file, int p_line, const String &p_err, const String &p_descr, ErrorHandlerType p_type, const Vector<ScriptLanguage::StackInfo> &p_stack_info) {
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index a297bb738f..41071ace5d 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -598,7 +598,13 @@ void ScriptDebuggerRemote::_send_object_id(ObjectID p_id) {
Array send_props;
for (int i = 0; i < properties.size(); i++) {
const PropertyInfo &pi = properties[i].first;
- const Variant &var = properties[i].second;
+ Variant &var = properties[i].second;
+
+ WeakRef *ref = Object::cast_to<WeakRef>(var);
+ if (ref) {
+ var = ref->get_ref();
+ }
+
RES res = var;
Array prop;
diff --git a/core/script_language.cpp b/core/script_language.cpp
index 2a8c76c4b8..1dab58e29e 100644
--- a/core/script_language.cpp
+++ b/core/script_language.cpp
@@ -61,6 +61,8 @@ void Script::_bind_methods() {
ClassDB::bind_method(D_METHOD("has_script_signal", "signal_name"), &Script::has_script_signal);
ClassDB::bind_method(D_METHOD("is_tool"), &Script::is_tool);
+
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "source_code", PROPERTY_HINT_NONE, "", 0), "set_source_code", "get_source_code");
}
void ScriptServer::set_scripting_enabled(bool p_enabled) {
diff --git a/core/script_language.h b/core/script_language.h
index 66614a293c..d1da0a3b72 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -179,7 +179,7 @@ class ScriptCodeCompletionCache {
public:
virtual RES get_cached_resource(const String &p_path) = 0;
- static ScriptCodeCompletionCache *get_sigleton() { return singleton; }
+ static ScriptCodeCompletionCache *get_singleton() { return singleton; }
ScriptCodeCompletionCache();
};
diff --git a/core/string_buffer.cpp b/core/string_buffer.cpp
deleted file mode 100644
index aac2090378..0000000000
--- a/core/string_buffer.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/*************************************************************************/
-/* string_buffer.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "string_buffer.h"
-
-#include <string.h>
-
-StringBuffer &StringBuffer::append(CharType p_char) {
- reserve(string_length + 2);
- current_buffer_ptr()[string_length++] = p_char;
- return *this;
-}
-
-StringBuffer &StringBuffer::append(const String &p_string) {
- return append(p_string.c_str());
-}
-
-StringBuffer &StringBuffer::append(const char *p_str) {
- int len = strlen(p_str);
- reserve(string_length + len + 1);
-
- CharType *buf = current_buffer_ptr();
- for (const char *c_ptr = p_str; *c_ptr; ++c_ptr) {
- buf[string_length++] = *c_ptr;
- }
- return *this;
-}
-
-StringBuffer &StringBuffer::append(const CharType *p_str, int p_clip_to_len) {
- int len = 0;
- while ((p_clip_to_len < 0 || len < p_clip_to_len) && p_str[len]) {
- ++len;
- }
- reserve(string_length + len + 1);
- memcpy(&(current_buffer_ptr()[string_length]), p_str, len * sizeof(CharType));
- string_length += len;
-
- return *this;
-}
-
-StringBuffer &StringBuffer::reserve(int p_size) {
- if (p_size < SHORT_BUFFER_SIZE || p_size < buffer.size())
- return *this;
-
- bool need_copy = string_length > 0 && buffer.empty();
- buffer.resize(next_power_of_2(p_size));
- if (need_copy) {
- memcpy(buffer.ptrw(), short_buffer, string_length * sizeof(CharType));
- }
-
- return *this;
-}
-
-int StringBuffer::length() const {
- return string_length;
-}
-
-String StringBuffer::as_string() {
- current_buffer_ptr()[string_length] = '\0';
- if (buffer.empty()) {
- return String(short_buffer);
- } else {
- buffer.resize(string_length + 1);
- return buffer;
- }
-}
-
-double StringBuffer::as_double() {
- current_buffer_ptr()[string_length] = '\0';
- return String::to_double(current_buffer_ptr());
-}
-
-int64_t StringBuffer::as_int() {
- current_buffer_ptr()[string_length] = '\0';
- return String::to_int(current_buffer_ptr());
-}
diff --git a/core/string_buffer.h b/core/string_buffer.h
index f0ead66bb8..b148e45544 100644
--- a/core/string_buffer.h
+++ b/core/string_buffer.h
@@ -32,9 +32,10 @@
#define STRING_BUFFER_H
#include "ustring.h"
+#include <string.h>
+template <int SHORT_BUFFER_SIZE = 64>
class StringBuffer {
- static const int SHORT_BUFFER_SIZE = 64;
CharType short_buffer[SHORT_BUFFER_SIZE];
String buffer;
@@ -80,4 +81,83 @@ public:
}
};
+template <int SHORT_BUFFER_SIZE>
+StringBuffer<SHORT_BUFFER_SIZE> &StringBuffer<SHORT_BUFFER_SIZE>::append(CharType p_char) {
+ reserve(string_length + 2);
+ current_buffer_ptr()[string_length++] = p_char;
+ return *this;
+}
+
+template <int SHORT_BUFFER_SIZE>
+StringBuffer<SHORT_BUFFER_SIZE> &StringBuffer<SHORT_BUFFER_SIZE>::append(const String &p_string) {
+ return append(p_string.c_str());
+}
+
+template <int SHORT_BUFFER_SIZE>
+StringBuffer<SHORT_BUFFER_SIZE> &StringBuffer<SHORT_BUFFER_SIZE>::append(const char *p_str) {
+ int len = strlen(p_str);
+ reserve(string_length + len + 1);
+
+ CharType *buf = current_buffer_ptr();
+ for (const char *c_ptr = p_str; *c_ptr; ++c_ptr) {
+ buf[string_length++] = *c_ptr;
+ }
+ return *this;
+}
+
+template <int SHORT_BUFFER_SIZE>
+StringBuffer<SHORT_BUFFER_SIZE> &StringBuffer<SHORT_BUFFER_SIZE>::append(const CharType *p_str, int p_clip_to_len) {
+ int len = 0;
+ while ((p_clip_to_len < 0 || len < p_clip_to_len) && p_str[len]) {
+ ++len;
+ }
+ reserve(string_length + len + 1);
+ memcpy(&(current_buffer_ptr()[string_length]), p_str, len * sizeof(CharType));
+ string_length += len;
+
+ return *this;
+}
+
+template <int SHORT_BUFFER_SIZE>
+StringBuffer<SHORT_BUFFER_SIZE> &StringBuffer<SHORT_BUFFER_SIZE>::reserve(int p_size) {
+ if (p_size < SHORT_BUFFER_SIZE || p_size < buffer.size())
+ return *this;
+
+ bool need_copy = string_length > 0 && buffer.empty();
+ buffer.resize(next_power_of_2(p_size));
+ if (need_copy) {
+ memcpy(buffer.ptrw(), short_buffer, string_length * sizeof(CharType));
+ }
+
+ return *this;
+}
+
+template <int SHORT_BUFFER_SIZE>
+int StringBuffer<SHORT_BUFFER_SIZE>::length() const {
+ return string_length;
+}
+
+template <int SHORT_BUFFER_SIZE>
+String StringBuffer<SHORT_BUFFER_SIZE>::as_string() {
+ current_buffer_ptr()[string_length] = '\0';
+ if (buffer.empty()) {
+ return String(short_buffer);
+ } else {
+ buffer.resize(string_length + 1);
+ return buffer;
+ }
+}
+
+template <int SHORT_BUFFER_SIZE>
+double StringBuffer<SHORT_BUFFER_SIZE>::as_double() {
+ current_buffer_ptr()[string_length] = '\0';
+ return String::to_double(current_buffer_ptr());
+}
+
+template <int SHORT_BUFFER_SIZE>
+int64_t StringBuffer<SHORT_BUFFER_SIZE>::as_int() {
+ current_buffer_ptr()[string_length] = '\0';
+ return String::to_int(current_buffer_ptr());
+}
+
#endif
diff --git a/core/string_builder.cpp b/core/string_builder.cpp
index 4d567cbc03..8ab7e0ea8f 100644
--- a/core/string_builder.cpp
+++ b/core/string_builder.cpp
@@ -56,6 +56,9 @@ StringBuilder &StringBuilder::append(const char *p_cstring) {
String StringBuilder::as_string() const {
+ if (string_length == 0)
+ return "";
+
CharType *buffer = memnew_arr(CharType, string_length);
int current_position = 0;
diff --git a/core/translation.cpp b/core/translation.cpp
index cf947404cd..32096d2eab 100644
--- a/core/translation.cpp
+++ b/core/translation.cpp
@@ -873,7 +873,7 @@ void Translation::_bind_methods() {
ClassDB::bind_method(D_METHOD("_set_messages"), &Translation::_set_messages);
ClassDB::bind_method(D_METHOD("_get_messages"), &Translation::_get_messages);
- ADD_PROPERTY(PropertyInfo(Variant::POOL_STRING_ARRAY, "messages", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_messages", "_get_messages");
+ ADD_PROPERTY(PropertyInfo(Variant::POOL_STRING_ARRAY, "messages", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_messages", "_get_messages");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "locale"), "set_locale", "get_locale");
}
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 528ecc52db..d445e4ed47 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -686,6 +686,9 @@ Vector<String> String::split_spaces() const {
int from = 0;
int i = 0;
int len = length();
+ if (len == 0)
+ return ret;
+
bool inside = false;
while (true) {
@@ -1098,9 +1101,8 @@ String String::num(double p_num, int p_decimals) {
String String::num_int64(int64_t p_num, int base, bool capitalize_hex) {
bool sign = p_num < 0;
- int64_t num = ABS(p_num);
- int64_t n = num;
+ int64_t n = p_num;
int chars = 0;
do {
@@ -1114,9 +1116,9 @@ String String::num_int64(int64_t p_num, int base, bool capitalize_hex) {
s.resize(chars + 1);
CharType *c = s.ptrw();
c[chars] = 0;
- n = num;
+ n = p_num;
do {
- int mod = n % base;
+ int mod = ABS(n % base);
if (mod >= 10) {
char a = (capitalize_hex ? 'A' : 'a');
c[--chars] = a + (mod - 10);
@@ -2215,7 +2217,7 @@ int String::find(const String &p_str, int p_from) const {
const int len = length();
if (src_len == 0 || len == 0)
- return -1; //wont find anything!
+ return -1; // won't find anything!
const CharType *src = c_str();
const CharType *str = p_str.c_str();
@@ -2254,7 +2256,7 @@ int String::find(const char *p_str, int p_from) const {
const int len = length();
if (len == 0)
- return -1; //wont find anything!
+ return -1; // won't find anything!
const CharType *src = c_str();
@@ -2315,7 +2317,7 @@ int String::findmk(const Vector<String> &p_keys, int p_from, int *r_key) const {
int len = length();
if (len == 0)
- return -1; //wont find anything!
+ return -1; // won't find anything!
const CharType *src = c_str();
@@ -2364,7 +2366,7 @@ int String::findn(const String &p_str, int p_from) const {
int src_len = p_str.length();
if (src_len == 0 || length() == 0)
- return -1; //wont find anything!
+ return -1; // won't find anything!
const CharType *srcd = c_str();
@@ -2460,7 +2462,7 @@ int String::rfindn(const String &p_str, int p_from) const {
int len = length();
if (src_len == 0 || len == 0)
- return -1; //wont find anything!
+ return -1; // won't find anything!
const CharType *src = c_str();
@@ -3165,7 +3167,7 @@ String String::http_unescape() const {
if ((ord1 >= '0' && ord1 <= '9') || (ord1 >= 'A' && ord1 <= 'Z')) {
CharType ord2 = ord_at(i + 2);
if ((ord2 >= '0' && ord2 <= '9') || (ord2 >= 'A' && ord2 <= 'Z')) {
- char bytes[2] = { ord1, ord2 };
+ char bytes[2] = { (char)ord1, (char)ord2 };
res += (char)strtol(bytes, NULL, 16);
i += 2;
}
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index e9f7af3f63..5607751a27 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -1539,7 +1539,7 @@ void register_variant_methods() {
ADDFUNC0R(VECTOR3, BOOL, Vector3, is_normalized, varray());
ADDFUNC0R(VECTOR3, VECTOR3, Vector3, normalized, varray());
ADDFUNC0R(VECTOR3, VECTOR3, Vector3, inverse, varray());
- ADDFUNC1R(VECTOR3, VECTOR3, Vector3, snapped, REAL, "by", varray());
+ ADDFUNC1R(VECTOR3, VECTOR3, Vector3, snapped, VECTOR3, "by", varray());
ADDFUNC2R(VECTOR3, VECTOR3, Vector3, rotated, VECTOR3, "axis", REAL, "phi", varray());
ADDFUNC2R(VECTOR3, VECTOR3, Vector3, linear_interpolate, VECTOR3, "b", REAL, "t", varray());
ADDFUNC4R(VECTOR3, VECTOR3, Vector3, cubic_interpolate, VECTOR3, "b", VECTOR3, "pre_a", VECTOR3, "post_b", REAL, "t", varray());
@@ -1748,10 +1748,10 @@ void register_variant_methods() {
ADDFUNC1R(TRANSFORM2D, TRANSFORM2D, Transform2D, rotated, REAL, "phi", varray());
ADDFUNC1R(TRANSFORM2D, TRANSFORM2D, Transform2D, scaled, VECTOR2, "scale", varray());
ADDFUNC1R(TRANSFORM2D, TRANSFORM2D, Transform2D, translated, VECTOR2, "offset", varray());
- ADDFUNC1R(TRANSFORM2D, TRANSFORM2D, Transform2D, xform, NIL, "v", varray());
- ADDFUNC1R(TRANSFORM2D, TRANSFORM2D, Transform2D, xform_inv, NIL, "v", varray());
- ADDFUNC1R(TRANSFORM2D, TRANSFORM2D, Transform2D, basis_xform, NIL, "v", varray());
- ADDFUNC1R(TRANSFORM2D, TRANSFORM2D, Transform2D, basis_xform_inv, NIL, "v", varray());
+ ADDFUNC1R(TRANSFORM2D, NIL, Transform2D, xform, NIL, "v", varray());
+ ADDFUNC1R(TRANSFORM2D, NIL, Transform2D, xform_inv, NIL, "v", varray());
+ ADDFUNC1R(TRANSFORM2D, VECTOR2, Transform2D, basis_xform, VECTOR2, "v", varray());
+ ADDFUNC1R(TRANSFORM2D, VECTOR2, Transform2D, basis_xform_inv, VECTOR2, "v", varray());
ADDFUNC2R(TRANSFORM2D, TRANSFORM2D, Transform2D, interpolate_with, TRANSFORM2D, "transform", REAL, "weight", varray());
ADDFUNC0R(BASIS, BASIS, Basis, inverse, varray());
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp
index 54edb02347..446aee286d 100644
--- a/core/variant_parser.cpp
+++ b/core/variant_parser.cpp
@@ -178,7 +178,7 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri
};
case '#': {
- StringBuffer color_str;
+ StringBuffer<> color_str;
color_str += '#';
while (true) {
CharType ch = p_stream->get_char();
@@ -299,7 +299,7 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri
if (cchar == '-' || (cchar >= '0' && cchar <= '9')) {
//a number
- StringBuffer num;
+ StringBuffer<> num;
#define READING_SIGN 0
#define READING_INT 1
#define READING_DEC 2
@@ -378,7 +378,7 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri
} else if ((cchar >= 'A' && cchar <= 'Z') || (cchar >= 'a' && cchar <= 'z') || cchar == '_') {
- StringBuffer id;
+ StringBuffer<> id;
bool first = true;
while ((cchar >= 'A' && cchar <= 'Z') || (cchar >= 'a' && cchar <= 'z') || cchar == '_' || (!first && cchar >= '0' && cchar <= '9')) {