You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
GDScript: Remove some unnecessary booleans
Co-authored-by: HolonProduction <holonproduction@gmail.com>
This commit is contained in:
@@ -148,11 +148,10 @@ void GDScript::_super_implicit_constructor(GDScript *p_script, GDScriptInstance
|
||||
}
|
||||
}
|
||||
|
||||
GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_is_ref_counted, Callable::CallError &r_error) {
|
||||
GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, Callable::CallError &r_error) {
|
||||
/* STEP 1, CREATE */
|
||||
|
||||
GDScriptInstance *instance = memnew(GDScriptInstance);
|
||||
instance->base_ref_counted = p_is_ref_counted;
|
||||
instance->members.resize(member_indices.size());
|
||||
instance->script = Ref<GDScript>(this);
|
||||
instance->owner = p_owner;
|
||||
@@ -235,7 +234,7 @@ Variant GDScript::_new(const Variant **p_args, int p_argcount, Callable::CallErr
|
||||
ref = Ref<RefCounted>(r);
|
||||
}
|
||||
|
||||
GDScriptInstance *instance = _create_instance(p_args, p_argcount, owner, r != nullptr, r_error);
|
||||
GDScriptInstance *instance = _create_instance(p_args, p_argcount, owner, r_error);
|
||||
if (!instance) {
|
||||
if (ref.is_null()) {
|
||||
memdelete(owner); //no owner, sorry
|
||||
@@ -422,7 +421,7 @@ ScriptInstance *GDScript::instance_create(Object *p_this) {
|
||||
}
|
||||
|
||||
Callable::CallError unchecked_error;
|
||||
return _create_instance(nullptr, 0, p_this, Object::cast_to<RefCounted>(p_this) != nullptr, unchecked_error);
|
||||
return _create_instance(nullptr, 0, p_this, unchecked_error);
|
||||
}
|
||||
|
||||
PlaceHolderScriptInstance *GDScript::placeholder_instance_create(Object *p_this) {
|
||||
@@ -694,7 +693,7 @@ void GDScript::_static_default_init() {
|
||||
for (const KeyValue<StringName, MemberInfo> &E : static_variables_indices) {
|
||||
const GDScriptDataType &type = E.value.data_type;
|
||||
// Only initialize builtin types, which are not expected to be `null`.
|
||||
if (!type.has_type || type.kind != GDScriptDataType::BUILTIN) {
|
||||
if (type.kind != GDScriptDataType::BUILTIN) {
|
||||
continue;
|
||||
}
|
||||
if (type.builtin_type == Variant::ARRAY && type.has_container_element_type(0)) {
|
||||
@@ -1025,7 +1024,7 @@ bool GDScript::_set(const StringName &p_name, const Variant &p_value) {
|
||||
if (E) {
|
||||
const MemberInfo *member = &E->value;
|
||||
Variant value = p_value;
|
||||
if (member->data_type.has_type && !member->data_type.is_type(value)) {
|
||||
if (!member->data_type.is_type(value)) {
|
||||
const Variant *args = &p_value;
|
||||
Callable::CallError err;
|
||||
Variant::construct(member->data_type.builtin_type, value, &args, 1, err);
|
||||
@@ -1685,7 +1684,7 @@ bool GDScriptInstance::set(const StringName &p_name, const Variant &p_value) {
|
||||
if (E) {
|
||||
const GDScript::MemberInfo *member = &E->value;
|
||||
Variant value = p_value;
|
||||
if (member->data_type.has_type && !member->data_type.is_type(value)) {
|
||||
if (!member->data_type.is_type(value)) {
|
||||
const Variant *args = &p_value;
|
||||
Callable::CallError err;
|
||||
Variant::construct(member->data_type.builtin_type, value, &args, 1, err);
|
||||
@@ -1712,7 +1711,7 @@ bool GDScriptInstance::set(const StringName &p_name, const Variant &p_value) {
|
||||
if (E) {
|
||||
const GDScript::MemberInfo *member = &E->value;
|
||||
Variant value = p_value;
|
||||
if (member->data_type.has_type && !member->data_type.is_type(value)) {
|
||||
if (!member->data_type.is_type(value)) {
|
||||
const Variant *args = &p_value;
|
||||
Callable::CallError err;
|
||||
Variant::construct(member->data_type.builtin_type, value, &args, 1, err);
|
||||
@@ -2170,11 +2169,6 @@ void GDScriptInstance::reload_members() {
|
||||
#endif
|
||||
}
|
||||
|
||||
GDScriptInstance::GDScriptInstance() {
|
||||
owner = nullptr;
|
||||
base_ref_counted = false;
|
||||
}
|
||||
|
||||
GDScriptInstance::~GDScriptInstance() {
|
||||
MutexLock lock(GDScriptLanguage::get_singleton()->mutex);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user