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

Locked
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1714
Joined: 04 Mar 2005 01:07

Post by OzTrans »

DaleStan wrote: ... You seem to be suggesting that the error message be changed to "An and-mask would suffice here"? ...
Yes, but after some thoughts, I think the whole issue, of whether a more efficient code should be used, belongs in the wiki. This boils down to experience and knowing how to do these things; I have never considered whether an 'and-mask' or something else would be more appropriate. Had I read about it in the wiki, this would be a different story. I would say a simple message that this sprite can be coded more efficiently and being pointed to the wiki would suffice. Of course I don't know all the various functionalities of var act-2's you are considering when suggesting a simpler solution and most importantly how more CPU-efficient this could be done.

Now, to this random business, this I coded weeks ago and everything seems to work ...

Code: Select all

//!!Warning (174): Using an undefined trigger.
 1555 * 15	 02 00 AE 80 E0 01 04 ED 00 EE 00 ED 00 EF 00
                          ^^
Here, I am actually using vehicle trigger 5+6 (which do not exist); this sprite should only be randomized at the time of purchase. That 'E0 01' was deliberate and it does work.

The other one ...

Code: Select all

//!!Error (129): Offset 5: Only 8 random bits are available.
 1520 * 39     02 00 ED 80 01 05 10 ...
                              ^^ ^^
I do actually start at bit 4 (I do remember, that at the time of coding, counting had to start at 1 (for bit 0); this I found by trial and error. It took me a fair while to figure out how not to distroy/alter those other 2 random bits used in the case just above. I may be wrong, but I'll investigate this further.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

OzTransLtd wrote:
DaleStan wrote: ... You seem to be suggesting that the error message be changed to "An and-mask would suffice here"? ...
I would say a simple message that this sprite can be coded more efficiently and being pointed to the wiki would suffice.
That's a quality-of-implementation issue. Taking this to an extreme, I could simply use the exact same message for everything: "NFORenum does not like this sprite; see the wiki." But that really would not be useful.
It seems to me that a shift-and should be marginally faster than a shift-and-add-*, but depending on how it is implemented, it might actually be the other way around.
OzTransLtd wrote:Here, I am actually using vehicle trigger 5+6 (which do not exist); this sprite should only be randomized at the time of purchase. That 'E0 01' was deliberate and it does work.
:oops: yes, that is triggers 5..7; not sure where I got 4..6. And yes, that line will work. Until Patchman defines a vehicle trigger 5, that is.

For those of you who are using industry prop 12, and haven't discovered this yet, I've uploaded a new 0.dat.
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
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

DaleStan wrote:
OzTransLtd wrote:Here, I am actually using vehicle trigger 5+6 (which do not exist); this sprite should only be randomized at the time of purchase. That 'E0 01' was deliberate and it does work.
:oops: yes, that is triggers 5..7; not sure where I got 4..6. And yes, that line will work. Until Patchman defines a vehicle trigger 5, that is.
Yes, if you want no random triggers, you should specify no random triggers at all instead of using reserved (undefined) ones. Otherwise, as DaleStan says, it'll work for now but break once those become defined.
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1714
Joined: 04 Mar 2005 01:07

Post by OzTrans »

DaleStan wrote:That's a quality-of-implementation issue. Taking this to an extreme, I could simply use the exact same message for everything ...
However you implement this is fine with me, I'll simply assume you know more than I do and will make changes to my code until the messages disappear.
Patchman wrote:Yes, if you want no random triggers, you should specify no random triggers at all instead of using reserved (undefined) ones. Otherwise, as DaleStan says, it'll work for now but break once those become defined.
I'll go over that again.

Thanks for all the help.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Ugh... Brain fart on the high bit of <triggers>.
Just goes to show that you can't always trust me to know what I'm talking about. Usually, maybe. But not always.

v3.1.2 to v3.1.3
- (bugfix) Bit 7 of <triggers> is not a trigger.
- (hotfix) Add industry property 10.
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
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

I'm coding again, at least for a little bit. Hopefully I'll catch some more inspiration here soon. ... And maybe some more free time.

v3.1.3 to v3.1.4
- Action 02 feature 07/09 <xofs> and <yofs> no are longer limited to 00..0F.
- (bugfix) Fix check for non-decreasing ypos in real sprites.
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
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

After way too long fighting disinterest and/or coder's block, I finally have something releasable again.

Most of you folks probably won't notice, but there are some massive internal changes that reduce memory usage to about half and reduce runtime by about one third. I think this is a Good Thing (tm).

Those of you who compile your own versions will notice that I'm starting to depend on boost. For now it's just current_function.hpp (and it's included), but I may add boost::program_options, if I can get it to comprehend optional arguments.

Changelog:
v3.1.4 to v3.2.0
- (hotfix) TextIDs F900..F904.
- (hotfix) Callbacks 3C and 3D.
- (hotfix) Industry variable 63, industry tile variable 61, vehicle variable 48.
- New format for lang bytes.
- Check that lang byte contains a known language.
- @@BEAUTIFY LINEBREAKS
- @@BEAUTIFY CONVERTONLY
- (change) Action 2s of at least three bytes will always define their ID.
- Check for duplicate style-names for all languages.
- Allow ON and OFF on the command line as + and -, resp.
- @@CLEARACTION2
- @@CLEARACTIONF
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
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

NFORenum's source code, in its latest, bleeding-edge form (and all other forms it has had since 3.2.0, is now available from [url]svn://svn.ttdpatch.net/misc/nforenum[/url], and is no longer directly available from the NFORenum site.

Changelog:
v3.2.0 to v3.2.1
- @@USEOLDSPRITENUMS
- @@DEFINEID2
- @@LOCATEID2
- @@TESTID2
- (bugfix) Error message when Action B contains an invalid parameter now reports correct offset and parameter.
- Check for including textIDs with a 00 byte.
- (bugfix) Prevent beautifier from inserting extraneous blank lines a line that contains only quoted characters.
- Merge the <xoff>/<yoff> and <xoff>+<xextent>/<yoff>+<yextent> checks, and reduce them to Warn3.
- New properties, variables, and callbacks:
- - Station properties: 16, 17, 18
- - Station variables: 4A, 66
- - Callbacks: 140, 141, 142
- New action 5 type 0D
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: 4364
Joined: 16 Apr 2003 16:09
Skype: george-vb
Location: Varna, Bulgaria
Contact:

Post by George »

DaleStan wrote:NFORenum's source code, in its latest, bleeding-edge form (and all other forms it has had since 3.2.0, is now available from [url]svn://svn.ttdpatch.net/misc/nforenum[/url], and is no longer directly available from the NFORenum site.
Where can I download the all in one rar archive now?
Image Image Image Image
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

It doesn't exist. A Windows binary is available from the site, and the source is at the other end of [url]svn://svn.ttdpatch.net/misc/nforenum/[/url].

For Windows users, I recommend TortoiseSVN, although Cygwin's svn client can also be useful.
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
Wile E. Coyote
Tycoon
Tycoon
Posts: 8515
Joined: 08 Jul 2004 22:14
Skype: wile.e.coyote2
Location: Belgrade, Serbia
Contact:

Post by Wile E. Coyote »

DaleStan, one proposition (might be impossible or unuseful):
NFO Renum checks, for example, numprops in Action 0, or numloadingtypes or nvars in Action 2 etc. and reports if they don't match. Is it possible to add switch for automatic fixing errors (for example: renum -p [filename] fixes numprops, renum -v fixes nvars etc.)
Serbian rail set with Serbian scenario (ECS, PBI, FIRS and Tourist set compatible) Website | Topic and download | Latest version: 03.06.2015.
Serbian tram set Tracking table | TTD Patch tram set Latest version: 17.06.2015. | Open TTD Remix Latest version: 11.07.2015.
WIN-DOS GRF Converter Topic and download | Version 0.2.1: 09.01.2005.


Runner-up in "Best avatar Forums award" for years 2006 and 2010!
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Wile E. Coyote wrote:DaleStan, one proposition (might be impossible or unuseful):
NFO Renum checks, for example, numprops in Action 0, or numloadingtypes or nvars in Action 2 etc. and reports if they don't match. Is it possible to add switch for automatic fixing errors
Useful where possible, but not always possible.
Take, for example, these sprites:

Code: Select all

1*0 02 00 00 00 00 00 00 01 00 02 00 03 00 04 00
2*0 02 00 10 81 7F 00 02 03 02 01 00 00 00 02 00 01 01
3*0 00 00 01 01 02 00 06 15 08 01
In sprite 1, there's no way of telling whether nument1 and nument2 are supposed to be 00 05, 01 04, 02 03, 03 02, 04 01, or 05 00.
In sprite 2, is that <nvar> == 1 with two extra bytes, or <nvar>==2 with a missing default?
In sprite 3, is that one property for two vehicles, or two properties for one vehicle?

But in many cases it would be possible.
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
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

For sprite 3, I decided to assume that <num-info> was correct while checking <num-props>.

These are the list of things NFORenum will (sometimes) auto-correct:
Action 0 <num-props>
Action 0 <num-info>
House/industry tile extended format standard action 2 <num-sprites>
Variational action 2 <nvar>
Random action 2 <nrand>
Action 3 <num-cid>
Action 4 <num-ent>
Action 7/9 <varsize>
Action A <num-sets>
Action E <num>
Action 12 <num-def>

Did I miss anything?

Anyone who wants to test this out can check out the latest revision of the NFORenum source from [url]svn://svn.ttdpatch.net/misc/nforenum[/url], but the action 7/9 correcting code is not yet (as of r220) committed.
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
Jezulkim
Chairman
Chairman
Posts: 844
Joined: 04 Jan 2004 09:40
Location: Finland/Suomi

Post by Jezulkim »

I have a problem with the nfo renum. When I'm going to renum an nfo file, the renum.exe says:
NFO Renum wrote:Could not create .renum directory in C:\. (13)
Unkown reason
I'm using version 3.2.1
Image
In order to protect the visitors of this site,
TTO Full Conversion!
This post has been lol 1337 times.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

13 is EACCES, meaning "Permission denied".
The only way I could reproduce this was to attempt to write to a read-only location.

I can't explain why C:\ would be read only, though. Try specifying a different directory with -D/--data.
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
Wile E. Coyote
Tycoon
Tycoon
Posts: 8515
Joined: 08 Jul 2004 22:14
Skype: wile.e.coyote2
Location: Belgrade, Serbia
Contact:

Post by Wile E. Coyote »

DaleStan wrote:Anyone who wants to test this out can check out the latest revision of the NFORenum source from [url]svn://svn.ttdpatch.net/misc/nforenum[/url], but the action 7/9 correcting code is not yet (as of r220) committed.
I can't open URL :(
Are corrections optional or automatic?
Serbian rail set with Serbian scenario (ECS, PBI, FIRS and Tourist set compatible) Website | Topic and download | Latest version: 03.06.2015.
Serbian tram set Tracking table | TTD Patch tram set Latest version: 17.06.2015. | Open TTD Remix Latest version: 11.07.2015.
WIN-DOS GRF Converter Topic and download | Version 0.2.1: 09.01.2005.


Runner-up in "Best avatar Forums award" for years 2006 and 2010!
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Wile E. Coyote wrote:
DaleStan wrote:Anyone who wants to test this out can check out the latest revision of the NFORenum source from [url]svn://svn.ttdpatch.net/misc/nforenum[/url], but the action 7/9 correcting code is not yet (as of r220) committed.
I can't open URL :(
You'll have to have something that speaks SVN and a compiler to use that. I use TortoiseSVN, and either Cygwin's gcc or MSVS 2003 to compile.
Wile E. Coyote wrote:Are corrections optional or automatic?
Automatic if you enable them.
renum foo.nfo does exactly what it did before, while renum -a foo.nfo will perform most autocorrections, and renum -aa foo.nfo will perform all of them.

EDIT: fix TortoiseSVN link
Last edited by DaleStan on 12 May 2006 14:47, 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
Wile E. Coyote
Tycoon
Tycoon
Posts: 8515
Joined: 08 Jul 2004 22:14
Skype: wile.e.coyote2
Location: Belgrade, Serbia
Contact:

Post by Wile E. Coyote »

Too big file... I can't download 7 or 9 MB with 56K connection :( (for TortoiseSVN, I can't open Cygwin site).
Can'c compile with VB6 (noob question, but only hope)?
Serbian rail set with Serbian scenario (ECS, PBI, FIRS and Tourist set compatible) Website | Topic and download | Latest version: 03.06.2015.
Serbian tram set Tracking table | TTD Patch tram set Latest version: 17.06.2015. | Open TTD Remix Latest version: 11.07.2015.
WIN-DOS GRF Converter Topic and download | Version 0.2.1: 09.01.2005.


Runner-up in "Best avatar Forums award" for years 2006 and 2010!
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Not with VB6. With VC6, probably, but I haven't tested that in a long time.

Cygwin's site does seem to be down, but the installer is working fine, so I'll attach it. Make sure you get the gcc, make, and subversion packages; I'm not sure which (if any) of those install by default.
You'll also need the boost-devel package (Or maybe the boost package, not quite sure), unless you move current-fun... Oh forget that; I'm going to fix that in SVN; you don't currently need the boost package.
gcc and make are only required if you don't already have a C/C++ compiler.

I have no clue what the download size will be, however.

Then

Code: Select all

$ svn co svn://svn.ttdpatch.net/misc/nforenum
$ cd nforenum
$ make
To get new versions, it's

Code: Select all

$ cd nforenum (unless you're already in the nforenum directory.)
$ svn up
$ make
If you want a binary that can be run outside the Cygwin environment, use make CFLAGAPP=-mno-cygwin instead of make.
If you are using some other compiler, omit the make commands, and instead build NFORenum with that compiler.
Attachments
setup.zip
(285.9 KiB) Downloaded 278 times
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
Jezulkim
Chairman
Chairman
Posts: 844
Joined: 04 Jan 2004 09:40
Location: Finland/Suomi

Post by Jezulkim »

DaleStan wrote:I can't explain why C:\ would be read only, though. Try specifying a different directory with -D/--data.
My C:\ it's not read only, I have an older version of nfo renum and that works fine. Specifying a new directory helped, but I have to re-specify that every time I renum a file. Or is there are way to set a default directory?
Image
In order to protect the visitors of this site,
TTO Full Conversion!
This post has been lol 1337 times.
Locked

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 11 guests