Patch: Russian town names

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

legoscia
Engineer
Engineer
Posts: 4
Joined: 27 Jul 2007 19:11

Patch: Russian town names

Post 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 )
Attachments
russian-town-names.patch
(5.15 KiB) Downloaded 1246 times
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Patch: Russian town names

Post 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.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
legoscia
Engineer
Engineer
Posts: 4
Joined: 27 Jul 2007 19:11

Re: Patch: Russian town names

Post 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…
legoscia
Engineer
Engineer
Posts: 4
Joined: 27 Jul 2007 19:11

Re: Patch: Russian town names

Post 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?
Attachments
russian-town-names.grf
Russian Town Names v0.1: NewGRF file
(1.24 KiB) Downloaded 2469 times
russian-town-names.nfo
Russian Town Names v0.1: source NFO file
(5.1 KiB) Downloaded 1335 times
User avatar
glx
OpenTTD Developer
OpenTTD Developer
Posts: 622
Joined: 02 Dec 2005 15:43
Location: Drancy(93) - France
Contact:

Re: Patch: Russian town names

Post 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
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Patch: Russian town names

Post 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.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Johnny B Goode
Director
Director
Posts: 534
Joined: 17 Mar 2007 16:36

Re: Patch: Russian town names

Post by Johnny B Goode »

Wait. OTTD can do Action F now?
Jezulkim wrote:Credits:
- Johnny B Goode, for digging this thread up and giving me an idea for this update.
- Mr. Owen Rudge, for his TT website where I grabbed the names.
Yeah! I've been credited! (Thanks, Jezulkim)
Winner of Most Annoying Member Award 2007 - Runner-up for Biggest Spammer 2007
My blog - Diary Of A Madman
Image
Image
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Patch: Russian town names

Post by DaleStan »

I've heard at least two different developers assert the truth of that, so I would presume so.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Johnny B Goode
Director
Director
Posts: 534
Joined: 17 Mar 2007 16:36

Re: Patch: Russian town names

Post by Johnny B Goode »

Thanks, didn't know.
Jezulkim wrote:Credits:
- Johnny B Goode, for digging this thread up and giving me an idea for this update.
- Mr. Owen Rudge, for his TT website where I grabbed the names.
Yeah! I've been credited! (Thanks, Jezulkim)
Winner of Most Annoying Member Award 2007 - Runner-up for Biggest Spammer 2007
My blog - Diary Of A Madman
Image
Image
User avatar
Smoky555
Engineer
Engineer
Posts: 97
Joined: 06 Jan 2005 05:22
Location: Russia, Volgograd
Contact:

Re: Patch: Russian town names

Post 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.
Russian OpenTTD Community patchpack (2.0.0RC2) (in Russian) , (in English)
User avatar
Vaulter
Traffic Manager
Traffic Manager
Posts: 185
Joined: 21 Dec 2004 05:35
Skype: andrey-zaharov
Location: St. Petersburg, Russia
Contact:

Re: Patch: Russian town names

Post by Vaulter »

Here patch based on original algorithm works against r18645
Attachments
russian-town-names.patch
r18645
(5.31 KiB) Downloaded 588 times
User avatar
Vaulter
Traffic Manager
Traffic Manager
Posts: 185
Joined: 21 Dec 2004 05:35
Skype: andrey-zaharov
Location: St. Petersburg, Russia
Contact:

Re: Patch: Russian town names

Post by Vaulter »

Synced to the 1.0.0
Smoky's patch with static names (no need out-dated GRF )
Attachments
russian-town-names-smoky.patch
(129.2 KiB) Downloaded 656 times
perk11
Engineer
Engineer
Posts: 19
Joined: 20 Apr 2010 20:41
Location: Moscow,Russia
Contact:

Re: Patch: Russian town names

Post 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.
Eddi
Tycoon
Tycoon
Posts: 8257
Joined: 17 Jan 2007 00:14

Re: Patch: Russian town names

Post 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
perk11
Engineer
Engineer
Posts: 19
Joined: 20 Apr 2010 20:41
Location: Moscow,Russia
Contact:

Re: Patch: Russian town names

Post 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)
Eddi
Tycoon
Tycoon
Posts: 8257
Joined: 17 Jan 2007 00:14

Re: Patch: Russian town names

Post 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
perk11
Engineer
Engineer
Posts: 19
Joined: 20 Apr 2010 20:41
Location: Moscow,Russia
Contact:

Re: Patch: Russian town names

Post 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).
Eddi
Tycoon
Tycoon
Posts: 8257
Joined: 17 Jan 2007 00:14

Re: Patch: Russian town names

Post 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.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Patch: Russian town names

Post 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.
Attachments
russtown.nfo
NFO which works for me
(5.77 KiB) Downloaded 638 times
russtown.grf
compiled grf
(1.24 KiB) Downloaded 714 times
perk11
Engineer
Engineer
Posts: 19
Joined: 20 Apr 2010 20:41
Location: Moscow,Russia
Contact:

Re: Patch: Russian town names

Post 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.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 15 guests