The International Simutrans Forum

 

Author Topic: Get version of simutrans  (Read 534 times)

0 Members and 1 Guest are viewing this topic.

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1730
    • Simutrans-BLOG
  • Languages: ES
Get version of simutrans
« 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.

Offline Andarix

  • *
  • Posts: 296
  • Languages: de
Re: Get version of simutrans
« Reply #1 on: July 22, 2021, 09:26:50 PM »
Dwachs asked that wishes be entered here.

https://github.com/Dwachs/simutrans-scenarios/issues

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1730
    • Simutrans-BLOG
  • Languages: ES
Re: Get version of simutrans
« Reply #2 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):
Code: [Select]
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()"

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

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4899
  • Languages: EN, DE, AT
Re: Get version of simutrans
« Reply #3 on: July 28, 2021, 04:42:53 PM »
You really want svn revision number? Or would be something like "123.4.5 NIghtly" enough?

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1730
    • Simutrans-BLOG
  • Languages: ES
Re: Get version of simutrans
« Reply #4 on: July 28, 2021, 04:59:44 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.

Offline THLeaderH

  • Coder/patcher
  • Devotee
  • *
  • Posts: 435
  • Languages: JP,EN
Re: Get version of simutrans
« Reply #5 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.

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1730
    • Simutrans-BLOG
  • Languages: ES
Re: Get version of simutrans
« Reply #6 on: August 23, 2021, 02:42:10 AM »
This is nice! I am very happy that this is more useful.  :D