Japanese language troubles with GRFCodec

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
Minoru
Engineer
Engineer
Posts: 5
Joined: 19 Jul 2011 14:17
Location: Akademgorodok

Japanese language troubles with GRFCodec

Post by Minoru »

Hello,
Here I have a japanese language town names nfo file that I couldn't compile properly with grfcodec on by box.
Town names language selection list shows only trash while nforenum gives warnings like this:

Code: Select all

//!!Warning (144): Offset 4: Control character 97 should not be used in this string.
//!!Warning (143): Offset 7: Using unspecified control character 9C.
//!!Warning (144): Offset 25: Control character 96 should not be used in this string.
//!!Warning (143): Offset 34: Using unspecified control character 9C.
//!!Warning (144): Offset 38: Control character 89 should not be used in this string.
//!!Warning (144): Offset 39: Control character 8B should not be used in this string.
I'm using UTF-8 encoding.
Guys managed somehow to make chinese town names NewGRF and it compiles without warnings, but I can't determine what kind of magic does they use.
Any help is appreciated.
Attachments
jpn_townw.nfo
(854 Bytes) Downloaded 113 times
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Japanese language troubles with GRFCodec

Post by planetmaker »

Unless specificially stated, grfcodec assumes ascii. UTF-8-encoded strings must be preceeded by the thorn character, which corresponds to the two bytes C3 9E

untested, but try:

Code: Select all

    2 * 41	 0F 80 7F C3 9E "日本語" 00 00 02
    		 02 00 02 
		 	03 C3 9E "横" 00
			01 C3 9E "æ–°" 00
		 02 02 02
		 	03 C3 9E "浜" 00
			01 C3 9E "手" 00
Btw, have you considered going the potentially easier way through using NML?
See http://dev.openttdcoop.org/projects/townnames
Minoru
Engineer
Engineer
Posts: 5
Joined: 19 Jul 2011 14:17
Location: Akademgorodok

Re: Japanese language troubles with GRFCodec

Post by Minoru »

It really helped, thanks you!
Minoru
Engineer
Engineer
Posts: 5
Joined: 19 Jul 2011 14:17
Location: Akademgorodok

Re: Japanese language troubles with GRFCodec

Post by Minoru »

Also, can I combine two chains in a such way that the every town name will be one of produced by only one of that chains and never a concatenation of them? I really don't need town names such as 川湊川.
Attachments
jpn_townw.nfo
(929 Bytes) Downloaded 105 times
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4765
Joined: 09 Sep 2007 05:03
Location: home

Re: Japanese language troubles with GRFCodec

Post by Alberth »

Do you mean like combining both sets of names into one set?

Sure you can. If you have not too many, you can combine them in one.

If you have more than what NFO can handle in a single chain, make several smaller chains (such they fit in an NFO entry), and then make a 'main' chain that picks one of the smaller chains.
(In other words, to pick a name, it must do two steps, first select a smaller sub-chain from the main entry, then in that smaller sub-set, select the name.)

I coded this in NML (and then quickly forgot the NFO details). In NML, you just make one big set of names, and the program will handle splitting in sub-chains, etc.
Minoru
Engineer
Engineer
Posts: 5
Joined: 19 Jul 2011 14:17
Location: Akademgorodok

Re: Japanese language troubles with GRFCodec

Post by Minoru »

The problem is that I can't find it in NFO format specification. The way of combining described in http://newgrf-specs.tt-wiki.net/wiki/ActionF only concatenates the carthesian product of two chains.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Japanese language troubles with GRFCodec

Post by planetmaker »

Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4765
Joined: 09 Sep 2007 05:03
Location: home

Re: Japanese language troubles with GRFCodec

Post by Alberth »

Minoru wrote:The problem is that I can't find it in NFO format specification. The way of combining described in http://newgrf-specs.tt-wiki.net/wiki/ActionF only concatenates the carthesian product of two chains.
Set bit 7 of the probability of a part, that makes the part point to a previously defined action F.

In that way, you can pick a previously defined set by some probability.
Minoru
Engineer
Engineer
Posts: 5
Joined: 19 Jul 2011 14:17
Location: Akademgorodok

Re: Japanese language troubles with GRFCodec

Post by Minoru »

It helped, thanks!
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 4 guests