News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

Bug - Only 16^2 valid place names.

Started by ras52, September 27, 2011, 05:39:09 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ras52

The simutrans-exp 10.1 code only uses the first 16 place name prefixes and the first 16 suffixes, instead of the full range given in en.tab (which may be as many as 255 of each).  This leads to quite repetitive place names, especially if you have many cities.  The attached patch (against git head) fixes this to allow up to 64k place names.  There's no requirement for the translation file to contain a full set of 255 prefixes and suffixes -- for example, en.tab only has 59 suffixes.  The second patch fixes a bug in the simutrans-experimental-text sources where there seems to have been some confusion as to whether the prefix labels are numbered in decimal or hexadecimal.

Edit The code in standard is fine as it only allows 36 prefix / suffix syllables which are labelled 0-9, A-Z and so the %c printf format specifier is fine; in experimental, 256 syllables are allowed and they are labelled in hexadecimal so %x is needed.
Richard Smith

jamespetts

Richard,

thank you very much for that, and apologies for not having replied sooner - I have been very busy this week! I shall have a look at that when I get a chance, and, if it's all working, incorporate it into the next version. (I thought that I had fixed this some time ago, but I must have missed something).
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

jamespetts

I have at last had time to integrate this into the code - thank you very much for posting that fix: most helpful! This will be part of the next release.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

ras52

Thanks very much, James.  For future reference, is posting to the forum here the best way to get uncontroversial patches such as these incorporated?
Richard Smith

jamespetts

Yes!

Edit: One thing that I would say about patches, though, is that it's easier for me if they are Github branches rather than .patch files.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

ras52

Quote from: jamespetts on October 07, 2011, 02:24:28 PM
it's easier for me if they are Github branches rather than .patch files.

Apologies for what is, I'm sure, an obvious question to anyone familiar with git.  But how exactly do I do that?  At the moment I do

git clone git://github.com/jamespetts/simutrans-experimental.git

then hack the code until I have something that works and finally do git diff. As you can probably tell, I'm not really familiar with git!
Richard Smith

jamespetts

Don't worry - it's a good tool when you get used to it. There are lots of good Git tutorials around, but which one to recommend depends on whether you use Linux or Windows.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

prissi

Actually sending patches like this is the intended way also for git ...

jamespetts

Hmm - how then does one use a .patch file with Git? Is it not better to create a branch?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

prissi

#9
Patch files are made for sending by email. You can use patch just with the same named program, although on windows7 you may need to rename it to pach before running. Just as with any other versioning system this works best, when there hasn't to many possibly conflicting changes. However, git itself has also a tool for handling patches: "git apply"

For being able to pull from other archives my GIT computer needs to be online and accessible from outside. A patch file can be used any time. Also to make branches on github one need to register there and stuff. For a simple patch, there is patch ...

For the git page:
Quote
Each commit has an author and a committer field, which record who and when created the change and who committed it (Git is designed to work well with patches coming by mail - in that case, the author and the committer will be different). Git will try to guess your realname and email, but especially with email it is likely to get it wrong. ...