Skip to content

Commit

Permalink
GH-43 Fix compilation warnings (Linux/Windows)
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Dec 30, 2023
1 parent d21fec1 commit 14489ec
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 23 deletions.
6 changes: 3 additions & 3 deletions src/script/context/execution_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
OScriptNodeExecutionContext::OScriptNodeExecutionContext(const Ref<OScriptExecutionStack>& p_stack, int p_node_id, int p_passes,
int p_flow_stack_position, GDExtensionCallError* p_error)
: _execution_stack(p_stack)
, _current_node_id(p_node_id)
, _initial_node_id(p_node_id)
, _flow_stack_position(p_flow_stack_position)
, _current_node_id(p_node_id)
, _passes(p_passes)
, _error(p_error)
, _step_mode(OScriptNodeInstance::StepMode::STEP_MODE_BEGIN)
, _error(p_error)
, _flow_stack_position(p_flow_stack_position)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/script/instances/script_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ const GDExtensionScriptInstanceInfo2 OScriptInstance::INSTANCE_INFO = init_scrip

OScriptInstance::OScriptInstance(const Ref<OScript>& p_script, OScriptLanguage* p_language, Object* p_owner)
: _script(p_script)
, _language(p_language)
, _owner(p_owner)
, _language(p_language)
{
// Initialize variables
_initialize_variables(p_script);
Expand Down
6 changes: 3 additions & 3 deletions src/script/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
#include <godot_cpp/core/class_db.hpp>

OScriptNode::OScriptNode()
: _script(nullptr)
, _flags(ScriptNodeFlags::CATALOGABLE)
: _initialized(false)
, _id(-1)
, _initialized(false)
, _flags(ScriptNodeFlags::CATALOGABLE)
, _script(nullptr)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/script/nodes/data/coercion_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class OScriptNodeCoercionInstance : public OScriptNodeInstance

OScriptNodeCoercion::OScriptNodeCoercion()
{
set_flags(ScriptNodeFlags::NONE);
_flags = ScriptNodeFlags::NONE;
}

void OScriptNodeCoercion::post_initialize()
Expand Down
15 changes: 10 additions & 5 deletions src/script/nodes/data/compose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,28 +444,33 @@ bool OScriptNodeComposeFrom::is_supported(Variant::Type p_type, const Vector<Pro
// Single argument constructors with same types, ignore them.
if (p_args.size() == 1 && p_args[0].type == p_type)
return false;
break;
case Variant::TRANSFORM3D:
// Single argument constructors with same types, ignore them.
if (p_args.size() == 1 && p_args[0].type == p_type || p_args[0].type == Variant::PROJECTION)
if (p_args.size() == 1 && (p_args[0].type == p_type || p_args[0].type == Variant::PROJECTION))
return false;
if (p_args.size() ==2 && p_args[0].type == Variant::BASIS && p_args[1].type == Variant::VECTOR3)
if (p_args.size() == 2 && p_args[0].type == Variant::BASIS && p_args[1].type == Variant::VECTOR3)
return false;
break;
case Variant::RECT2:
// Single argument constructors with same types, ignore them.
if (p_args.size() == 1 && p_args[0].type == p_type || p_args[0].type == Variant::RECT2I)
if (p_args.size() == 1 && (p_args[0].type == p_type || p_args[0].type == Variant::RECT2I))
return false;
break;
case Variant::RECT2I:
// Single argument constructors with same types, ignore them.
if (p_args.size() == 1 && p_args[0].type == p_type || p_args[0].type == Variant::RECT2)
if (p_args.size() == 1 && (p_args[0].type == p_type || p_args[0].type == Variant::RECT2))
return false;
break;
case Variant::PROJECTION:
// Single argument constructors with same types, ignore them.
if (p_args.size() == 1 && p_args[0].type == p_type || p_args[0].type == Variant::TRANSFORM3D)
if (p_args.size() == 1 && (p_args[0].type == p_type || p_args[0].type == Variant::TRANSFORM3D))
return false;
break;
case Variant::QUATERNION:
if (p_args.size() == 1 && p_args[0].type == Variant::BASIS)
return false;
break;
default:
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/script/nodes/functions/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ StringName OScriptNodeEvent::resolve_type_class(const Ref<OScriptNodePin>& p_pin
if (_function.is_valid())
{
const int32_t pin_index = p_pin->get_pin_index() - 1;
if (pin_index >= 0 && pin_index < _function->get_argument_count())
if (pin_index >= 0 && pin_index < int(_function->get_argument_count()))
{
// Return the specialized "InputEventKey" in this use case.
if (_function->get_method_info().name.match("_unhandled_key_input"))
Expand Down
12 changes: 8 additions & 4 deletions src/script/nodes/functions/function_terminator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,21 @@

void OScriptNodeFunctionTerminator::_get_property_list(List<PropertyInfo>* r_list) const
{
Ref<OScriptFunction> function = get_function();

// Setup flags
int32_t read_only_serialize = PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_READ_ONLY;
int32_t read_only_editor = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_READ_ONLY;

int32_t usage = read_only_editor;
if (function.is_valid() && function->is_user_defined())
usage = PROPERTY_USAGE_EDITOR;

r_list->push_back(PropertyInfo(Variant::STRING, "function_id", PROPERTY_HINT_NONE, "", read_only_serialize));
r_list->push_back(PropertyInfo(Variant::STRING, "function_name", PROPERTY_HINT_NONE, "", read_only_editor));

Ref<OScriptFunction> function = get_function();
if (function.is_valid())
{
int32_t usage = function->is_user_defined() ? PROPERTY_USAGE_EDITOR : read_only_editor;

if (_supports_return_values())
{
r_list->push_back(PropertyInfo(Variant::BOOL, "has_return_value", PROPERTY_HINT_NONE, "", usage));
Expand All @@ -45,7 +49,7 @@ void OScriptNodeFunctionTerminator::_get_property_list(List<PropertyInfo>* r_lis

static String types = VariantUtils::to_enum_list();
const MethodInfo& mi = function->get_method_info();
for (int i = 1; i <= mi.arguments.size(); i++)
for (size_t i = 1; i <= mi.arguments.size(); i++)
{
r_list->push_back(PropertyInfo(Variant::INT, "argument_" + itos(i) + "/type", PROPERTY_HINT_ENUM, types, usage));
r_list->push_back(PropertyInfo(Variant::STRING, "argument_" + itos(i) + "/name", PROPERTY_HINT_NONE, "", usage));
Expand Down
4 changes: 2 additions & 2 deletions src/script/nodes/signals/emit_signal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class OScriptNodeEmitSignalInstance : public OScriptNodeInstance
}

std::vector<Variant> args;
for (int i = 0; i < _signal.arguments.size(); i++)
for (size_t i = 0; i < _signal.arguments.size(); i++)
args.push_back(p_context.get_input(i));

dispatch(_signal.name, args);
Expand Down Expand Up @@ -109,7 +109,7 @@ void OScriptNodeEmitSignal::_get_property_list(List<PropertyInfo>* r_list) const

static String types = VariantUtils::to_enum_list();
const MethodInfo& mi = _signal->get_method_info();
for (int i = 1; i <= mi.arguments.size(); i++)
for (size_t i = 1; i <= mi.arguments.size(); i++)
{
r_list->push_back(PropertyInfo(Variant::INT, "argument_" + itos(i) + "/type", PROPERTY_HINT_ENUM, types, usage));
r_list->push_back(PropertyInfo(Variant::STRING, "argument_" + itos(i) + "/name", PROPERTY_HINT_NONE, "", usage));
Expand Down
4 changes: 2 additions & 2 deletions src/script/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
#include <godot_cpp/variant/utility_functions.hpp>

OScript::OScript()
: _language(OScriptLanguage::get_singleton())
: _valid(true)
, _base_type("Object")
, _valid(true)
, _language(OScriptLanguage::get_singleton())
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/script/signals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void OScriptSignal::_get_property_list(List<PropertyInfo>* r_list) const
int32_t read_only = PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_READ_ONLY;
r_list->push_back(PropertyInfo(Variant::STRING, "signal_name", PROPERTY_HINT_NONE, "", read_only));
r_list->push_back(PropertyInfo(Variant::INT, "argument_count", PROPERTY_HINT_RANGE, "0,32", PROPERTY_USAGE_EDITOR));
for (int i = 1; i <= _method.arguments.size(); i++)
for (size_t i = 1; i <= _method.arguments.size(); i++)
{
r_list->push_back(PropertyInfo(Variant::INT, "argument_" + itos(i) + "/type", PROPERTY_HINT_ENUM, types,
PROPERTY_USAGE_EDITOR));
Expand Down

0 comments on commit 14489ec

Please sign in to comment.