The International Simutrans Forum

Development => Technical Documentation => Topic started by: Vonjo on March 31, 2012, 12:26:41 PM

Title: Build Number
Post by: Vonjo on March 31, 2012, 12:26:41 PM
Is there any command to get Simutrans version and build number?
Title: Re: Build Number
Post by: Zeno on March 31, 2012, 12:30:32 PM
On windows you can get it in the file properties dialog. Moreover, you can see it in the window title text, IIRC; probably that last works for all OS.
Title: Re: Build Number
Post by: Vonjo on March 31, 2012, 12:42:52 PM
Thanks. But
Is there any command or parameter or way to get it programatically?
Title: Re: Build Number
Post by: Zeno on March 31, 2012, 01:33:04 PM
According to the wiki (http://simutrans-germany.com/wiki/wiki/tiki-index.php?page=en_start_parameter&structure=en_Index&page_ref_id=1429), there isn't such command line option.
Title: Re: Build Number
Post by: kierongreen on March 31, 2012, 03:12:49 PM
kieron@numenor:~$ simutrans --help

---------------------------------------
  Simutrans 111.2 Nightly
  released Feb 25 2012
  developed
  by the Simutrans team.

....
Title: Re: Build Number
Post by: Zeno on March 31, 2012, 04:56:15 PM
The -help switch doesn't work in windows :(
But it isn't a complain, because it's not very useful such an option when you're used to right-click stuff.
Title: Re: Build Number
Post by: Vonjo on March 31, 2012, 05:06:00 PM
Thanks, kierongreen. :)
But, just as Zeno said, it doesn't work in Windows.
It should work in Linux.
Title: Re: Build Number
Post by: kierongreen on March 31, 2012, 05:12:01 PM
Does it not work if you run simutrans from the command prompt in windows?
Title: Re: Build Number
Post by: VS on March 31, 2012, 05:15:28 PM
Apart from the obvious potential causes - user can't use command line - SDL traps stdout and stderr, which is a pain in ****, too.
Title: Re: Build Number
Post by: Zeno on March 31, 2012, 05:24:10 PM
I guess that VS is right about stdout, because it appears to work (no error, no window...) but nothing is written on my screen...

Title: Re: Build Number
Post by: kierongreen on March 31, 2012, 05:29:39 PM
What happens if you run it from within cmd though? That way window remains open after simutrans exits. This probably show I haven't seriously used windows in many many years...
Title: Re: Build Number
Post by: Zeno on March 31, 2012, 05:41:15 PM
Yep, that's how I did it... just nothing happens, nothing printed on screen, just the command prompt below, waiting for a new command.
Title: Re: Build Number
Post by: Vonjo on March 31, 2012, 06:01:30 PM
(http://i.imgur.com/Gaked.png)
Title: Re: Build Number
Post by: isidoro on April 01, 2012, 01:11:26 AM
Quote from: kierongreen on March 31, 2012, 05:29:39 PM
[...]
This probably show I haven't seriously used windows in many many years...

Then we're twin souls.  At the beginning I thought I would miss it or need something.  Eventually, I erased it from all my machines...
Title: Re: Build Number
Post by: kierongreen on April 01, 2012, 07:34:43 AM
According to code help text is printed and program exits before backend starts. Therefore I don't think this is a case of SDL trapping output. What happens with GDI version? (I suspect exactly the same but may be wrong).
Title: Re: Build Number
Post by: Ters on April 01, 2012, 08:06:23 AM
I think it might have something to do with the two modes of Windows executables: console programs and GUI programs. The former requires a console, and will normally create one for itself if started from anywhere but a console. The latter doesn't want to have anything to do with a console and totally ignores even the one it was started from. From my experience, Simutrans for Windows is built to run in GUI mode, I guess so that players don't get a pesky console windows in addition to the main window. I believe it is possible to write programs that will use a console if present, but won't create one if not, or that will create a console when told to just print text. I'm not exactly sure how, but that it requires platform specific code is quite certain.
Title: Re: Build Number
Post by: isidoro on April 01, 2012, 10:55:02 AM
Since in Windows version, it is possible to get debug messages, it should be possible to get version information since it is printed:

~$ simutrans -debug 2 -log
[...]
parse_simuconf() at config/simuconf.tab: Reading simuconf.tab successful!
Simutrans version  nightly 111.0.1 from Jan  9 2012
ERROR: obj_reader_t::read_file():    reading 'skin/ground.Outside.pak' failed!


And the same information appears in file simu.log.  In my case, in directory ~/.simutrans/...

Title: Re: Build Number
Post by: Ters on April 01, 2012, 03:42:21 PM
That doesn't work for me. I get a new prompt immediately. No log output in the console.

If I build a console application, I get log output in the console. -help also works.
Title: Re: Build Number
Post by: Vonjo on April 01, 2012, 07:25:05 PM
I tried to execute Simutrans from my Java application. The app can read Simutrans' output and print it to console. 'simutrans --help' should work here too.
(http://i.imgur.com/iHv38.jpg)
It should work with another programming language or platform too.

Thanks :)
Title: Re: Build Number
Post by: prissi on April 02, 2012, 10:08:50 AM
You can compiel simutrans with console and without. Just uncomment

#WIN32_CONSOLE = 1 # adds a console for windows debugging

as written in config.template. But normal user complained about the console.

You can also use the network screen to see it ingame.
Title: Re: Build Number
Post by: Fabio on April 02, 2012, 10:27:18 AM
Actually getting rid of console was a great improvement, it looks much more professional like this.