Running costs - Base cost factor for vehicles

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

Moderator: Graphics Moderators

Post Reply
gesia
Engineer
Engineer
Posts: 5
Joined: 07 Oct 2013 20:05

Running costs - Base cost factor for vehicles

Post by gesia »

Hello,

I'm currently trying to rebalance some NewGRFs against each other. I've read basically all of the relevant specs (http://newgrf-specs.tt-wiki.net/wiki/Main_Page), or so I think. However, I still don't understand the running costs of vehicles yet.

According to the spec, for trains, the base value (referenced using prop 0E) is multiplied with the cost factor (prop 0D) to get the actual running cost. That seems trival, however in the 2cc Trainset v2.0.0 Beta 5 I find a lot of entries like this:

15328 * 84 00 00 1F 01 FF C5 08 02 01 03 28 04 19 05 00 06 07 07 0A 08 00 00 00 00 2A 4B C7 0A 00 09 73 00
0B 40 06 1B 00 00 1F 28 16 4B 24 00 20 20 14 00 15 00 1D 00 00 00 00 28 0B 00 29 F0 03 0D 00 0E
30 4C 00 00 17 00 1C 00 12 FD 19 00 13 00 1E 12 21 00 27 02

So the running cost of all these engines should be 0, which is not the case. I Have already considered the possibility of an action 07/09, but I haven't found any that would affect, for instance, this line - or maybe I missed them.

Is there another way of setting the running costs which I am missing?

Thanks in advance for any pointers.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Running costs - Base cost factor for vehicles

Post by planetmaker »

You might have more joy by looking at the actual source which is quite well documented than some de-compiled, uncommented code :-)

The property for running costs is indeed set to 0 for vehicles in the 2ccTS. It is set to different values via callback 0x36 depending on circumstances.
gesia
Engineer
Engineer
Posts: 5
Joined: 07 Oct 2013 20:05

Re: Running costs - Base cost factor for vehicles

Post by gesia »

Thanks, the callbacks are what I was missing.

Looking at the source the only point in using a callback for running cost is to make the running cost lower while the vehicle is standing still. Is that correct?
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Running costs - Base cost factor for vehicles

Post by planetmaker »

gesia wrote:Thanks, the callbacks are what I was missing.

Looking at the source the only point in using a callback for running cost is to make the running cost lower while the vehicle is standing still. Is that correct?
Without going through all the code of that set, I believe that that is the intention, yes.
gesia
Engineer
Engineer
Posts: 5
Joined: 07 Oct 2013 20:05

Re: Running costs - Base cost factor for vehicles

Post by gesia »

Well, thanks a lot for taking the time!
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 23 guests