The International Simutrans Forum

Community => Simutrans Gaming Discussion => Topic started by: IgorEliezer on April 01, 2011, 07:40:19 PM

Title: [wingdi r4384] Changing translation for automatic stop naming crashes the game
Post by: IgorEliezer on April 01, 2011, 07:40:19 PM
I was trying to change some bad translations in text/pt.tab, then I tried to insert a bus stop in the city. Simutrans returned me Application error: The memory can't be "read".

The text/pt.tab was:

%s city %d %s
%s - %dª %s urbana


My city already had some bus stops inserted and, as I was seeing the ª character is badly "drawn" in the screen, I changed it to:

%s city %d %s
%s %s %d urbana


I inserted another bus stop: crash.

Savegame: http://simutrans-germany.com/files/upload/March_2011.sve

EDIT:

The workaround for this bug: I removed the "bad" character from all bus stops. I inserted another bus stop in the city: no crash.
Title: Re: [wingdi r4384] Changing translation for automatic stop naming crashes the game
Post by: VS on April 01, 2011, 07:48:11 PM
This is not a bug that can be "fixed". You must give format arguments exactly in the same order as they appear, end of discussion. The only fix possible is exchanging the conversion functions for something custom.

Translator's life generally sucks, yeah :-/
Title: Re: [wingdi r4384] Changing translation for automatic stop naming crashes the game
Post by: IgorEliezer on April 01, 2011, 08:11:33 PM
Simple, I removed the "%d" from translation.

%s city %d %s
%s %s urbana

%s land %d %s
%s %s rural


Worked.

EDIT:

No, the bug is back.

Trying another thing that makes sense in Latin syntax :S
Title: Re: [wingdi r4384] Changing translation for automatic stop naming crashes the game
Post by: VS on April 01, 2011, 08:24:36 PM
Programmer info:

It seems there is a non-C99 extension widely available on linux [1] [2] [3] [4] [5] that allows changes to order. Not available for Microsoft compilers though (yeah, we love you...). Alternatives include: Boost format library [6], which at a glance seems to be unnecessarily bloated as it uses streams internally. And that's it, hooray :-/ There is some discussion on this [7]...

[1] http://linux.die.net/man/3/snprintf
[2] http://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html
[3] http://linux.about.com/library/cmd/blcmdl3_snprintf.htm
[4] http://manpages.ubuntu.com/manpages/intrepid/man3/printf.3.html
[5] http://www.openbsd.org/cgi-bin/man.cgi?query=printf&sektion=3
[6] http://www.boost.org/doc/libs/1_46_1/libs/format/doc/format.html
[7] http://stackoverflow.com/questions/3913009/is-there-any-alternative-for-printf
Title: Re: [wingdi r4384] Changing translation for automatic stop naming crashes the game
Post by: prissi on April 03, 2011, 06:15:35 PM
We had the discussion several times already. There are various libraries which could fix this, and all of them are either bloated, suck or both or not compatible with artistic licence ...