The International Simutrans Forum

Simutrans Extended => Patches/pull requests for consideration => Simutrans-Extended development => Incorporated patches/merged pull requests => Topic started by: ceeac on October 30, 2022, 08:52:09 AM

Title: PR#583 - Script API + automated tests
Post by: ceeac on October 30, 2022, 08:52:09 AM
PR#583 merges the script API and the automated test suite from Standard.
However, about half of the tests are still disabled because of bugs in Extended (https://forum.simutrans.com/index.php/topic,21993.0.html), or because the functionality is different between Standard and Extended. The tests for the latter case still need to be fixed before they can be re-enabled.

Additionally, a C++14 compiler is now required to compile.
Title: Re: PR#583 - Script API + automated tests
Post by: jamespetts on October 31, 2022, 12:17:13 AM
Thank you for this work. Can I check whether you have tested whether this merges cleanly with the ex-15 branch? It is important that any new patches merge cleanly with that branch before they can be integrated.
Title: Re: PR#583 - Script API + automated tests
Post by: ceeac on October 31, 2022, 08:40:10 AM
No, it does not, unfortunately - Should I rebase onto the ex-15 branch?
Title: Re: PR#583 - Script API + automated tests
Post by: jamespetts on November 01, 2022, 05:38:26 PM
That would be very helpful, thank you.
Title: Re: PR#583 - Script API + automated tests
Post by: ceeac on November 06, 2022, 10:01:21 AM
I have rebased the PR onto the ex-15 branch now.
Title: Re: PR#583 - Script API + automated tests
Post by: jamespetts on November 06, 2022, 10:52:08 AM
Thank you for this. Unfortunately, I am unable to compile this, even after reverting the change for the custom miniupnpc file locations. I get the following linker errors in Visual Studio:

Build started...
1>------ Build started: Project: Simutrans-Extended, Configuration: Debug x64 ------
1>git : Not a git repository warning GitNR1: Git output not valid! Check if the folder is actually versioned. A revision file already exists and its revision number won't be updated. Make sure the revision number is correct or you won't be able to play online with this build.
1>LINK : warning LNK4300: ignoring '/INCREMENTAL' because input module contains ASAN metadata
1>libbz2.lib(bzlib.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
1>  Creating library .\simutrans\Simutrans-Extended-Debug.lib and object .\simutrans\Simutrans-Extended-Debug.exp
1>api_line.obj : error LNK2001: unresolved external symbol "public: static __int64 __cdecl script_api::param<class script_api::call_tool_init>::push(struct SQVM *,class script_api::call_tool_init)" (?push@?$param@Vcall_tool_init@script_api@@@script_api@@SA_JPEAUSQVM@@Vcall_tool_init@2@@Z)
1>api_map_objects.obj : error LNK2001: unresolved external symbol "public: static __int64 __cdecl script_api::param<class script_api::call_tool_init>::push(struct SQVM *,class script_api::call_tool_init)" (?push@?$param@Vcall_tool_init@script_api@@@script_api@@SA_JPEAUSQVM@@Vcall_tool_init@2@@Z)
1>api_player.obj : error LNK2001: unresolved external symbol "public: static __int64 __cdecl script_api::param<class script_api::call_tool_init>::push(struct SQVM *,class script_api::call_tool_init)" (?push@?$param@Vcall_tool_init@script_api@@@script_api@@SA_JPEAUSQVM@@Vcall_tool_init@2@@Z)
1>api_settings.obj : error LNK2001: unresolved external symbol "public: static __int64 __cdecl script_api::param<class script_api::call_tool_init>::push(struct SQVM *,class script_api::call_tool_init)" (?push@?$param@Vcall_tool_init@script_api@@@script_api@@SA_JPEAUSQVM@@Vcall_tool_init@2@@Z)
1>api_city.obj : error LNK2001: unresolved external symbol "public: static __int64 __cdecl script_api::param<class script_api::call_tool_init>::push(struct SQVM *,class script_api::call_tool_init)" (?push@?$param@Vcall_tool_init@script_api@@@script_api@@SA_JPEAUSQVM@@Vcall_tool_init@2@@Z)
1>api_convoy.obj : error LNK2001: unresolved external symbol "public: static __int64 __cdecl script_api::param<class script_api::call_tool_init>::push(struct SQVM *,class script_api::call_tool_init)" (?push@?$param@Vcall_tool_init@script_api@@@script_api@@SA_JPEAUSQVM@@Vcall_tool_init@2@@Z)
1>api_factory.obj : error LNK2001: unresolved external symbol "public: static __int64 __cdecl script_api::param<class script_api::call_tool_init>::push(struct SQVM *,class script_api::call_tool_init)" (?push@?$param@Vcall_tool_init@script_api@@@script_api@@SA_JPEAUSQVM@@Vcall_tool_init@2@@Z)
1>api_halt.obj : error LNK2001: unresolved external symbol "public: static __int64 __cdecl script_api::param<class script_api::call_tool_init>::push(struct SQVM *,class script_api::call_tool_init)" (?push@?$param@Vcall_tool_init@script_api@@@script_api@@SA_JPEAUSQVM@@Vcall_tool_init@2@@Z)
1>api_city.obj : error LNK2001: unresolved external symbol "public: static __int64 __cdecl script_api::param<class script_api::call_tool_work>::push(struct SQVM *,class script_api::call_tool_work)" (?push@?$param@Vcall_tool_work@script_api@@@script_api@@SA_JPEAUSQVM@@Vcall_tool_work@2@@Z)
1>api_gui.obj : error LNK2001: unresolved external symbol "public: static __int64 __cdecl script_api::param<class script_api::call_tool_work>::push(struct SQVM *,class script_api::call_tool_work)" (?push@?$param@Vcall_tool_work@script_api@@@script_api@@SA_JPEAUSQVM@@Vcall_tool_work@2@@Z)
1>api_map_objects.obj : error LNK2001: unresolved external symbol "public: static __int64 __cdecl script_api::param<class script_api::call_tool_work>::push(struct SQVM *,class script_api::call_tool_work)" (?push@?$param@Vcall_tool_work@script_api@@@script_api@@SA_JPEAUSQVM@@Vcall_tool_work@2@@Z)
1>api_tiles.obj : error LNK2001: unresolved external symbol "public: static __int64 __cdecl script_api::param<class script_api::call_tool_work>::push(struct SQVM *,class script_api::call_tool_work)" (?push@?$param@Vcall_tool_work@script_api@@@script_api@@SA_JPEAUSQVM@@Vcall_tool_work@2@@Z)
1>api_player.obj : error LNK2001: unresolved external symbol "class script_api::call_tool_init __cdecl script_api::command_rename(class player_t *,char,unsigned int,char const *)" (?command_rename@script_api@@YA?AVcall_tool_init@1@PEAVplayer_t@@DIPEBD@Z)
1>api_city.obj : error LNK2001: unresolved external symbol "class script_api::call_tool_init __cdecl script_api::command_rename(class player_t *,char,unsigned int,char const *)" (?command_rename@script_api@@YA?AVcall_tool_init@1@PEAVplayer_t@@DIPEBD@Z)
1>api_convoy.obj : error LNK2001: unresolved external symbol "class script_api::call_tool_init __cdecl script_api::command_rename(class player_t *,char,unsigned int,char const *)" (?command_rename@script_api@@YA?AVcall_tool_init@1@PEAVplayer_t@@DIPEBD@Z)
1>api_halt.obj : error LNK2001: unresolved external symbol "class script_api::call_tool_init __cdecl script_api::command_rename(class player_t *,char,unsigned int,char const *)" (?command_rename@script_api@@YA?AVcall_tool_init@1@PEAVplayer_t@@DIPEBD@Z)
1>api_line.obj : error LNK2001: unresolved external symbol "class script_api::call_tool_init __cdecl script_api::command_rename(class player_t *,char,unsigned int,char const *)" (?command_rename@script_api@@YA?AVcall_tool_init@1@PEAVplayer_t@@DIPEBD@Z)
1>api_factory.obj : error LNK2001: unresolved external symbol "class script_api::call_tool_init __cdecl script_api::command_rename(class player_t *,char,class koord3d,char const *)" (?command_rename@script_api@@YA?AVcall_tool_init@1@PEAVplayer_t@@DVkoord3d@@PEBD@Z)
1>api_map_objects.obj : error LNK2001: unresolved external symbol "class script_api::call_tool_init __cdecl script_api::command_rename(class player_t *,char,class koord3d,char const *)" (?command_rename@script_api@@YA?AVcall_tool_init@1@PEAVplayer_t@@DVkoord3d@@PEBD@Z)
1>api_param.obj : error LNK2001: unresolved external symbol "public: static void * __cdecl script_api::param<class tool_t *>::tag(void)" (?tag@?$param@PEAVtool_t@@@script_api@@SAPEAXXZ)
1>export_objs.obj : error LNK2001: unresolved external symbol "void __cdecl export_commands(struct SQVM *)" (?export_commands@@YAXPEAUSQVM@@@Z)
1>export_objs.obj : error LNK2001: unresolved external symbol "void __cdecl export_pathfinding(struct SQVM *)" (?export_pathfinding@@YAXPEAUSQVM@@@Z)
1>scenario.obj : error LNK2001: unresolved external symbol "public: static class script_vm_t * __cdecl script_loader_t::start_vm(char const *,char const *,char const *,bool)" (?start_vm@script_loader_t@@SAPEAVscript_vm_t@@PEBD00_N@Z)
1>scenario.obj : error LNK2001: unresolved external symbol "public: static void __cdecl script_loader_t::load_compatibility_script(class script_vm_t *)" (?load_compatibility_script@script_loader_t@@SAXPEAVscript_vm_t@@@Z)
1>.\simutrans\Simutrans-Extended-debug.exe : fatal error LNK1120: 9 unresolved externals
1>Done building project "Simutrans-Extended.vcxproj" -- FAILED.

This looks as though there is a missing .cc file somewhere, but I cannot find any additional files that I should be including.
Title: Re: PR#583 - Script API + automated tests
Post by: ceeac on November 06, 2022, 05:01:15 PM
Yes, there were some files that were not added to the vcxproj file; this should hopefully be fixed now.
Title: Re: PR#583 - Script API + automated tests
Post by: jamespetts on November 06, 2022, 07:24:45 PM
Quote from: ceeac on November 06, 2022, 05:01:15 PMYes, there were some files that were not added to the vcxproj file; this should hopefully be fixed now.

Excellent, thank you. This now seems to work. I have incorporated this.

I note for reference that we are now targetting C++14 rather than the previous C++11.