From 1dbb4ba7ee9e9631ef44496c77216d4f9388e31a Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 31 May 2023 09:38:17 +0200 Subject: [PATCH] Fix hardcoded value in gdnative_builders.py. --- gdnative_builders.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gdnative_builders.py b/gdnative_builders.py index 81aa63a..1a13721 100644 --- a/gdnative_builders.py +++ b/gdnative_builders.py @@ -13,7 +13,7 @@ def _spaced(e): def _build_gdnative_api_struct_header(api): gdnative_api_init_macro = ["\textern const pandemonium_gdnative_core_api_struct *_gdnative_wrapper_api_struct;"] - + for ext in api["extensions"]: name = ext["name"] gdnative_api_init_macro.append( @@ -95,6 +95,7 @@ def _build_gdnative_api_struct_header(api): def generate_core_extension_struct(core): ret_val = [] + if core["next"]: ret_val += generate_core_extension_struct(core["next"]) @@ -254,7 +255,15 @@ def _build_gdnative_api_struct_source(api): "extern const pandemonium_gdnative_core_api_struct api_struct = {", "\tGDNATIVE_" + api["core"]["type"] + ",", "\t{" + str(api["core"]["version"]["major"]) + ", " + str(api["core"]["version"]["minor"]) + "},", - "\t(const pandemonium_gdnative_api_struct *)&api_1_1,", + "\t" + ( + "NULL" + if not api["core"]["next"] + else ( + "(const pandemonium_gdnative_api_struct *)& api_{0}_{1}".format( + api["core"]["next"]["version"]["major"], api["core"]["next"]["version"]["minor"] + ) + ) + ) + ",", "\t" + str(len(api["extensions"])) + ",", "\tgdnative_extensions_pointers,", ]