Skip to content

Commit

Permalink
修正字符串类型的转换
Browse files Browse the repository at this point in the history
  • Loading branch information
Daylily-Zeleen committed Apr 17, 2024
1 parent 96805c0 commit 285c79e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "v0.1.3"
version = "v0.1.4-dev"

print("BUILD_VERSION=" + version)
2 changes: 1 addition & 1 deletion demo/addons/gd-eos/gdeos.gdextension
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[infomation]
name = "GD-EOS"
version = "v0.1.3-dev"
version = "v0.0.0"
decription = "A Epic Online Services plugin for Godot"
author = "忘忧の (Daylily Zeleen)"
email = "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion gd_eos/eos_code_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2004,7 +2004,7 @@ def __expend_input_struct(
elif _is_str_type(field_type, field):
r_declare_args.append(f"const String &p_{snake_field}")
r_prepare_lines.append(f"\tCharString utf8_{snake_field} = p_{snake_field}.utf8();")
r_prepare_lines.append(f"\t{options_field} = to_eos_type<const char *, decltype({options_field})>(utf8_{snake_field});")
r_prepare_lines.append(f"\t{options_field} = to_eos_type<const CharString &, decltype({options_field})>(utf8_{snake_field});")
elif _is_str_arr_type(field_type, field):
r_declare_args.append(f"const PackedStringArray &p_{snake_field}")
option_count_field = f"{arg_name}.{_find_count_field(field, fields.keys())}"
Expand Down
5 changes: 4 additions & 1 deletion gd_eos/include/core/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,10 @@ template <>
CharString to_godot_type(const cstr_t p_from) { return { p_from }; }
template <>
cstr_t to_eos_type<const CharString &, cstr_t>(const CharString &p_from) {
return p_from.size() == 1 ? nullptr : (char *)p_from.ptr();
if (p_from.size() == 0 || p_from.get(0) == 0) {
return nullptr;
}
return (char *)p_from.ptr();
}
template <>
cstr_t to_eos_type<CharString, cstr_t>(CharString p_from) {
Expand Down

0 comments on commit 285c79e

Please sign in to comment.