The International Simutrans Forum

Development => Scripting Scenarios and AI => Topic started by: Yona-TYT on July 22, 2021, 05:57:19 PM

Title: Get version of simutrans
Post by: Yona-TYT on July 22, 2021, 05:57:19 PM
 I have noticed that now you can get the name of the pakset from script, I wonder if it is possible to do the same with the version number of simutras.
Title: Re: Get version of simutrans
Post by: Andarix on July 22, 2021, 09:26:50 PM
Dwachs asked that wishes be entered here.

https://github.com/Dwachs/simutrans-scenarios/issues (https://github.com/Dwachs/simutrans-scenarios/issues)
Title: Re: Get version of simutrans
Post by: Yona-TYT on July 22, 2021, 11:00:53 PM
Getting the revision works for me too.

Here's a little experiment (not sure if it works):
api_world.cc----------------------- +++

#include "../../dataobj/gameinfo.h"

uint32 get_revision(){
    gameinfo_t current( welt );
    return current.get_game_engine_revision();
}


register_method(vm, get_revision, "get_revision");

-----------------------------------

squirrel_types_scenario.awk-------- +++

export_types["::get_revision"] = "integer()"

-----------------------------------
Title: Re: Get version of simutrans
Post by: Dwachs on July 28, 2021, 04:42:53 PM
You really want svn revision number? Or would be something like "123.4.5 NIghtly" enough?
Title: Re: Get version of simutrans
Post by: Yona-TYT on July 28, 2021, 04:59:44 PM
Quote from: Dwachs on July 28, 2021, 04:42:53 PM
You really want svn revision number? Or would be something like "123.4.5 NIghtly" enough?
That above was only one experiment on my part.

The most reasonable would be to get the version number, since the end user will understand it better since most mortals are more familiar with version numbers.
Title: Re: Get version of simutrans
Post by: THLeaderH on August 18, 2021, 03:11:20 PM
Getting the version number is useful for scripting tool too. I often have to separate the logic to use API functions which were implemented in recent versions.
Title: Re: Get version of simutrans
Post by: Yona-TYT on August 23, 2021, 02:42:10 AM
This is nice! I am very happy that this is more useful.  :D