summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/ustring.cpp8
-rw-r--r--editor/editor_node.cpp3
-rw-r--r--editor/project_manager.cpp1
-rw-r--r--modules/bullet/godot_ray_world_algorithm.cpp4
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp7
5 files changed, 16 insertions, 7 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index c1888c87a7..838907419e 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -2945,12 +2945,12 @@ String String::left(int p_pos) const {
String String::right(int p_pos) const {
- if (p_pos >= size())
- return *this;
-
- if (p_pos < 0)
+ if (p_pos >= length())
return "";
+ if (p_pos <= 0)
+ return *this;
+
return substr(p_pos, (length() - p_pos));
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 973b2cc7a2..745be39df7 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -4419,7 +4419,7 @@ void EditorNode::remove_tool_menu_item(const String &p_name) {
void EditorNode::_dropped_files(const Vector<String> &p_files, int p_screen) {
- String to_path = ProjectSettings::get_singleton()->globalize_path(get_filesystem_dock()->get_current_path());
+ String to_path = ProjectSettings::get_singleton()->globalize_path(get_filesystem_dock()->get_selected_path());
DirAccessRef dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
Vector<String> just_copy = String("ttf,otf").split(",");
@@ -5004,6 +5004,7 @@ EditorNode::EditorNode() {
main_vbox = memnew(VBoxContainer);
gui_base->add_child(main_vbox);
main_vbox->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 8);
+ main_vbox->add_constant_override("separation", 8 * EDSCALE);
menu_hb = memnew(HBoxContainer);
main_vbox->add_child(menu_hb);
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index bda5add381..0a24f325fd 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -1901,6 +1901,7 @@ ProjectManager::ProjectManager() {
VBoxContainer *vb = memnew(VBoxContainer);
panel->add_child(vb);
vb->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 8 * EDSCALE);
+ vb->add_constant_override("separation", 8 * EDSCALE);
String cp;
cp += 0xA9;
diff --git a/modules/bullet/godot_ray_world_algorithm.cpp b/modules/bullet/godot_ray_world_algorithm.cpp
index cadc8dd59e..3e06239453 100644
--- a/modules/bullet/godot_ray_world_algorithm.cpp
+++ b/modules/bullet/godot_ray_world_algorithm.cpp
@@ -100,8 +100,8 @@ void GodotRayWorldAlgorithm::processCollision(const btCollisionObjectWrapper *bo
btScalar depth(ray_shape->getScaledLength() * (btResult.m_closestHitFraction - 1));
- if (depth >= -ray_shape->getMargin())
- depth *= 0.5;
+ if (depth >= -ray_shape->getMargin() * 0.5)
+ depth = 0;
if (ray_shape->getSlipsOnSlope())
resultOut->addContactPoint(btResult.m_hitNormalWorld, btResult.m_hitPointWorld, depth);
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index e53846e269..871c33bb35 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -231,6 +231,13 @@ void NetworkedMultiplayerENet::poll() {
break;
}
+ // A client joined with an invalid ID (neagtive values, 0, and 1 are reserved).
+ // Probably trying to exploit us.
+ if (server && ((int)event.data < 2 || peer_map.has((int)event.data))) {
+ enet_peer_reset(event.peer);
+ ERR_CONTINUE(true);
+ }
+
int *new_id = memnew(int);
*new_id = event.data;