summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/core_builders.py1
-rw-r--r--core/extension/gdextension_interface.h6
-rw-r--r--core/io/file_access.cpp5
-rw-r--r--core/io/file_access_pack.cpp7
-rw-r--r--core/io/file_access_pack.h5
-rw-r--r--core/io/pck_packer.cpp4
-rw-r--r--core/math/convex_hull.cpp4
-rw-r--r--core/object/make_virtuals.py2
-rw-r--r--core/os/keyboard.cpp29
-rw-r--r--core/os/keyboard.h2
-rw-r--r--core/variant/dictionary.cpp11
-rw-r--r--core/variant/variant_internal.h2
12 files changed, 56 insertions, 22 deletions
diff --git a/core/core_builders.py b/core/core_builders.py
index b0a3b85d58..e40ebbb14d 100644
--- a/core/core_builders.py
+++ b/core/core_builders.py
@@ -239,7 +239,6 @@ def make_license_header(target, source, env):
data_list += part["Copyright"]
with open(dst, "w", encoding="utf-8") as f:
-
f.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
f.write("#ifndef LICENSE_GEN_H\n")
f.write("#define LICENSE_GEN_H\n")
diff --git a/core/extension/gdextension_interface.h b/core/extension/gdextension_interface.h
index 3aa41f28da..2a328c9a34 100644
--- a/core/extension/gdextension_interface.h
+++ b/core/extension/gdextension_interface.h
@@ -195,11 +195,11 @@ typedef struct {
int32_t expected;
} GDExtensionCallError;
-typedef void (*GDExtensionVariantFromTypeConstructorFunc)(GDExtensionVariantPtr, GDExtensionTypePtr);
-typedef void (*GDExtensionTypeFromVariantConstructorFunc)(GDExtensionTypePtr, GDExtensionVariantPtr);
+typedef void (*GDExtensionVariantFromTypeConstructorFunc)(GDExtensionUninitializedVariantPtr, GDExtensionTypePtr);
+typedef void (*GDExtensionTypeFromVariantConstructorFunc)(GDExtensionUninitializedTypePtr, GDExtensionVariantPtr);
typedef void (*GDExtensionPtrOperatorEvaluator)(GDExtensionConstTypePtr p_left, GDExtensionConstTypePtr p_right, GDExtensionTypePtr r_result);
typedef void (*GDExtensionPtrBuiltInMethod)(GDExtensionTypePtr p_base, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_return, int p_argument_count);
-typedef void (*GDExtensionPtrConstructor)(GDExtensionTypePtr p_base, const GDExtensionConstTypePtr *p_args);
+typedef void (*GDExtensionPtrConstructor)(GDExtensionUninitializedTypePtr p_base, const GDExtensionConstTypePtr *p_args);
typedef void (*GDExtensionPtrDestructor)(GDExtensionTypePtr p_base);
typedef void (*GDExtensionPtrSetter)(GDExtensionTypePtr p_base, GDExtensionConstTypePtr p_value);
typedef void (*GDExtensionPtrGetter)(GDExtensionConstTypePtr p_base, GDExtensionTypePtr r_value);
diff --git a/core/io/file_access.cpp b/core/io/file_access.cpp
index a6a1a224b3..b669afdc99 100644
--- a/core/io/file_access.cpp
+++ b/core/io/file_access.cpp
@@ -441,6 +441,11 @@ Vector<String> FileAccess::get_csv_line(const String &p_delim) const {
current += c;
}
}
+
+ if (in_quote) {
+ WARN_PRINT(vformat("Reached end of file before closing '\"' in CSV file '%s'.", get_path()));
+ }
+
strings.push_back(current);
return strings;
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index 88a906a38e..74c5c1c191 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -48,7 +48,8 @@ Error PackedData::add_pack(const String &p_path, bool p_replace_files, uint64_t
}
void PackedData::add_path(const String &p_pkg_path, const String &p_path, uint64_t p_ofs, uint64_t p_size, const uint8_t *p_md5, PackSource *p_src, bool p_replace_files, bool p_encrypted) {
- PathMD5 pmd5(p_path.md5_buffer());
+ String simplified_path = p_path.simplify_path();
+ PathMD5 pmd5(simplified_path.md5_buffer());
bool exists = files.has(pmd5);
@@ -68,7 +69,7 @@ void PackedData::add_path(const String &p_pkg_path, const String &p_path, uint64
if (!exists) {
//search for dir
- String p = p_path.replace_first("res://", "");
+ String p = simplified_path.replace_first("res://", "");
PackedDir *cd = root;
if (p.contains("/")) { //in a subdir
@@ -87,7 +88,7 @@ void PackedData::add_path(const String &p_pkg_path, const String &p_path, uint64
}
}
}
- String filename = p_path.get_file();
+ String filename = simplified_path.get_file();
// Don't add as a file if the path points to a directory
if (!filename.is_empty()) {
cd->files.insert(filename);
diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h
index 8bfabc9529..1538b302c2 100644
--- a/core/io/file_access_pack.h
+++ b/core/io/file_access_pack.h
@@ -184,7 +184,8 @@ public:
};
Ref<FileAccess> PackedData::try_open_path(const String &p_path) {
- PathMD5 pmd5(p_path.md5_buffer());
+ String simplified_path = p_path.simplify_path();
+ PathMD5 pmd5(simplified_path.md5_buffer());
HashMap<PathMD5, PackedFile, PathMD5>::Iterator E = files.find(pmd5);
if (!E) {
return nullptr; //not found
@@ -197,7 +198,7 @@ Ref<FileAccess> PackedData::try_open_path(const String &p_path) {
}
bool PackedData::has_path(const String &p_path) {
- return files.has(PathMD5(p_path.md5_buffer()));
+ return files.has(PathMD5(p_path.simplify_path().md5_buffer()));
}
bool PackedData::has_directory(const String &p_path) {
diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp
index e7f4980e94..9b49cc3d8c 100644
--- a/core/io/pck_packer.cpp
+++ b/core/io/pck_packer.cpp
@@ -115,7 +115,9 @@ Error PCKPacker::add_file(const String &p_file, const String &p_src, bool p_encr
}
File pf;
- pf.path = p_file;
+ // Simplify path here and on every 'files' access so that paths that have extra '/'
+ // symbols in them still match to the MD5 hash for the saved path.
+ pf.path = p_file.simplify_path();
pf.src_path = p_src;
pf.ofs = ofs;
pf.size = f->get_length();
diff --git a/core/math/convex_hull.cpp b/core/math/convex_hull.cpp
index 76b3062944..f8456ec998 100644
--- a/core/math/convex_hull.cpp
+++ b/core/math/convex_hull.cpp
@@ -658,7 +658,7 @@ private:
Vector3 get_gd_normal(Face *p_face);
- bool shift_face(Face *p_face, real_t p_amount, LocalVector<Vertex *> p_stack);
+ bool shift_face(Face *p_face, real_t p_amount, LocalVector<Vertex *> &p_stack);
public:
~ConvexHullInternal() {
@@ -1775,7 +1775,7 @@ real_t ConvexHullInternal::shrink(real_t p_amount, real_t p_clamp_amount) {
return p_amount;
}
-bool ConvexHullInternal::shift_face(Face *p_face, real_t p_amount, LocalVector<Vertex *> p_stack) {
+bool ConvexHullInternal::shift_face(Face *p_face, real_t p_amount, LocalVector<Vertex *> &p_stack) {
Vector3 orig_shift = get_gd_normal(p_face) * -p_amount;
if (scaling[0] != 0) {
orig_shift[0] /= scaling[0];
diff --git a/core/object/make_virtuals.py b/core/object/make_virtuals.py
index 18f27ae4a4..5be9650b32 100644
--- a/core/object/make_virtuals.py
+++ b/core/object/make_virtuals.py
@@ -154,7 +154,6 @@ def generate_version(argcount, const=False, returns=False):
def run(target, source, env):
-
max_versions = 12
txt = """
@@ -165,7 +164,6 @@ def run(target, source, env):
"""
for i in range(max_versions + 1):
-
txt += "/* " + str(i) + " Arguments */\n\n"
txt += generate_version(i, False, False)
txt += generate_version(i, False, True)
diff --git a/core/os/keyboard.cpp b/core/os/keyboard.cpp
index 1e32e6e096..1a51624030 100644
--- a/core/os/keyboard.cpp
+++ b/core/os/keyboard.cpp
@@ -400,17 +400,38 @@ String keycode_get_string(Key p_code) {
return codestr;
}
-Key find_keycode(const String &p_code) {
+Key find_keycode(const String &p_codestr) {
+ Key keycode = Key::NONE;
+ Vector<String> code_parts = p_codestr.split("+");
+ if (code_parts.size() < 1) {
+ return keycode;
+ }
+
+ String last_part = code_parts[code_parts.size() - 1];
const _KeyCodeText *kct = &_keycodes[0];
while (kct->text) {
- if (p_code.nocasecmp_to(kct->text) == 0) {
- return kct->code;
+ if (last_part.nocasecmp_to(kct->text) == 0) {
+ keycode = kct->code;
+ break;
}
kct++;
}
- return Key::NONE;
+ for (int part = 0; part < code_parts.size() - 1; part++) {
+ String code_part = code_parts[part];
+ if (code_part.nocasecmp_to(find_keycode_name(Key::SHIFT)) == 0) {
+ keycode |= KeyModifierMask::SHIFT;
+ } else if (code_part.nocasecmp_to(find_keycode_name(Key::CTRL)) == 0) {
+ keycode |= KeyModifierMask::CTRL;
+ } else if (code_part.nocasecmp_to(find_keycode_name(Key::META)) == 0) {
+ keycode |= KeyModifierMask::META;
+ } else if (code_part.nocasecmp_to(find_keycode_name(Key::ALT)) == 0) {
+ keycode |= KeyModifierMask::ALT;
+ }
+ }
+
+ return keycode;
}
const char *find_keycode_name(Key p_keycode) {
diff --git a/core/os/keyboard.h b/core/os/keyboard.h
index 84017e89a6..cf276dc49f 100644
--- a/core/os/keyboard.h
+++ b/core/os/keyboard.h
@@ -330,7 +330,7 @@ constexpr KeyModifierMask operator|(KeyModifierMask a, KeyModifierMask b) {
String keycode_get_string(Key p_code);
bool keycode_has_unicode(Key p_keycode);
-Key find_keycode(const String &p_code);
+Key find_keycode(const String &p_codestr);
const char *find_keycode_name(Key p_keycode);
int keycode_get_count();
int keycode_get_value_by_index(int p_index);
diff --git a/core/variant/dictionary.cpp b/core/variant/dictionary.cpp
index 0429508cc5..f019273735 100644
--- a/core/variant/dictionary.cpp
+++ b/core/variant/dictionary.cpp
@@ -83,9 +83,16 @@ Variant &Dictionary::operator[](const Variant &p_key) {
if (unlikely(_p->read_only)) {
if (p_key.get_type() == Variant::STRING_NAME) {
const StringName *sn = VariantInternal::get_string_name(&p_key);
- *_p->read_only = _p->variant_map[sn->operator String()];
- } else {
+ const String &key = sn->operator String();
+ if (likely(_p->variant_map.has(key))) {
+ *_p->read_only = _p->variant_map[key];
+ } else {
+ *_p->read_only = Variant();
+ }
+ } else if (likely(_p->variant_map.has(p_key))) {
*_p->read_only = _p->variant_map[p_key];
+ } else {
+ *_p->read_only = Variant();
}
return *_p->read_only;
diff --git a/core/variant/variant_internal.h b/core/variant/variant_internal.h
index c23066c0c6..782053b613 100644
--- a/core/variant/variant_internal.h
+++ b/core/variant/variant_internal.h
@@ -1541,7 +1541,7 @@ struct VariantTypeConstructor {
_FORCE_INLINE_ static void type_from_variant(void *r_value, void *p_variant) {
// r_value is provided by caller as uninitialized memory
- memnew_placement(r_value, T(VariantInternalAccessor<T>::get(reinterpret_cast<Variant *>(p_variant))));
+ memnew_placement(r_value, T(*reinterpret_cast<Variant *>(p_variant)));
}
};