NFORenum v3.4.6 released (NFO renumberer and linter)

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

Moderator: Graphics Moderators

DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

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

Post 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
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
User avatar
George
Tycoon
Tycoon
Posts: 4362
Joined: 16 Apr 2003 16:09
Skype: george-vb
Location: Varna, Bulgaria
Contact:

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

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

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

Post 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.
Last edited by DaleStan on 19 Feb 2010 17:08, edited 1 time in total.
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
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

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

Post by DJ Nekkid »

no rush dale ... :)

I'll _try_ to crash it again, and see if it _still_ happens :)
Member of the
ImageImage
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

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

Post 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.
Attachments
crash_on_invalid_feature.diff
(1.08 KiB) Downloaded 156 times
feature_10.diff
(3.67 KiB) Downloaded 138 times
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

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

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

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

Post by DaleStan »

DJ Nekkid wrote:The action1 crashes renum.
I still can't reproduce this, but I think everything else is in. (Finally.)
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
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

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

Post 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
Attachments
nutracks.nfo
nfo of nutracks
(17.37 KiB) Downloaded 134 times
nutracks-nightly-r31-source.tar.gz
the whole repo ready for building
(53.44 KiB) Downloaded 143 times
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

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

Post 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?
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
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

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

Post 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.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

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

Post by Yexo »

Support for extended string codes (9A + byte) 0B and 0C, print 8-byte value as hex / print station name.
Attachments
extended_string_codes.diff
(402 Bytes) Downloaded 134 times
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

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

Post 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 
User avatar
minime
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 18 Jan 2004 10:02
Skype: dan.masek
Location: Prague, Czech Republic
Contact:

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

Post 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?
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. --Albert Einstein
Image Image Image
oberhümer
Tycoon
Tycoon
Posts: 1283
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

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

Post 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).
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---

--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

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

Post 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
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

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

Post 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.
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

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

Post by Rubidium »

There's a new (preview) release at http://www.tt-forums.net/viewtopic.php?f=26&t=49612
Locked

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 20 guests