From 7b1eadb4653dcc1e608d7ff14375d2761004be44 Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 18 Mar 2022 10:56:48 +0100 Subject: [PATCH] Removed the CALL macros. --- modules/terraman/defines.h | 27 ------------------- modules/terraman/library/terrain_library.cpp | 22 +++++++-------- modules/terraman/meshers/terrain_mesher.cpp | 8 +++--- .../world/terrain_environment_data.cpp | 2 +- modules/terraman/world/terrain_structure.cpp | 2 +- modules/terraman/world/terrain_world.cpp | 14 +++++----- modules/terraman_2d/defines.h | 27 ------------------- .../library/terrain_2d_library.cpp | 22 +++++++-------- .../terraman_2d/meshers/terrain_2d_mesher.cpp | 8 +++--- .../world/terrain_2d_environment_data.cpp | 2 +- .../world/terrain_2d_structure.cpp | 2 +- .../terraman_2d/world/terrain_2d_world.cpp | 14 +++++----- 12 files changed, 48 insertions(+), 102 deletions(-) diff --git a/modules/terraman/defines.h b/modules/terraman/defines.h index 5e7f62cdb..ca4033018 100644 --- a/modules/terraman/defines.h +++ b/modules/terraman/defines.h @@ -16,31 +16,4 @@ arr_into.push_back(e); \ } -#define CALL(func, ...) \ - call(#func, ##__VA_ARGS__); - -#define RETURN_CALL(ret_type, func) \ - return call(#func); - -#define RETURN_CALLP(ret_type, func, ...) \ - return call(#func, ##__VA_ARGS__); - -#define GET_CALL(ret_type, ret_var, func) \ - ret_var = call(#func); - -#define GET_CALLP(ret_type, ret_var, func, ...) \ - ret_var = call(#func, ##__VA_ARGS__); - -#define RETURN_CALLD(ret_type, def_val, func) \ - return call(#func); - -#define RETURN_CALLPD(ret_type, def_val, func, ...) \ - return call(#func, ##__VA_ARGS__); - -#define GET_CALLD(ret_type, def_val, ret_var, func) \ - ret_var = call(#func); - -#define GET_CALLPD(ret_type, def_val, ret_var, func, ...) \ - return call(#func, ##__VA_ARGS__); - #endif diff --git a/modules/terraman/library/terrain_library.cpp b/modules/terraman/library/terrain_library.cpp index 6309db49e..d0f100f26 100644 --- a/modules/terraman/library/terrain_library.cpp +++ b/modules/terraman/library/terrain_library.cpp @@ -40,7 +40,7 @@ void TerrainLibrary::set_initialized(const bool value) { } bool TerrainLibrary::supports_caching() { - RETURN_CALLD(bool, false, _supports_caching); + return call("_supports_caching"); } bool TerrainLibrary::_supports_caching() { return false; @@ -68,14 +68,14 @@ Ref TerrainLibrary::material_lod_get(const int index) { } void TerrainLibrary::material_cache_get_key(Ref chunk) { - CALL(_material_cache_get_key, chunk); + call("_material_cache_get_key", chunk); } void TerrainLibrary::_material_cache_get_key(Ref chunk) { } Ref TerrainLibrary::material_cache_get(const int key) { - RETURN_CALLP(Ref, _material_cache_get, key); + return call("_material_cache_get", key); } Ref TerrainLibrary::_material_cache_get(const int key) { @@ -83,7 +83,7 @@ Ref TerrainLibrary::_material_cache_get(const int key) { } void TerrainLibrary::material_cache_unref(const int key) { - CALL(_material_cache_unref, key); + call("_material_cache_unref", key); } void TerrainLibrary::_material_cache_unref(const int key) { } @@ -148,14 +148,14 @@ Ref TerrainLibrary::liquid_material_lod_get(const int index) { } void TerrainLibrary::liquid_material_cache_get_key(Ref chunk) { - CALL(_liquid_material_cache_get_key, chunk); + call("_liquid_material_cache_get_key", chunk); } void TerrainLibrary::_liquid_material_cache_get_key(Ref chunk) { } Ref TerrainLibrary::liquid_material_cache_get(const int key) { - RETURN_CALLP(Ref, _liquid_material_cache_get, key); + return call("_liquid_material_cache_get", key); } Ref TerrainLibrary::_liquid_material_cache_get(const int key) { @@ -163,7 +163,7 @@ Ref TerrainLibrary::_liquid_material_cache_get(const int k } void TerrainLibrary::liquid_material_cache_unref(const int key) { - CALL(_liquid_material_cache_unref, key); + call("_liquid_material_cache_unref", key); } void TerrainLibrary::_liquid_material_cache_unref(const int key) { } @@ -228,14 +228,14 @@ Ref TerrainLibrary::prop_material_lod_get(const int index) { } void TerrainLibrary::prop_material_cache_get_key(Ref chunk) { - CALL(_prop_material_cache_get_key, chunk); + call("_prop_material_cache_get_key", chunk); } void TerrainLibrary::_prop_material_cache_get_key(Ref chunk) { } Ref TerrainLibrary::prop_material_cache_get(const int key) { - RETURN_CALLP(Ref, _prop_material_cache_get, key); + return call("_prop_material_cache_get", key); } Ref TerrainLibrary::_prop_material_cache_get(const int key) { @@ -243,7 +243,7 @@ Ref TerrainLibrary::_prop_material_cache_get(const int key } void TerrainLibrary::prop_material_cache_unref(const int key) { - CALL(_prop_material_cache_unref, key); + call("_prop_material_cache_unref", key); } void TerrainLibrary::_prop_material_cache_unref(const int key) { } @@ -342,7 +342,7 @@ void TerrainLibrary::refresh_rects() { void TerrainLibrary::setup_material_albedo(int material_index, Ref texture) { if (has_method("_setup_material_albedo")) { - CALL(_setup_material_albedo, material_index, texture); + call("_setup_material_albedo", material_index, texture); } } diff --git a/modules/terraman/meshers/terrain_mesher.cpp b/modules/terraman/meshers/terrain_mesher.cpp index 44e93b56d..c043255f8 100644 --- a/modules/terraman/meshers/terrain_mesher.cpp +++ b/modules/terraman/meshers/terrain_mesher.cpp @@ -430,7 +430,7 @@ void TerrainMesher::add_chunk(Ref chunk) { ERR_FAIL_COND(!has_method("_add_chunk")); ERR_FAIL_COND(!chunk.is_valid()); - CALL(_add_chunk, chunk); + call("_add_chunk", chunk); } #ifdef MESH_DATA_RESOURCE_PRESENT @@ -529,7 +529,7 @@ void TerrainMesher::add_mesh_data_resource_transform_colored(Ref &mesher) { - CALL(_add_mesher, mesher); + call("_add_mesher", mesher); } void TerrainMesher::_add_mesher(const Ref &mesher) { int orig_size = _vertices.size(); @@ -553,7 +553,7 @@ void TerrainMesher::bake_colors(Ref chunk) { ERR_FAIL_COND(!chunk.is_valid()); if (has_method("_bake_colors")) { - CALL(_bake_colors, chunk); + call("_bake_colors", chunk); } } @@ -561,7 +561,7 @@ void TerrainMesher::bake_liquid_colors(Ref chunk) { ERR_FAIL_COND(!chunk.is_valid()); if (has_method("_bake_liquid_colors")) { - CALL(_bake_liquid_colors, chunk); + call("_bake_liquid_colors", chunk); } } diff --git a/modules/terraman/world/terrain_environment_data.cpp b/modules/terraman/world/terrain_environment_data.cpp index beacca19d..88a20cbce 100644 --- a/modules/terraman/world/terrain_environment_data.cpp +++ b/modules/terraman/world/terrain_environment_data.cpp @@ -64,7 +64,7 @@ void TerrainEnvironmentData::set_indirect_energy(const int index, const float va void TerrainEnvironmentData::setup(WorldEnvironment *world_environment, DirectionalLight *primary_light, DirectionalLight *secondary_light) { if (has_method("_setup")) { - CALL(_setup, world_environment, primary_light, secondary_light); + call("_setup", world_environment, primary_light, secondary_light); } } void TerrainEnvironmentData::setup_bind(Node *world_environment, Node *primary_light, Node *secondary_light) { diff --git a/modules/terraman/world/terrain_structure.cpp b/modules/terraman/world/terrain_structure.cpp index 8a226d186..a1aa54baf 100644 --- a/modules/terraman/world/terrain_structure.cpp +++ b/modules/terraman/world/terrain_structure.cpp @@ -67,7 +67,7 @@ void TerrainStructure::write_to_chunk(Ref chunk) { ERR_FAIL_COND(!chunk.is_valid()); if (has_method("_write_to_chunk")) { - CALL(_write_to_chunk, chunk); + call("_write_to_chunk", chunk); } } diff --git a/modules/terraman/world/terrain_world.cpp b/modules/terraman/world/terrain_world.cpp index 6c22084a3..24ce3dca9 100644 --- a/modules/terraman/world/terrain_world.cpp +++ b/modules/terraman/world/terrain_world.cpp @@ -271,7 +271,7 @@ void TerrainWorld::chunk_add(Ref chunk, const int x, const int z) chunk->enter_tree(); if (has_method("_chunk_added")) { - CALL(_chunk_added, chunk); + call("_chunk_added", chunk); } emit_signal("chunk_added", chunk); @@ -388,7 +388,7 @@ Ref TerrainWorld::chunk_get_or_create(int x, int z) { Ref TerrainWorld::chunk_create(const int x, const int z) { Ref c; - GET_CALLP(Ref, c, _create_chunk, x, z, Ref()); + c = call("_create_chunk", x, z, Ref()); generation_queue_add_to(c); @@ -434,10 +434,10 @@ void TerrainWorld::chunk_generate(Ref chunk) { ERR_FAIL_COND(!chunk.is_valid()); if (has_method("_prepare_chunk_for_generation")) { - CALL(_prepare_chunk_for_generation, chunk); + call("_prepare_chunk_for_generation", chunk); } - CALL(_generate_chunk, chunk); + call("_generate_chunk", chunk); chunk->build(); } @@ -848,11 +848,11 @@ Ref TerrainWorld::get_or_create_chunk_at_world_position(const Vect } void TerrainWorld::set_voxel_with_tool(const bool mode_add, const Vector3 hit_position, const Vector3 hit_normal, const int selected_voxel, const int isolevel) { - CALL(_set_voxel_with_tool, mode_add, hit_position, hit_normal, selected_voxel, isolevel); + call("_set_voxel_with_tool", mode_add, hit_position, hit_normal, selected_voxel, isolevel); } int TerrainWorld::get_channel_index_info(const TerrainWorld::ChannelTypeInfo channel_type) { - RETURN_CALLP(int, _get_channel_index_info, channel_type); + return call("_get_channel_index_info", channel_type); } Spatial *TerrainWorld::get_editor_camera() { @@ -979,7 +979,7 @@ void TerrainWorld::_notification(int p_what) { if (_is_priority_generation && _generation_queue.empty() && _generating.empty()) { _is_priority_generation = false; - CALL(_generation_finished); + call("_generation_finished"); emit_signal("generation_finished"); diff --git a/modules/terraman_2d/defines.h b/modules/terraman_2d/defines.h index 1b8ec08b1..411cf6355 100644 --- a/modules/terraman_2d/defines.h +++ b/modules/terraman_2d/defines.h @@ -16,31 +16,4 @@ arr_into.push_back(e); \ } -#define CALL(func, ...) \ - call(#func, ##__VA_ARGS__); - -#define RETURN_CALL(ret_type, func) \ - return call(#func); - -#define RETURN_CALLP(ret_type, func, ...) \ - return call(#func, ##__VA_ARGS__); - -#define GET_CALL(ret_type, ret_var, func) \ - ret_var = call(#func); - -#define GET_CALLP(ret_type, ret_var, func, ...) \ - ret_var = call(#func, ##__VA_ARGS__); - -#define RETURN_CALLD(ret_type, def_val, func) \ - return call(#func); - -#define RETURN_CALLPD(ret_type, def_val, func, ...) \ - return call(#func, ##__VA_ARGS__); - -#define GET_CALLD(ret_type, def_val, ret_var, func) \ - ret_var = call(#func); - -#define GET_CALLPD(ret_type, def_val, ret_var, func, ...) \ - return call(#func, ##__VA_ARGS__); - #endif diff --git a/modules/terraman_2d/library/terrain_2d_library.cpp b/modules/terraman_2d/library/terrain_2d_library.cpp index c8bc4e379..d6bb489d5 100644 --- a/modules/terraman_2d/library/terrain_2d_library.cpp +++ b/modules/terraman_2d/library/terrain_2d_library.cpp @@ -42,7 +42,7 @@ void Terrain2DLibrary::set_initialized(const bool value) { } bool Terrain2DLibrary::supports_caching() { - RETURN_CALLD(bool, false, _supports_caching); + return call("_supports_caching"); } bool Terrain2DLibrary::_supports_caching() { return false; @@ -74,14 +74,14 @@ void Terrain2DLibrary::prop_texture_set(const Ref &value) { //Materials void Terrain2DLibrary::material_cache_get_key(Ref chunk) { - CALL(_material_cache_get_key, chunk); + call("_material_cache_get_key", chunk); } void Terrain2DLibrary::_material_cache_get_key(Ref chunk) { } Ref Terrain2DLibrary::material_cache_get(const int key) { - RETURN_CALLP(Ref, _material_cache_get, key); + return call("_material_cache_get", key); } Ref Terrain2DLibrary::_material_cache_get(const int key) { @@ -89,7 +89,7 @@ Ref Terrain2DLibrary::_material_cache_get(const int key) } void Terrain2DLibrary::material_cache_unref(const int key) { - CALL(_material_cache_unref, key); + call("_material_cache_unref", key); } void Terrain2DLibrary::_material_cache_unref(const int key) { } @@ -104,14 +104,14 @@ void Terrain2DLibrary::material_set(const Ref &value) { //Liquid Materials void Terrain2DLibrary::liquid_material_cache_get_key(Ref chunk) { - CALL(_liquid_material_cache_get_key, chunk); + call("_liquid_material_cache_get_key", chunk); } void Terrain2DLibrary::_liquid_material_cache_get_key(Ref chunk) { } Ref Terrain2DLibrary::liquid_material_cache_get(const int key) { - RETURN_CALLP(Ref, _liquid_material_cache_get, key); + return call("_liquid_material_cache_get", key); } Ref Terrain2DLibrary::_liquid_material_cache_get(const int key) { @@ -119,7 +119,7 @@ Ref Terrain2DLibrary::_liquid_material_cache_get(const i } void Terrain2DLibrary::liquid_material_cache_unref(const int key) { - CALL(_liquid_material_cache_unref, key); + call("_liquid_material_cache_unref", key); } void Terrain2DLibrary::_liquid_material_cache_unref(const int key) { } @@ -135,14 +135,14 @@ void Terrain2DLibrary::liquid_material_set(const Ref &value) { //Prop2D Materials void Terrain2DLibrary::prop_material_cache_get_key(Ref chunk) { - CALL(_prop_material_cache_get_key, chunk); + call("_prop_material_cache_get_key", chunk); } void Terrain2DLibrary::_prop_material_cache_get_key(Ref chunk) { } Ref Terrain2DLibrary::prop_material_cache_get(const int key) { - RETURN_CALLP(Ref, _prop_material_cache_get, key); + return call("_prop_material_cache_get", key); } Ref Terrain2DLibrary::_prop_material_cache_get(const int key) { @@ -150,7 +150,7 @@ Ref Terrain2DLibrary::_prop_material_cache_get(const int } void Terrain2DLibrary::prop_material_cache_unref(const int key) { - CALL(_prop_material_cache_unref, key); + call("_prop_material_cache_unref", key); } void Terrain2DLibrary::_prop_material_cache_unref(const int key) { } @@ -225,7 +225,7 @@ void Terrain2DLibrary::refresh_rects() { void Terrain2DLibrary::setup_material_albedo(int material_index, Ref texture) { if (has_method("_setup_material_albedo")) { - CALL(_setup_material_albedo, material_index, texture); + call("_setup_material_albedo", material_index, texture); } } diff --git a/modules/terraman_2d/meshers/terrain_2d_mesher.cpp b/modules/terraman_2d/meshers/terrain_2d_mesher.cpp index a29a3a6be..530e7613b 100644 --- a/modules/terraman_2d/meshers/terrain_2d_mesher.cpp +++ b/modules/terraman_2d/meshers/terrain_2d_mesher.cpp @@ -479,7 +479,7 @@ void Terrain2DMesher::add_chunk(Ref chunk) { ERR_FAIL_COND(!has_method("_add_chunk")); ERR_FAIL_COND(!chunk.is_valid()); - CALL(_add_chunk, chunk); + call("_add_chunk", chunk); } #ifdef MESH_DATA_RESOURCE_PRESENT @@ -570,7 +570,7 @@ void Terrain2DMesher::add_mesh_data_resource_transform_colored(Ref &mesher) { - CALL(_add_mesher, mesher); + call("_add_mesher", mesher); } void Terrain2DMesher::_add_mesher(const Ref &mesher) { int orig_size = _vertices.size(); @@ -594,7 +594,7 @@ void Terrain2DMesher::bake_colors(Ref chunk) { ERR_FAIL_COND(!chunk.is_valid()); if (has_method("_bake_colors")) { - CALL(_bake_colors, chunk); + call("_bake_colors", chunk); } } @@ -602,7 +602,7 @@ void Terrain2DMesher::bake_liquid_colors(Ref chunk) { ERR_FAIL_COND(!chunk.is_valid()); if (has_method("_bake_liquid_colors")) { - CALL(_bake_liquid_colors, chunk); + call("_bake_liquid_colors", chunk); } } diff --git a/modules/terraman_2d/world/terrain_2d_environment_data.cpp b/modules/terraman_2d/world/terrain_2d_environment_data.cpp index 241c88f92..3290c61c6 100644 --- a/modules/terraman_2d/world/terrain_2d_environment_data.cpp +++ b/modules/terraman_2d/world/terrain_2d_environment_data.cpp @@ -64,7 +64,7 @@ void Terrain2DEnvironmentData::set_indirect_energy(const int index, const float void Terrain2DEnvironmentData::setup(WorldEnvironment *world_environment, DirectionalLight *primary_light, DirectionalLight *secondary_light) { if (has_method("_setup")) { - CALL(_setup, world_environment, primary_light, secondary_light); + call("_setup", world_environment, primary_light, secondary_light); } } void Terrain2DEnvironmentData::setup_bind(Node *world_environment, Node *primary_light, Node *secondary_light) { diff --git a/modules/terraman_2d/world/terrain_2d_structure.cpp b/modules/terraman_2d/world/terrain_2d_structure.cpp index df99b90a4..75be94316 100644 --- a/modules/terraman_2d/world/terrain_2d_structure.cpp +++ b/modules/terraman_2d/world/terrain_2d_structure.cpp @@ -59,7 +59,7 @@ void Terrain2DStructure::write_to_chunk(Ref chunk) { ERR_FAIL_COND(!chunk.is_valid()); if (has_method("_write_to_chunk")) { - CALL(_write_to_chunk, chunk); + call("_write_to_chunk", chunk); } } diff --git a/modules/terraman_2d/world/terrain_2d_world.cpp b/modules/terraman_2d/world/terrain_2d_world.cpp index 6a3584090..f415c80d6 100644 --- a/modules/terraman_2d/world/terrain_2d_world.cpp +++ b/modules/terraman_2d/world/terrain_2d_world.cpp @@ -314,7 +314,7 @@ void Terrain2DWorld::chunk_add(Ref chunk, const int x, const int chunk->enter_tree(); if (has_method("_chunk_added")) { - CALL(_chunk_added, chunk); + call("_chunk_added", chunk); } emit_signal("chunk_added", chunk); @@ -437,7 +437,7 @@ Ref Terrain2DWorld::chunk_get_or_create(int x, int z) { Ref Terrain2DWorld::chunk_create(const int x, const int z) { Ref c; - GET_CALLP(Ref, c, _create_chunk, x, z, Ref()); + c = call("_create_chunk", x, z, Ref()); generation_queue_add_to(c); @@ -491,10 +491,10 @@ void Terrain2DWorld::chunk_generate(Ref chunk) { ERR_FAIL_COND(!chunk.is_valid()); if (has_method("_prepare_chunk_for_generation")) { - CALL(_prepare_chunk_for_generation, chunk); + call("_prepare_chunk_for_generation", chunk); } - CALL(_generate_chunk, chunk); + call("_generate_chunk", chunk); chunk->build(); } @@ -913,11 +913,11 @@ Ref Terrain2DWorld::get_or_create_chunk_at_world_position(const } void Terrain2DWorld::set_voxel_with_tool(const bool mode_add, const Vector2 hit_position, const int selected_voxel, const int isolevel) { - CALL(_set_voxel_with_tool, mode_add, hit_position, selected_voxel, isolevel); + call("_set_voxel_with_tool", mode_add, hit_position, selected_voxel, isolevel); } int Terrain2DWorld::get_channel_index_info(const Terrain2DWorld::ChannelTypeInfo channel_type) { - RETURN_CALLP(int, _get_channel_index_info, channel_type); + return call("_get_channel_index_info", channel_type); } Terrain2DWorld::Terrain2DWorld() { @@ -1035,7 +1035,7 @@ void Terrain2DWorld::_notification(int p_what) { if (_is_priority_generation && _generation_queue.empty() && _generating.empty()) { _is_priority_generation = false; - CALL(_generation_finished); + call("_generation_finished"); emit_signal("generation_finished"); update();