summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/io/file_access_network.cpp2
-rw-r--r--core/io/resource_format_binary.cpp2
-rw-r--r--drivers/unix/os_unix.cpp2
-rw-r--r--editor/animation_editor.cpp2
-rw-r--r--editor/editor_resource_preview.cpp1
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp2
-rw-r--r--main/main.cpp16
-rw-r--r--modules/mono/csharp_script.cpp108
-rw-r--r--modules/mono/csharp_script.h15
-rw-r--r--modules/mono/editor/mono_bottom_panel.cpp8
-rw-r--r--modules/mono/glue/cs_files/SignalAttribute.cs12
-rw-r--r--modules/mono/mono_gd/gd_mono_class.cpp28
-rw-r--r--modules/mono/mono_gd/gd_mono_class.h6
-rw-r--r--modules/mono/mono_gd/gd_mono_method.cpp14
-rw-r--r--modules/mono/mono_gd/gd_mono_method.h3
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.cpp2
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.h1
-rw-r--r--platform/javascript/http_client.h.inc5
-rw-r--r--platform/javascript/http_client_javascript.cpp47
-rw-r--r--scene/2d/line_builder.cpp2
-rw-r--r--scene/2d/physics_body_2d.cpp2
-rw-r--r--scene/3d/physics_body.cpp2
-rw-r--r--scene/gui/tree.cpp4
-rw-r--r--scene/main/node.h2
-rw-r--r--servers/audio/audio_filter_sw.cpp3
-rw-r--r--servers/physics/shape_sw.cpp8
-rw-r--r--servers/physics_2d/shape_2d_sw.cpp2
27 files changed, 250 insertions, 51 deletions
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index ef886cdb3c..21e3a4172b 100644
--- a/core/io/file_access_network.cpp
+++ b/core/io/file_access_network.cpp
@@ -418,8 +418,6 @@ int FileAccessNetwork::get_buffer(uint8_t *p_dst, int p_length) const {
if (page != last_page) {
buffer_mutex->lock();
if (pages[page].buffer.empty()) {
- //fuck
-
waiting_on_page = page;
for (int j = 0; j < read_ahead; j++) {
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 15c4835dc6..5dfe067902 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -1124,7 +1124,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
da->remove(p_path + ".depren");
memdelete(da);
- //fuck it, use the old approach;
+ //use the old approach
WARN_PRINT(("This file is old, so it can't refactor dependencies, opening and resaving: " + p_path).utf8().get_data());
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 5f45f06c79..aa01f22673 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -296,7 +296,7 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bo
Vector<char *> args;
for (int i = 0; i < cs.size(); i++)
- args.push_back((char *)cs[i].get_data()); // shitty C cast
+ args.push_back((char *)cs[i].get_data());
args.push_back(0);
execvp(p_path.utf8().get_data(), &args[0]);
diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp
index cd8233e460..c064f9cbdf 100644
--- a/editor/animation_editor.cpp
+++ b/editor/animation_editor.cpp
@@ -3362,7 +3362,7 @@ int AnimationKeyEditor::_confirm_insert(InsertData p_id, int p_last_track) {
//wants a new tack
{
- //shitty hack
+ //hack
NodePath np;
animation->add_track(p_id.type);
animation->track_set_path(animation->get_track_count() - 1, p_id.path);
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index 93787a7a4c..aa67ea03d7 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -253,7 +253,6 @@ void EditorResourcePreview::_thread() {
img.instance();
if (img->load(cache_base + ".png") != OK) {
- //well fuck
cache_valid = false;
} else {
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 7a4eee0344..d8d0a6f013 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -398,8 +398,6 @@ void SpriteFramesEditor::_animation_add() {
animations->grab_focus();
}
void SpriteFramesEditor::_animation_remove() {
-
- //fuck everything
if (updating)
return;
diff --git a/main/main.cpp b/main/main.cpp
index e9eca4af39..f6b3bafc5a 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -514,12 +514,14 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
//video_mode.fullscreen=false;
init_fullscreen = true;
+#ifdef TOOLS_ENABLED
} else if (I->get() == "-e" || I->get() == "--editor") { // starts editor
editor = true;
} else if (I->get() == "-p" || I->get() == "--project-manager") { // starts project manager
project_manager = true;
+#endif
} else if (I->get() == "--no-window") { // disable window creation, Windows only
OS::get_singleton()->set_no_window_mode(true);
@@ -1226,24 +1228,27 @@ bool Main::start() {
//parameters that do not have an argument to the right
if (args[i] == "--no-docbase") {
doc_base = false;
+#ifdef TOOLS_ENABLED
} else if (args[i] == "-e" || args[i] == "--editor") {
editor = true;
} else if (args[i] == "-p" || args[i] == "--project-manager") {
project_manager = true;
+#endif
} else if (args[i].length() && args[i][0] != '-' && game_path == "") {
game_path = args[i];
}
//parameters that have an argument to the right
else if (i < (args.size() - 1)) {
bool parsed_pair = true;
- if (args[i] == "--doctool") {
- doc_tool = args[i + 1];
- for (int j = i + 2; j < args.size(); j++)
- removal_docs.push_back(args[j]);
- } else if (args[i] == "-s" || args[i] == "--script") {
+ if (args[i] == "-s" || args[i] == "--script") {
script = args[i + 1];
} else if (args[i] == "--test") {
test = args[i + 1];
+#ifdef TOOLS_ENABLED
+ } else if (args[i] == "--doctool") {
+ doc_tool = args[i + 1];
+ for (int j = i + 2; j < args.size(); j++)
+ removal_docs.push_back(args[j]);
} else if (args[i] == "--export") {
editor = true; //needs editor
if (i + 1 < args.size()) {
@@ -1261,6 +1266,7 @@ bool Main::start() {
return false;
}
export_debug = true;
+#endif
} else {
// The parameter does not match anything known, don't skip the next argument
parsed_pair = false;
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 0dc0018224..fb45136575 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -721,8 +721,10 @@ void CSharpLanguage::reload_assemblies_if_needed(bool p_soft_reload) {
for (Map<Ref<CSharpScript>, Map<ObjectID, List<Pair<StringName, Variant> > > >::Element *E = to_reload.front(); E; E = E->next()) {
Ref<CSharpScript> scr = E->key();
+ scr->signals_invalidated = true;
scr->exports_invalidated = true;
scr->reload(p_soft_reload);
+ scr->update_signals();
scr->update_exports();
//restore state if saved
@@ -755,8 +757,10 @@ void CSharpLanguage::reload_assemblies_if_needed(bool p_soft_reload) {
//if instance states were saved, set them!
}
- if (Engine::get_singleton()->is_editor_hint())
+ if (Engine::get_singleton()->is_editor_hint()) {
EditorNode::get_singleton()->get_property_editor()->update_tree();
+ NodeDock::singleton->update_lists();
+ }
}
#endif
@@ -1545,6 +1549,77 @@ bool CSharpScript::_update_exports() {
return false;
}
+bool CSharpScript::_update_signals() {
+#ifdef TOOLS_ENABLED
+ if (!valid)
+ return false;
+
+ bool changed = false;
+
+ if (signals_invalidated) {
+ signals_invalidated = false;
+
+ GDMonoClass *top = script_class;
+
+ _signals.clear();
+ changed = true; // TODO Do a real check for change
+
+ while (top && top != native) {
+ const Vector<GDMonoClass *> &delegates = top->get_all_delegates();
+ for (int i = delegates.size() - 1; i >= 0; --i) {
+ Vector<Argument> parameters;
+
+ GDMonoClass *delegate = delegates[i];
+
+ if (_get_signal(top, delegate, parameters)) {
+ _signals[delegate->get_name()] = parameters;
+ }
+ }
+
+ top = top->get_parent_class();
+ }
+ }
+
+ return changed;
+#endif
+ return false;
+}
+
+bool CSharpScript::_get_signal(GDMonoClass *p_class, GDMonoClass *p_delegate, Vector<Argument> &params) {
+ if (p_delegate->has_attribute(CACHED_CLASS(SignalAttribute))) {
+ MonoType *raw_type = GDMonoClass::get_raw_type(p_delegate);
+
+ if (mono_type_get_type(raw_type) == MONO_TYPE_CLASS) {
+ // Arguments are accessibles as arguments of .Invoke method
+ GDMonoMethod *invoke = p_delegate->get_method("Invoke", -1);
+
+ Vector<StringName> names;
+ Vector<ManagedType> types;
+ invoke->get_parameter_names(names);
+ invoke->get_parameter_types(types);
+
+ if (names.size() == types.size()) {
+ for (int i = 0; i < names.size(); ++i) {
+ Argument arg;
+ arg.name = names[i];
+ arg.type = GDMonoMarshal::managed_to_variant_type(types[i]);
+
+ if (arg.type == Variant::NIL) {
+ ERR_PRINTS("Unknown type of signal parameter: " + arg.name + " in " + p_class->get_full_name());
+ return false;
+ }
+
+ params.push_back(arg);
+ }
+
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
#ifdef TOOLS_ENABLED
bool CSharpScript::_get_member_export(GDMonoClass *p_class, GDMonoClassMember *p_member, PropertyInfo &r_prop_info, bool &r_exported) {
@@ -1866,12 +1941,15 @@ ScriptInstance *CSharpScript::instance_create(Object *p_this) {
PlaceHolderScriptInstance *si = memnew(PlaceHolderScriptInstance(CSharpLanguage::get_singleton(), Ref<Script>(this), p_this));
placeholders.insert(si);
_update_exports();
+ _update_signals();
return si;
#else
return NULL;
#endif
}
+ update_signals();
+
if (native) {
String native_name = native->get_name();
if (!ClassDB::is_parent_class(p_this->get_class_name(), native_name)) {
@@ -2035,6 +2113,33 @@ void CSharpScript::update_exports() {
#endif
}
+bool CSharpScript::has_script_signal(const StringName &p_signal) const {
+ if (_signals.has(p_signal))
+ return true;
+
+ return false;
+}
+
+void CSharpScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
+ for (const Map<StringName, Vector<Argument> >::Element *E = _signals.front(); E; E = E->next()) {
+ MethodInfo mi;
+
+ mi.name = E->key();
+ for (int i = 0; i < E->get().size(); i++) {
+ PropertyInfo arg;
+ arg.name = E->get()[i].name;
+ mi.arguments.push_back(arg);
+ }
+ r_signals->push_back(mi);
+ }
+}
+
+void CSharpScript::update_signals() {
+#ifdef TOOLS_ENABLED
+ _update_signals();
+#endif
+}
+
Ref<Script> CSharpScript::get_base_script() const {
// TODO search in metadata file once we have it, not important any way?
@@ -2099,6 +2204,7 @@ CSharpScript::CSharpScript() :
#ifdef TOOLS_ENABLED
source_changed_cache = false;
exports_invalidated = true;
+ signals_invalidated = true;
#endif
_resource_path_changed();
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index f18e339e18..ffb1d2e0f4 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -85,12 +85,19 @@ class CSharpScript : public Script {
SelfList<CSharpScript> script_list;
+ struct Argument {
+ String name;
+ Variant::Type type;
+ };
+
#ifdef TOOLS_ENABLED
List<PropertyInfo> exported_members_cache; // members_cache
Map<StringName, Variant> exported_members_defval_cache; // member_default_values_cache
Set<PlaceHolderScriptInstance *> placeholders;
bool source_changed_cache;
bool exports_invalidated;
+ Map<StringName, Vector<Argument> > _signals;
+ bool signals_invalidated;
void _update_exports_values(Map<StringName, Variant> &values, List<PropertyInfo> &propnames);
virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder);
@@ -104,6 +111,9 @@ class CSharpScript : public Script {
void _clear();
+ bool _update_signals();
+ bool _get_signal(GDMonoClass *p_class, GDMonoClass *p_delegate, Vector<Argument> &params);
+
bool _update_exports();
#ifdef TOOLS_ENABLED
bool _get_member_export(GDMonoClass *p_class, GDMonoClassMember *p_member, PropertyInfo &r_prop_info, bool &r_exported);
@@ -137,8 +147,9 @@ public:
virtual Error reload(bool p_keep_state = false);
- /* TODO */ virtual bool has_script_signal(const StringName &p_signal) const { return false; }
- /* TODO */ virtual void get_script_signal_list(List<MethodInfo> *r_signals) const {}
+ virtual bool has_script_signal(const StringName &p_signal) const;
+ virtual void get_script_signal_list(List<MethodInfo> *r_signals) const;
+ virtual void update_signals();
/* TODO */ virtual bool get_property_default_value(const StringName &p_property, Variant &r_value) const;
virtual void get_script_property_list(List<PropertyInfo> *p_list) const;
diff --git a/modules/mono/editor/mono_bottom_panel.cpp b/modules/mono/editor/mono_bottom_panel.cpp
index ab62c62616..20378a0162 100644
--- a/modules/mono/editor/mono_bottom_panel.cpp
+++ b/modules/mono/editor/mono_bottom_panel.cpp
@@ -335,16 +335,14 @@ void MonoBuildTab::_update_issues_list() {
Ref<Texture> MonoBuildTab::get_icon_texture() const {
- // FIXME these icons were removed... find something better
-
if (build_exited) {
if (build_result == RESULT_ERROR) {
- return get_icon("DependencyChangedHl", "EditorIcons");
+ return get_icon("StatusError", "EditorIcons");
} else {
- return get_icon("DependencyOkHl", "EditorIcons");
+ return get_icon("StatusSuccess", "EditorIcons");
}
} else {
- return get_icon("GraphTime", "EditorIcons");
+ return get_icon("Stop", "EditorIcons");
}
}
diff --git a/modules/mono/glue/cs_files/SignalAttribute.cs b/modules/mono/glue/cs_files/SignalAttribute.cs
new file mode 100644
index 0000000000..d8a6cabb83
--- /dev/null
+++ b/modules/mono/glue/cs_files/SignalAttribute.cs
@@ -0,0 +1,12 @@
+using System;
+
+namespace Godot
+{
+ [AttributeUsage(AttributeTargets.Delegate)]
+ public class SignalAttribute : Attribute
+ {
+ public SignalAttribute()
+ {
+ }
+ }
+}
diff --git a/modules/mono/mono_gd/gd_mono_class.cpp b/modules/mono/mono_gd/gd_mono_class.cpp
index b826352f02..66339d7ae6 100644
--- a/modules/mono/mono_gd/gd_mono_class.cpp
+++ b/modules/mono/mono_gd/gd_mono_class.cpp
@@ -404,6 +404,33 @@ const Vector<GDMonoProperty *> &GDMonoClass::get_all_properties() {
return properties_list;
}
+const Vector<GDMonoClass *> &GDMonoClass::get_all_delegates() {
+ if (delegates_fetched)
+ return delegates_list;
+
+ void *iter = NULL;
+ MonoClass *raw_class = NULL;
+ while ((raw_class = mono_class_get_nested_types(mono_class, &iter)) != NULL) {
+ if (mono_class_is_delegate(raw_class)) {
+ StringName name = mono_class_get_name(raw_class);
+
+ Map<StringName, GDMonoClass *>::Element *match = delegates.find(name);
+
+ if (match) {
+ delegates_list.push_back(match->get());
+ } else {
+ GDMonoClass *delegate = memnew(GDMonoClass(mono_class_get_namespace(raw_class), mono_class_get_name(raw_class), raw_class, assembly));
+ delegates.insert(name, delegate);
+ delegates_list.push_back(delegate);
+ }
+ }
+ }
+
+ delegates_fetched = true;
+
+ return delegates_list;
+}
+
GDMonoClass::GDMonoClass(const StringName &p_namespace, const StringName &p_name, MonoClass *p_class, GDMonoAssembly *p_assembly) {
namespace_name = p_namespace;
@@ -417,6 +444,7 @@ GDMonoClass::GDMonoClass(const StringName &p_namespace, const StringName &p_name
methods_fetched = false;
fields_fetched = false;
properties_fetched = false;
+ delegates_fetched = false;
}
GDMonoClass::~GDMonoClass() {
diff --git a/modules/mono/mono_gd/gd_mono_class.h b/modules/mono/mono_gd/gd_mono_class.h
index afccf2fc63..417c138594 100644
--- a/modules/mono/mono_gd/gd_mono_class.h
+++ b/modules/mono/mono_gd/gd_mono_class.h
@@ -90,6 +90,10 @@ class GDMonoClass {
Map<StringName, GDMonoProperty *> properties;
Vector<GDMonoProperty *> properties_list;
+ bool delegates_fetched;
+ Map<StringName, GDMonoClass *> delegates;
+ Vector<GDMonoClass *> delegates_list;
+
friend class GDMonoAssembly;
GDMonoClass(const StringName &p_namespace, const StringName &p_name, MonoClass *p_class, GDMonoAssembly *p_assembly);
@@ -133,6 +137,8 @@ public:
GDMonoProperty *get_property(const StringName &p_name);
const Vector<GDMonoProperty *> &get_all_properties();
+ const Vector<GDMonoClass *> &get_all_delegates();
+
~GDMonoClass();
};
diff --git a/modules/mono/mono_gd/gd_mono_method.cpp b/modules/mono/mono_gd/gd_mono_method.cpp
index 1f8e9a1926..df0985f6ac 100644
--- a/modules/mono/mono_gd/gd_mono_method.cpp
+++ b/modules/mono/mono_gd/gd_mono_method.cpp
@@ -229,6 +229,20 @@ String GDMonoMethod::get_signature_desc(bool p_namespaces) const {
return res;
}
+void GDMonoMethod::get_parameter_names(Vector<StringName> &names) const {
+ const char *_names[params_count];
+ mono_method_get_param_names(mono_method, _names);
+ for (int i = 0; i < params_count; ++i) {
+ names.push_back(StringName(_names[i]));
+ }
+}
+
+void GDMonoMethod::get_parameter_types(Vector<ManagedType> &types) const {
+ for (int i = 0; i < param_types.size(); ++i) {
+ types.push_back(param_types[i]);
+ }
+}
+
GDMonoMethod::GDMonoMethod(StringName p_name, MonoMethod *p_method) {
name = p_name;
diff --git a/modules/mono/mono_gd/gd_mono_method.h b/modules/mono/mono_gd/gd_mono_method.h
index 14df8dcfb4..a173af83f4 100644
--- a/modules/mono/mono_gd/gd_mono_method.h
+++ b/modules/mono/mono_gd/gd_mono_method.h
@@ -80,6 +80,9 @@ public:
String get_ret_type_full_name() const;
String get_signature_desc(bool p_namespaces = false) const;
+ void get_parameter_names(Vector<StringName> &names) const;
+ void get_parameter_types(Vector<ManagedType> &types) const;
+
GDMonoMethod(StringName p_name, MonoMethod *p_method);
~GDMonoMethod();
};
diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp
index a2f0819a72..42e307cf08 100644
--- a/modules/mono/mono_gd/gd_mono_utils.cpp
+++ b/modules/mono/mono_gd/gd_mono_utils.cpp
@@ -114,6 +114,7 @@ void MonoCache::clear_members() {
class_ExportAttribute = NULL;
field_ExportAttribute_hint = NULL;
field_ExportAttribute_hintString = NULL;
+ class_SignalAttribute = NULL;
class_ToolAttribute = NULL;
class_RemoteAttribute = NULL;
class_SyncAttribute = NULL;
@@ -201,6 +202,7 @@ void update_godot_api_cache() {
CACHE_CLASS_AND_CHECK(ExportAttribute, GODOT_API_CLASS(ExportAttribute));
CACHE_FIELD_AND_CHECK(ExportAttribute, hint, CACHED_CLASS(ExportAttribute)->get_field("hint"));
CACHE_FIELD_AND_CHECK(ExportAttribute, hintString, CACHED_CLASS(ExportAttribute)->get_field("hintString"));
+ CACHE_CLASS_AND_CHECK(SignalAttribute, GODOT_API_CLASS(SignalAttribute));
CACHE_CLASS_AND_CHECK(ToolAttribute, GODOT_API_CLASS(ToolAttribute));
CACHE_CLASS_AND_CHECK(RemoteAttribute, GODOT_API_CLASS(RemoteAttribute));
CACHE_CLASS_AND_CHECK(SyncAttribute, GODOT_API_CLASS(SyncAttribute));
diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h
index 259da46c31..1a34180d15 100644
--- a/modules/mono/mono_gd/gd_mono_utils.h
+++ b/modules/mono/mono_gd/gd_mono_utils.h
@@ -108,6 +108,7 @@ struct MonoCache {
GDMonoClass *class_ExportAttribute;
GDMonoField *field_ExportAttribute_hint;
GDMonoField *field_ExportAttribute_hintString;
+ GDMonoClass *class_SignalAttribute;
GDMonoClass *class_ToolAttribute;
GDMonoClass *class_RemoteAttribute;
GDMonoClass *class_SyncAttribute;
diff --git a/platform/javascript/http_client.h.inc b/platform/javascript/http_client.h.inc
index 23a74e68f5..d75d33a33a 100644
--- a/platform/javascript/http_client.h.inc
+++ b/platform/javascript/http_client.h.inc
@@ -46,3 +46,8 @@ String password;
int polled_response_code;
String polled_response_header;
PoolByteArray polled_response;
+
+#ifdef DEBUG_ENABLED
+bool has_polled;
+uint64_t last_polling_frame;
+#endif
diff --git a/platform/javascript/http_client_javascript.cpp b/platform/javascript/http_client_javascript.cpp
index 1cd2719723..118a77835e 100644
--- a/platform/javascript/http_client_javascript.cpp
+++ b/platform/javascript/http_client_javascript.cpp
@@ -81,6 +81,8 @@ Ref<StreamPeer> HTTPClient::get_connection() const {
Error HTTPClient::prepare_request(Method p_method, const String &p_url, const Vector<String> &p_headers) {
ERR_FAIL_INDEX_V(p_method, METHOD_MAX, ERR_INVALID_PARAMETER);
+ ERR_EXPLAIN("HTTP methods TRACE and CONNECT are not supported for the HTML5 platform");
+ ERR_FAIL_COND_V(p_method == METHOD_TRACE || p_method == METHOD_CONNECT, ERR_UNAVAILABLE);
ERR_FAIL_COND_V(status != STATUS_CONNECTED, ERR_INVALID_PARAMETER);
ERR_FAIL_COND_V(host.empty(), ERR_UNCONFIGURED);
ERR_FAIL_COND_V(port < 0, ERR_UNCONFIGURED);
@@ -158,7 +160,7 @@ int HTTPClient::get_response_code() const {
Error HTTPClient::get_response_headers(List<String> *r_response) {
- if (!polled_response_header.size())
+ if (polled_response_header.empty())
return ERR_INVALID_PARAMETER;
Vector<String> header_lines = polled_response_header.split("\r\n", false);
@@ -191,8 +193,6 @@ PoolByteArray HTTPClient::read_response_body_chunk() {
if (response_read_offset == polled_response.size()) {
status = STATUS_CONNECTED;
polled_response.resize(0);
- polled_response_code = 0;
- polled_response_header = String();
godot_xhr_reset(xhr_id);
}
@@ -238,34 +238,47 @@ Error HTTPClient::poll() {
return ERR_CONNECTION_ERROR;
case STATUS_REQUESTING:
- polled_response_code = godot_xhr_get_status(xhr_id);
- int response_length = godot_xhr_get_response_length(xhr_id);
- if (response_length == 0) {
- godot_xhr_ready_state_t ready_state = godot_xhr_get_ready_state(xhr_id);
- if (ready_state == XHR_READY_STATE_HEADERS_RECEIVED || ready_state == XHR_READY_STATE_LOADING) {
- return OK;
- } else {
- status = STATUS_CONNECTION_ERROR;
- return ERR_CONNECTION_ERROR;
+
+#ifdef DEBUG_ENABLED
+ if (!has_polled) {
+ has_polled = true;
+ } else {
+ // forcing synchronous requests is not possible on the web
+ if (last_polling_frame == Engine::get_singleton()->get_idle_frames()) {
+ WARN_PRINT("HTTPClient polled multiple times in one frame, "
+ "but request cannot progress more than once per "
+ "frame on the HTML5 platform.");
}
}
+ last_polling_frame = Engine::get_singleton()->get_idle_frames();
+#endif
+
+ polled_response_code = godot_xhr_get_status(xhr_id);
+ if (godot_xhr_get_ready_state(xhr_id) != XHR_READY_STATE_DONE) {
+ return OK;
+ } else if (!polled_response_code) {
+ status = STATUS_CONNECTION_ERROR;
+ return ERR_CONNECTION_ERROR;
+ }
status = STATUS_BODY;
PoolByteArray bytes;
int len = godot_xhr_get_response_headers_length(xhr_id);
- bytes.resize(len);
+ bytes.resize(len + 1);
+
PoolByteArray::Write write = bytes.write();
godot_xhr_get_response_headers(xhr_id, reinterpret_cast<char *>(write.ptr()), len);
+ write[len] = 0;
write = PoolByteArray::Write();
PoolByteArray::Read read = bytes.read();
polled_response_header = String::utf8(reinterpret_cast<const char *>(read.ptr()));
read = PoolByteArray::Read();
- polled_response.resize(response_length);
+ polled_response.resize(godot_xhr_get_response_length(xhr_id));
write = polled_response.write();
- godot_xhr_get_response(xhr_id, write.ptr(), response_length);
+ godot_xhr_get_response(xhr_id, write.ptr(), polled_response.size());
write = PoolByteArray::Write();
break;
}
@@ -280,6 +293,10 @@ HTTPClient::HTTPClient() {
port = -1;
use_tls = false;
polled_response_code = 0;
+#ifdef DEBUG_ENABLED
+ has_polled = false;
+ last_polling_frame = 0;
+#endif
}
HTTPClient::~HTTPClient() {
diff --git a/scene/2d/line_builder.cpp b/scene/2d/line_builder.cpp
index e78d2e9c34..b1a072729f 100644
--- a/scene/2d/line_builder.cpp
+++ b/scene/2d/line_builder.cpp
@@ -347,7 +347,7 @@ void LineBuilder::build() {
}
if (intersection_result != SEGMENT_INTERSECT)
- // In this case the joint is too fucked up to be re-used,
+ // In this case the joint is too corrputed to be re-used,
// start again the strip with fallback points
strip_begin(pos_up0, pos_down0, color1, uvx1);
}
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index cc99ce5f49..9908907ee9 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -372,9 +372,7 @@ bool RigidBody2D::_test_motion(const Vector2 &p_motion, float p_margin, const Re
void RigidBody2D::_direct_state_changed(Object *p_state) {
-//eh.. fuck
#ifdef DEBUG_ENABLED
-
state = Object::cast_to<Physics2DDirectBodyState>(p_state);
#else
state = (Physics2DDirectBodyState *)p_state; //trust it
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index 25acd6deb0..5c814312dd 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -370,9 +370,7 @@ struct _RigidBodyInOut {
void RigidBody::_direct_state_changed(Object *p_state) {
-//eh.. fuck
#ifdef DEBUG_ENABLED
-
state = Object::cast_to<PhysicsDirectBodyState>(p_state);
#else
state = (PhysicsDirectBodyState *)p_state; //trust it
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index e12044fca2..cdbdc9b0d7 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -2384,7 +2384,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (mm.is_valid()) {
- if (cache.font.is_null()) // avoid a strange case that may fuckup stuff
+ if (cache.font.is_null()) // avoid a strange case that may corrupt stuff
update_cache();
Ref<StyleBox> bg = cache.bg;
@@ -2483,7 +2483,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
Ref<InputEventMouseButton> b = p_event;
if (b.is_valid()) {
- if (cache.font.is_null()) // avoid a strange case that may fuckup stuff
+ if (cache.font.is_null()) // avoid a strange case that may corrupt stuff
update_cache();
if (!b->is_pressed()) {
diff --git a/scene/main/node.h b/scene/main/node.h
index dc6bda4621..4655071228 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -364,7 +364,7 @@ public:
void queue_delete();
- //shitty hacks for speed
+ //hacks for speed
static void set_human_readable_collision_renaming(bool p_enabled);
static void init_node_hrcr();
diff --git a/servers/audio/audio_filter_sw.cpp b/servers/audio/audio_filter_sw.cpp
index 70cb7beacb..551ca01109 100644
--- a/servers/audio/audio_filter_sw.cpp
+++ b/servers/audio/audio_filter_sw.cpp
@@ -58,8 +58,7 @@ void AudioFilterSW::prepare_coefficients(Coeffs *p_coeffs) {
int sr_limit = (sampling_rate / 2) + 512;
double final_cutoff = (cutoff > sr_limit) ? sr_limit : cutoff;
- if (final_cutoff < 1) //avoid crapness
- final_cutoff = 1; //don't allow less than this
+ if (final_cutoff < 1) final_cutoff = 1; //don't allow less than this
double omega = 2.0 * Math_PI * final_cutoff / sampling_rate;
diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp
index 5a58742958..b918a42ca5 100644
--- a/servers/physics/shape_sw.cpp
+++ b/servers/physics/shape_sw.cpp
@@ -672,7 +672,7 @@ Vector3 CapsuleShapeSW::get_closest_point_to(const Vector3 &p_point) const {
Vector3 CapsuleShapeSW::get_moment_of_inertia(real_t p_mass) const {
- // use crappy AABB approximation
+ // use bad AABB approximation
Vector3 extents = get_aabb().size * 0.5;
return Vector3(
@@ -943,7 +943,7 @@ Vector3 ConvexPolygonShapeSW::get_closest_point_to(const Vector3 &p_point) const
Vector3 ConvexPolygonShapeSW::get_moment_of_inertia(real_t p_mass) const {
- // use crappy AABB approximation
+ // use bad AABB approximation
Vector3 extents = get_aabb().size * 0.5;
return Vector3(
@@ -1331,7 +1331,7 @@ void ConcavePolygonShapeSW::cull(const AABB &p_local_aabb, Callback p_callback,
Vector3 ConcavePolygonShapeSW::get_moment_of_inertia(real_t p_mass) const {
- // use crappy AABB approximation
+ // use bad AABB approximation
Vector3 extents = get_aabb().size * 0.5;
return Vector3(
@@ -1594,7 +1594,7 @@ void HeightMapShapeSW::cull(const AABB &p_local_aabb, Callback p_callback, void
Vector3 HeightMapShapeSW::get_moment_of_inertia(real_t p_mass) const {
- // use crappy AABB approximation
+ // use bad AABB approximation
Vector3 extents = get_aabb().size * 0.5;
return Vector3(
diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp
index 4605516fe0..5893f19827 100644
--- a/servers/physics_2d/shape_2d_sw.cpp
+++ b/servers/physics_2d/shape_2d_sw.cpp
@@ -589,7 +589,7 @@ bool ConvexPolygonShape2DSW::intersect_segment(const Vector2 &p_begin, const Vec
for (int i = 0; i < point_count; i++) {
- //hmm crap.. no can do..
+ //hmm.. no can do..
/*
if (d.dot(points[i].normal)>=0)
continue;