Page 1 of 1

Coding problem - The sort of the purchase list

Posted: 03 Jun 2004 20:11
by Raven
I have a problem over here, because i give an exact number for each of the trains, but they still get mixed up, as the wiki said, i included at the beggining of the file a shuffle action 00, but it still keeps messing up things

2 * 6 00 00 01 00 00 1A

this one.

For example, after using the debuugger and inserting allvehicles in temeperate , it introduces right in the first posiition the fizzi dring wagon (of course with wrong picture).
What should i take care of to make everything work? it's a full conversion, so most of the wagons & trains but 15 or so are taken.

Thanks

(patchman: i wwas quite silly on my last post about consists, i didn'r realize there was a 2nd page in the wiki, my apologies :oops: )

Posted: 04 Jun 2004 15:36
by Oracle
This is what I do for the US Set and it works. I do it all in one block so that there is no interference whatever (this is quite a complicated procedure). I recommend not to have a property 1A in all of your Action 0s: the order then becomes really important.
Also check your newgrf[w].cfg and remove anything that might be resorting it after the file that you're editing.
This does assume that you have a lot of locomotives. If you haven't,

Code: Select all

   -1 * 6	 00 00 01 00 00 1A //resets the vehicle list
   -1 * 7	 00 00 01 01 53 1A 54 //makes sure that 53 is before 54.  These are maglev loco IDs so, by a weird automatic feature of the patch, are moved above the wagons.
   -1 * 33	 00 00 01 1B 39 1A 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 //Starting at 39h, move all the locomotives above the wagons and the "maglev locos" one-by-one.
   -1 * 7	 00 00 01 01 2C 1A 1B //Move tender (2C) above passenger carriage
   -1 * 7	 00 00 01 01 69 1A 1C //Move another wagon (69) above mail car (1C)
Repeat the last line as necessary for each vehicle you want to reorder.
Then use Cht: Year 2040 then Cht: AllVehicles to test it.

Posted: 05 Jun 2004 14:05
by Raven
Also check your newgrf[w].cfg and remove anything that might be resorting it after the file that you're editing.
This does assume that you have a lot of locomotives. If you haven't,
It seems like you forgot to say something.

Anyway, i have a full set, so if i've understood, i take all action 00 1a out, and right at the beggining of the nfo file reorder them as you said. Well, lets try. Thanks!.

One more thing, placing a -1 before each sprite makes the numbering auto, but in the first action, the one aboout the total number of sprites in the set. what should it be?

Posted: 06 Jun 2004 14:34
by Oracle
Raven wrote:
Also check your newgrf[w].cfg and remove anything that might be resorting it after the file that you're editing.
This does assume that you have a lot of locomotives. If you haven't,
It seems like you forgot to say something.
Whoops! I meant to say that you might want to sort them all before 1B (the passenger carriage) instead of the 53 I used.
Raven wrote:One more thing, placing a -1 before each sprite makes the numbering auto, but in the first action, the one aboout the total number of sprites in the set. what should it be?
Umm, I think -1 would work but I use 0. The GRF file for me starts 0, 1, -1, -1 then -1 for the rest of it.

Posted: 06 Jun 2004 18:11
by Raven
actually, i work on excel then pass the file to the notepad, so i can have all info close enough.

But what i really meant, was

Code: Select all

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

well, if all your sprites are -1, what do you have to place after sprite 00? again a -1?. then, the only solution i've found to add new sprites to the pcx file is to copypaste some from the same nfo, code, decode, and then add the new sprites, but that way i lose all the -1

Posted: 07 Jun 2004 16:40
by Oracle
I don't get what you mean, but here's my start:

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 4)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
    0 * 4	 82 0B 00 00
    1 * 6	 07 83 01 02 03 00
   -1 * 6	 07 83 01 03 00 01
   -1 * 6	 07 00 04 00 01 00
   -1 * 6	 07 83 01 03 01 01
   -1 * 6	 07 00 04 00 02 00
   -1 * 6	 07 83 01 03 02 01
   -1 * 6	 07 00 04 00 03 00

Posted: 07 Jun 2004 17:00
by Raven
well,

Code: Select all

// Automatically generated by GRFCODEC. Do not modify! 
// (Info version 4) 
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel 
    0 * 4    82 0B 00 00 
so even placing a -1 before every sprite, you still have to count them right?. ok, seems pretty straightforward. Thanks :wink:

Posted: 07 Jun 2004 17:16
by Oracle
Oh, yes, you do. But GRFCodec does it for you. Just encode it and the number still visible at the bottom left, a few lines up, is the number of sprites. Just convert it into hex, then little-endian format and you're done.