Page 22 of 22

Re: NFORenum v3.4.6 released (NFO renumberer and linter)

Posted: 18 Feb 2010 18:05
by DaleStan
0A is encoded in 0.dat as a variable-sized property. (It could be encoded as a single word, but that would lose the \b... \b... formatting.) As such, it appears one value per line instead of in columns. In this case, it would be OK to put it in columns, but NFORenum cannot tell the difference between properties like this and ones like station property 09 or industry property 0A. I may yet change this, but it didn't happen this time.

With the default LEADINGSPACE setting, you get something more like

Code: Select all

 1517 * 82	 00 07 15 02 E8
                 08 6D           6D
                 09 24           00
                 0A \b1930 \b2175
                    \b1930 \b2175
                 0B 0A           00
//...
The one-value-per-line condition becomes more obvious when there are more values:

Code: Select all

 1517 * 0 	 00 07 01 04 E8
                 0A \b1930 \b2175
                    \b1930 \b2175
                    \b1930 \b2175
                    \b1930 \b2175

Re: NFORenum v3.4.6 released (NFO renumberer and linter)

Posted: 19 Feb 2010 04:18
by George
DaleStan wrote:0A is encoded in 0.dat as a variable-sized property. (It could be encoded as a single word, but that would lose the \b... \b... formatting.) As such, it appears one value per line instead of in columns. In this case, it would be OK to put it in columns, but NFORenum cannot tell the difference between properties like this and ones like station property 09 or industry property 0A. I may yet change this, but it didn't happen this time.
With the default LEADINGSPACE setting, you get something more like
The one-value-per-line condition becomes more obvious when there are more values:
As I expected, it is a feature, not a bug. Because it can cause issues with other actions 0, let us leave it as is.

Re: NFORenum v3.4.6 released (NFO renumberer and linter)

Posted: 19 Feb 2010 05:13
by DaleStan
DJ Nekkid wrote:renum r2300 do not seem to support new rails, and it also crashes when trying to do its job.
This is on my list, but since it hasn't happened today, I'm not optimistic about its chances of happening until at least Sunday. (Real life is great, but it's also great at getting in the way.)

Any volunteers to update data.cpp and post a patch and new datafiles?
_datfeat and all following _dat* definitions will need to be updated; between the comments (mostly thanks to minime) and the existing examples, there should be enough information there.
DJ Nekkid wrote:The action1 crashes renum.
I'm not going to touch the datafiles myself until I find and fix the crash, lest it sit there and ferment until next time. As it is now, I uncommented the Action 1 and found a really strange messaging bug, but no crash. You'll have to try again, DJ. I'm not sure how, but apparently my uncommenting does not reverse your commenting.

Re: NFORenum v3.4.6 released (NFO renumberer and linter)

Posted: 19 Feb 2010 13:58
by DJ Nekkid
no rush dale ... :)

I'll _try_ to crash it again, and see if it _still_ happens :)

Re: NFORenum v3.4.6 released (NFO renumberer and linter)

Posted: 21 Feb 2010 21:54
by Yexo
nfo used to trigger the crash: (I've broken the "Escapes" line at 2 random places to avoid breaking the layout).

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 7)
// Escapes: 2+ = 71 = D= = DR 2- = 70 = D+ = DF 2< = 7= = D- = DC 2> = 7! = Du* = DM 2u< = 7< = 
D* = DnF 2u> = 7> = Du<< = DnC 2/ = 7G = D<< = DO 2% = 7g = D& 2u/ = 7gG = D| 2u% = 7GG = 
Du/ 2* = 7gg = D/ 2& = 7c = Du% 2| = 7C = D% 2^ 2sto = 2s 2rst = 2r 2+ 2ror = 2rot
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel

 0 * 4	 00 00 00 00
 0 * -1	 08 07 "TEST" " # Test newgrf" 00
 "test" 00

 0 * -1	 03 12 01 01 00
   08 00
I've attached a fix for this case. There might be similar cases in the other check() functions as there are more calls "IssueMessage(ERROR,INVALID_FEATURE);" without a return.

I'm working on an update for data.cpp
Edit: added the diff, I'm not sure I did the changes to _dat4 correctly.

Re: NFORenum v3.4.6 released (NFO renumberer and linter)

Posted: 03 Mar 2010 21:46
by Yexo
Warning 109 (Property %2x is previously defined at offset %d.) is incorrectly given for houses prop 15 and industrytiles prop 09, which are both valid to be specified multiple times.

Re: NFORenum v3.4.6 released (NFO renumberer and linter)

Posted: 07 Mar 2010 02:38
by DaleStan
DJ Nekkid wrote:The action1 crashes renum.
I still can't reproduce this, but I think everything else is in. (Finally.)

Re: NFORenum v3.4.6 released (NFO renumberer and linter)

Posted: 07 Mar 2010 09:03
by planetmaker
Kudos & thanks for fixing the crash with invalid features and supporting those new ones :-)

Property 12 of the general variables (rail type translation table) is not yet supported:

Code: Select all

// Railtable
//!!Fatal Error (47): Offset 5: Invalid property 12.
   10 * 54	 00 08 01 \b12 00 12 "RAIL" "ELRL" "_160" "E160" "_230" "E230" "HSTR" "3RDC" "3RDR" "MONO" "MGLV" "PLAN"
Also property 13 of rail types (construction cost multiplier) was (re-)defined to a word-sized value, it looks like renum looks for a byte value, though:

Code: Select all

//!!Warning (209): Offset 93: Found byte 2 of a 2-byte escape while reading byte 1 of a 1-byte field.
//!!Fatal Error (47): Offset 93: Invalid property 02.
   73 * 99	 00 10 \b14 01 02 // action0, for rails, numprops, numrails, ID
08 "_160" //		4*B	Rail type label
09 29 D0 //		W	StringID: Name of rail type
0A 2A D0 //		W	StringID: Menu text
0B 2B D0 //		W	StringID: Build window caption
0C 2C D0 //		W	StringID: Autoreplace text
0D 2D D0 //		W	StringID: New engine text
0E 07 "HSTR" "E230" "_230" "E160" "ELRL" "RAIL" "3RDC" //		B n*D	Compatible rail type list
0F 07 "HSTR" "E230" "_230" "E160" "ELRL" "RAIL" "3RDC" //		B n*D	Powered railtype list
10 00 //		B	Rail type flags
11 00 //		B	Curve speed advantage
12 00 //		B	Station graphics
13 \w600 //		W	Construction costs <--- translates ot 58 02
14 \w160 //  W	Speed limit
15 00 //		B	Acceleration model
And while we're at it, airport tiles may also be defined since OpenTTD r19200 (see also the page in the newgrf wiki); get a source repo with this feature from here:

Code: Select all

//!!Fatal Error (44): Invalid feature byte.
    9 * 9	 00 11 \b2 01 01
 08 \b35 //subsitute type
 09 \b35 //override type

Re: NFORenum v3.4.6 released (NFO renumberer and linter)

Posted: 13 Mar 2010 07:13
by DaleStan
planetmaker: I started on this, but I can't find the var/rand action 2 information.

Yexo: Why did you report that a railtype's related object is an airport?

Re: NFORenum v3.4.6 released (NFO renumberer and linter)

Posted: 13 Mar 2010 08:36
by Yexo
DaleStan wrote:planetmaker: I started on this, but I can't find the var/rand action 2 information.
If "this" is airporttiles, then the varaction2 is the same as for industry tiles (http://wiki.ttdpatch.net/tiki-index.php ... ustryTiles) minus var 40.
Currently airporttiles have 16+4 random bits (like stations, 0..15 are the random bits from the station and 16..19 are tile-specific), but I think this should be changed to work the same as industrytiles. In that case it'd be 4 random bits per tile + 16 random bits for airports.
Yexo: Why did you report that a railtype's related object is an airport?
Before railtypes was merged to trunk both railtypes and airporttiles used feature 10 in their respective development branches. Railtypes got merged first to got feature 10, airporttiles got feature 11. I must've made a mistake while updating my renum files.

Re: NFORenum v3.4.6 released (NFO renumberer and linter)

Posted: 06 Apr 2010 22:18
by Yexo
Support for extended string codes (9A + byte) 0B and 0C, print 8-byte value as hex / print station name.

Re: NFORenum v3.4.6 released (NFO renumberer and linter)

Posted: 11 Apr 2010 22:01
by Yexo
NFORenum hangs when it encounters an action0 with num-info = 0. Minimal nfo to reproduce the hang:

Code: Select all

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

-1 * 0 00 0A \b1 00 00
08 FF 

Re: NFORenum v3.4.6 released (NFO renumberer and linter)

Posted: 15 Apr 2010 13:23
by minime
This check on act0.cpp:314 seems to be brain damaged, and since it doesn't stop processing, we then go on iterating over some 4 billion IDs (hence the hang):

Code: Select all

if(IDs==0&&(propsRemain!=1||feature||str.ExtractByte(i)!=0x1A))IssueMessage(WARNING1,NO_IDS);
What's the logic behind this? It seems to be an attempt to handle the special case of vehicle sorting property (albeit for trains only).

First of all - what about other vehicle types? Is resetting the sorting not supported for those? Documentation for those features links to description of the property of trains and makes no mention of any differences -- hence I would assume that it does (if not, wiki needs some fixing).

Second, are there any other cases, where it may be valid to have 0 IDs? I'm not aware of any at the moment, please correct me if I'm wrong.

Next, what is the proper behaviour for this error? Can we make it a FATAL, or do we want the autocorrection to do something with it?

Re: NFORenum v3.4.6 released (NFO renumberer and linter)

Posted: 20 Jun 2010 02:29
by oberhümer
I am having a few problems with NFORenum... Or possibly I am missing something...
I wrote an Action8, which looks like this:

Code: Select all

-1 * 00 08 07 76 67 51 45 "<name>" "<description>"
But NFORenum will always delete the complete line and replace it with "0 * 4 01 00 00 00".
Writing it like this:

Code: Select all

-1 * 00 08 07 76 67 51 45 "<name>" 00 "<description>" 00

will produce the same result, on a file with otherwise only a (valid) road vehicle Action0 after the Action8, and nothing before it.
Who's making the error here?[/i]
PROBLEM SOLVED by adding "0 * 4 00 00 00 00" as the first line.

In addition, it won't accept extended vehicle IDs(as used in OpenTTD).

Re: NFORenum v3.4.6 released (NFO renumberer and linter)

Posted: 05 Jul 2010 19:26
by FooBar
Small bug: unuseful error message.
nforenum wrote:A portion of sprite 3250 could not be processed.
The problem actually lies within sprite 3251 and the offending line was correctly escaped by renum (property 19)

Code: Select all

//Tile action 3
 3250 * 7	 03 09 01 CC 00 \wxA0 //-1 * 0 03 09 <n-ids> <id> 00 <def-cid>


//Industry defenition

//Action 0
 3251 * 589	 00 0A \b26 01 20 //-1 * 0 00 0A <num-props> 01 <id>
 08 05 //substitute industry type; reuse original industry with this here ID
 0A 03 //number of industry layouts
  \d498 //size of layout definition +2 for termination
  //layout 1:
   00 00 FF // special clearance tile - nothing built
   //(part removed due to size)
   06 06 FF // special clearance tile - nothing built
  00 80 //terminate layout definition
 0B 01 //production flags 1h=extractive, 2h=organic, 4h=processing
 0C 33 48 //industry closure message
 0D 35 48 //production increase message
 0E 39 48 //production decrease message
 1B 2D 48 //new industry message
 1F 94 DC //industry name
 24 EB DC //default text for nearby station
 10 1D FF //production cargo types (word; fill unused with FFh)
 11 FF FF FF FF //acceptance cargo types (dword; fill unused with FFh)
 12 \b16 //production multiplier cargo 1
 13 00 //production multiplier cargo 2
 1C \w0 \w0 //input cargo 1 multiplier (dword M1 M2; output_typen = X*Mn/256)
 1D \w0 \w0 //input cargo 2 multiplier
 1E \w0 \w0 //input cargo 3 multiplier
 14 \b2 //minimal cargo distribution amount
 16 FF FF FF //conflicting industry types (3*byte; ID+80h; FF to disable)
 17 \b20 //probability in random game
 18 \b20 //probability during gameplay
 20 FF FF FF BF //prospecting success chance (dword; FFFFFFFFh=100%)
 0F \b255 //fund cost multiplier (byte)
// 19 CLR_FISHINGGROUNDS //map colour (byte; using indexes from dos palette)
 23 \d0 //destruction cost multiplier (dword; default: 0)
 1A \dx404 //special industry flag
 21 31 //callback flags 
 22 04 //callback flags

Re: NFORenum v3.4.6 released (NFO renumberer and linter)

Posted: 06 Jul 2010 16:27
by FooBar
Renum doesn't support the multiple ground sprite syntax for house/industry tiles, which is available in TTDPatch since 2.6 r2313 and in OpenTTD since r18959. See http://wiki.ttdpatch.net/tiki-index.php ... ustryTiles, below the explanation of the extended syntax.

Re: NFORenum v3.4.6 released (NFO renumberer and linter)

Posted: 09 Aug 2010 12:32
by Rubidium
There's a new (preview) release at http://www.tt-forums.net/viewtopic.php?f=26&t=49612