Page 1 of 2

Patch: Russian town names

Posted: 27 Jul 2007 19:37
by legoscia
I have hacked together a patch that adds a simple Russian town name generator to OpenTTD. It uses the Cyrillic alphabet, so you need to use a Unicode font to enjoy it.

I'm not Russian myself, so those of you who are may laugh at me and my ignorance now :D The generated names are indeed a bit monotonic; while reading my Атлас СССР I find lots and lots of names that do not fit my pattern. It might be interesting to expand the generator a bit…

It was pointed out in the IRC channel that Action F should be used instead, but I don't see how it would be possible to have adjectives agreeing with the gender of the noun.

Enjoy! (And if you do, please tell me. Maybe I'm the only twisted person who enjoys this kind of thing :D )

Re: Patch: Russian town names

Posted: 27 Jul 2007 21:01
by DaleStan
legoscia wrote:It was pointed out in the IRC channel that Action F should be used instead, but I don't see how it would be possible to have adjectives agreeing with the gender of the noun.
You can do anything you want with action F. If you want gender agreement:

Code: Select all

//Final definition
2*0 0F 80 <style-names>
  01 02 00 01
    81 01
    81 02

//masculine nouns
3*0 0F 01 02
  <num-parts> 01 <bit-count>
    //<num-parts> adjectives, masculine form
  <num-parts> <first-bit> <bit-count>
    //<num-parts> masculine nouns
Then repeat sprite 3 with the feminine forms and feminine nouns. And, if necessary, adjust sprite 2 and repeat sprite 3 again for the neuter gender.

Re: Patch: Russian town names

Posted: 27 Jul 2007 21:11
by legoscia
DaleStan wrote:You can do anything you want with action F.
Ah… thanks for the enlightenment! I'll try to hack something together…

Re: Patch: Russian town names

Posted: 27 Jul 2007 22:39
by legoscia
There, now I've converted my name generator to NewGRF format; see attachments.

I noticed that OpenTTD doesn't allow forward referencing chains; all chains that the current chain jumps to must be defined earlier in the file. Is that a bug or a feature?

Re: Patch: Russian town names

Posted: 27 Jul 2007 23:11
by glx
legoscia wrote:I noticed that OpenTTD doesn't allow forward referencing chains; all chains that the current chain jumps to must be defined earlier in the file. Is that a bug or a feature?
That is my understanding of "Specifying an ID that isn't defined yet results in an error and therefore disabling all town name definitions in the file" in action F spec on ttdpatch wiki

Re: Patch: Russian town names

Posted: 28 Jul 2007 00:04
by DaleStan
Argh! Indeed. I got the sprites backwards. Just about the entirety of NFO works that way; everything must be defined before it can be used. Sorry for the confusion. I need more NFO coding! Stat! ;)

And it's a feature. It means you can define more than (1 << ID_WIDTH) entities of a given type. For action F that's not much of an issue, but you can easily end up with more action 2s than the 1-byte ids would otherwise allow.

Re: Patch: Russian town names

Posted: 29 Jul 2007 21:47
by Johnny B Goode
Wait. OTTD can do Action F now?

Re: Patch: Russian town names

Posted: 29 Jul 2007 22:08
by DaleStan
I've heard at least two different developers assert the truth of that, so I would presume so.

Re: Patch: Russian town names

Posted: 30 Jul 2007 18:03
by Johnny B Goode
Thanks, didn't know.

Re: Patch: Russian town names

Posted: 09 Aug 2007 10:55
by Smoky555
Patch for russian_townnames is using over 2 years in russian builds of openttd. It use ~ 7500 real townnames of russian towns, villages, etc. It use 1 additional file (with townnames) and very small changes in original files.

Re: Patch: Russian town names

Posted: 27 Dec 2009 15:59
by Vaulter
Here patch based on original algorithm works against r18645

Re: Patch: Russian town names

Posted: 01 Apr 2010 22:20
by Vaulter
Synced to the 1.0.0
Smoky's patch with static names (no need out-dated GRF )

Re: Patch: Russian town names

Posted: 20 Apr 2010 20:47
by perk11
legoscia, if you are still on this forum, your newgrf doesn't work on 1.0. I get an error "Unexpected end of grf". And patch is worse than newgrf of course because it's incompatible with non-patched openttd.

Re: Patch: Russian town names

Posted: 21 Apr 2010 00:04
by Eddi
you can try to use grfcodec and nforenum on the grf, that might show what's wrong with it. you can get both tools from www.openttd.org/development

Re: Patch: Russian town names

Posted: 22 Apr 2010 20:14
by perk11

Code: Select all

#renum russian-town-names.nfo
NFORenum v3.4.6 r2309 - Copyright 2004-2009 Dale McCoy.
Processing file "russian-town-names.nfo".
Does not appear to be an NFO file.
Processing complete.

Code: Select all

#grfcodec -e russian-town-names.grf .
GRFCodec version 0.9.10 r2306 - Copyright (C) 2000-2005 by Josef Drexler
Encoding in temporary file russian-town-names.new
And then it just hangs up loading my CPU at 100% (I've been waiting for 5 minutes, but no effect, which is unlileky for normal processing of 5 Kb of code)

Re: Patch: Russian town names

Posted: 23 Apr 2010 00:46
by Eddi
the file doesn't respect the file format. replace the first lines with:

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 7)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel

Re: Patch: Russian town names

Posted: 23 Apr 2010 01:21
by perk11
Well, it now gives LOTS of errors like this

Code: Select all

//!!Warning (144): Offset 8: Control character 93 should not be used in this string.
//!!Warning (143): Offset 11: Using unspecified control character 9D.
//!!Warning (144): Offset 21: Control character 93 should not be used in this string.
//!!Error (187): Offset 25: Undefined extended format code D1.
//!!Error (161): Offset 31: Text ID D0 BD is not a valid text ID.
//!!Warning (144): Offset 38: Control character 93 should not be used in this string.
//!!Warning (144): Offset 53: Control character 93 should not be used in this string.
//!!Warning (147): Offset 60: Insufficient stack data for control character 82.
//!!Warning (144): Offset 68: Control character 93 should not be used in this string.
//!!Warning (144): Offset 71: Control character 94 should not be used in this string.
//!!Warning (147): Offset 79: Insufficient stack data for control character 80.
//!!Warning (144): Offset 85: Control character 93 should not be used in this string.
//!!Warning (144): Offset 88: Control character 92 should not be used in this string.
//!!Warning (144): Offset 100: Control character 93 should not be used in this string.
//!!Warning (147): Offset 109: Insufficient stack data for control character 82.
//!!Warning (144): Offset 117: Control character 93 should not be used in this string.
//!!Warning (147): Offset 128: Insufficient stack data for control character 80.
//!!Warning (144): Offset 134: Control character 93 should not be used in this string.
//!!Warning (144): Offset 147: Control character 93 should not be used in this string.
//!!Warning (143): Offset 150: Using unspecified control character 9B.
//!!Error (161): Offset 155: Text ID D0 BE is not a valid text ID.
It makes me think that this file totally doesn't respect NFO format.
But grfcodec makes the same grf an author posted. Maybe it works in TTDPatch?
I think about making my own grf for town names list (automated generation will never cover all kind of names) instead of patch. I searched this forum, but found no automated way to make NFO from a towns list. Is there any? If not I'll learn that newgrf format (but it's awful).

Re: Patch: Russian town names

Posted: 23 Apr 2010 01:28
by Eddi
these errors probably can be fixed with a few tweaks, but i haven't looked into it.

there was a script like that discussed recently, it belonged to the swiss towns set, i believe.

Re: Patch: Russian town names

Posted: 23 Apr 2010 06:26
by planetmaker
It seems that the amount of defined strings was wrongly stated within the grf. Also I silenced the warning about colour codes in action8 as they can be savely ignored.

Attached the fixed NFO file and the compiled grf which work for me.

Re: Patch: Russian town names

Posted: 23 Apr 2010 09:16
by perk11
planetmaker wrote: Attached the fixed NFO file and the compiled grf which work for me.
Thanks! It works now. But names it creates don't really look as any kind of russian names. So I think a list woul be the best decision. And maybe some generator but made by russian person :)
I think I'll make that Newgrf. And thanks Eddi, Swiss town names source really has a script. Hope it works for me.