Because NML takes care of setting that property automatically.akasoft wrote:why can not do this at NML?
If you must you can specify it manually:
Code: Select all
property {
0x15: <value>;
}
Moderator: Graphics Moderators
Because NML takes care of setting that property automatically.akasoft wrote:why can not do this at NML?
Code: Select all
property {
0x15: <value>;
}
NML sets this property always to 0xFF (=first refit-able). It works this way because with GRFv7 the property was broken. Now with GRFv8 you should be able to set the default cargo, it's simply a missing feature.FooBar wrote:Because NML takes care of setting that property automatically.akasoft wrote:why can not do this at NML?
That doesn't work, because NML wouldn't know what size the property is.If you must you can specify it manually:Code: Select all
property { 0x15: <value>; }
But I want to set this of the my choice. And NFO lets me do.FooBar wrote: Because NML takes care of setting that property automatically.
Not work? I cannot set any properties using the syntax, described FooBar? It's a pity.Yexo wrote:That doesn't work, because NML wouldn't know what size the property is.
Hmmm, you have a point there...Yexo wrote:That doesn't work, because NML wouldn't know what size the property is.
This is very useful to understand when writing an AI that deals with a more advanced vehicle set like FISH. But what is it that makes passengers passengers, and mail/goods different from other cargo? I presume it's some combination of cargo classes, but which combinations...?Hirundo wrote:When refitting in OpenTTD, one unit of normal cargo is equivalent to two units of mail/goods, or four passengers. Note that the weight of the cargo doesn't (directly) matter here.
These 'capacity multipliers' are applied automatically, for example try refitting one of the default aircraft. (Note that aircraft have their own peculiarities for pax/mail which I shall not discuss here)
If you refit via callback, this multiplier effect is overridden and you always get the exact, specified capacity.
There is some magic code in OpenTTD that works because, and only because, no-one has dared yet to override passengers/mail/goods with other cargo types. Doing so would be equivalent to dividing by zeroYexo wrote:I think that's hardcoded by cargo slot. Not entirely sure though.
Also it's only a default. A NewGRF can set a different capacity for each cargo type.
Code: Select all
switch (FEAT_TRAINS, SELF, engine_articulated_part,
extra_callback_info1)
{
1..5: return engine;
return CB_RESULT_NO_MORE_ARTICULATED_PARTS;
}
item (FEAT_TRAINS, engine)
{
..
cargo_capacity: 124;
..
graphics {
..
articulated_part: engine_articulated_part;
}
}
Code: Select all
item (FEAT_TRAINS, engine)
{
..
cargo_capacity: 25;
}
item (FEAT_TRAINS, part2)
{
..
cargo_capacity: 100;
}
item (FEAT_TRAINS, part3)
{
..
cargo_capacity: 75;
}
Code: Select all
switch (FEAT_TRAINS, SELF, engine_articulated_part,
extra_callback_info1)
{
1..5: return engine;
return CB_RESULT_NO_MORE_ARTICULATED_PARTS;
}
item (FEAT_TRAINS, engine)
{
graphics {
articulated_part: engine_articulated_part;
}
}
Code: Select all
switch (FEAT_TRAINS, SELF, engine_articulated_part,
extra_callback_info1)
{
1: return part2;
2: return part3;
3: return (engine + CB_RESULT_REVERSED_VEHICLE);
return CB_RESULT_NO_MORE_ARTICULATED_PARTS;
}
item (FEAT_TRAINS, engine)
{
graphics {
articulated_part: engine_articulated_part;
}
}
Code: Select all
#train misc flags
'TRAIN_FLAG_TILT' : 0,
'TRAIN_FLAG_2CC' : 1,
'TRAIN_FLAG_MU' : 2,
'TRAIN_FLAG_FLIP' : 3,
'TRAIN_FLAG_AUTOREFIT': 4,
Code: Select all
switch (FEAT_TRAINS, SELF, engine_articulated_part,
extra_callback_info1)
{
1..5: return engine;
return CB_RESULT_NO_MORE_ARTICULATED_PARTS;
}
Code: Select all
switch (FEAT_TRAINS, SELF, engine_articulated_part,
extra_callback_info1)
{
1: return part2;
2: return part3;
3: return (engine + CB_RESULT_REVERSED_VEHICLE);
return CB_RESULT_NO_MORE_ARTICULATED_PARTS;
}
Code: Select all
item (FEAT_TRAINS, engine)
{
misc_flags: bitmask(TRAIN_FLAG_MU, TRAIN_FLAG_MU_NO_AMMOUNT);
..
graphics {
articulated_part: engine_articulated_part;
}
}
Code: Select all
switch(FEAT_TRAINS, SELF, switch_emu_templatetest_articulated, extra_callback_info1) {
1..7: return item_emu_templatetest;
return CB_RESULT_NO_MORE_ARTICULATED_PARTS;
}
Code: Select all
// Name: switch_emu_templatetest_articulated
98 * 23 02 00 F8 89
10 00 dxFFFFFFFF
b1
wx8074 dx00000001 dx00000007 // 1 .. 7: return 116;
wxFFFF // default: return 32767;
A callback result in grf v8 has (always) 15 bit. Thus 0x74 = 116 and A result of 0x7FFF indicates 'callback failed'. The highest bit 16 which is not part of the callback result itself (0x8000) indicates that the return value is not an action2 ID but the final result (and 0x7FFF + 0x8000 = 0xFFFF).FooBar wrote:Shouldn't it return wx7FFF as "do not add more articulated parts"?
Also for the ID wx8074 does not equal 116...
Code: Select all
refittable_cargo_classes: bitmask(CC_PASSENGERS);
non_refittable_cargo_classes: 0;
refittable_cargo_types: 0;
Code: Select all
28 wx0001
15 FF
29 wx0000
15 FF
1D dx00000000
15 FF
I think it is a bug in OpenTTD. Does adding PASS to the cargotable (and changing nothing else) solve the problem?FooBar wrote:Well, the reboot didn't change anything, but at least I've found that the articulated vehicle callback is not the problem.
What is the problem is one of these three properties:When I comment all of those out the train works. If I put any one of them back (doesn't matter which one) the train becomes unavailable.Code: Select all
refittable_cargo_classes: bitmask(CC_PASSENGERS); non_refittable_cargo_classes: 0; refittable_cargo_types: 0;
Funnily enough all my trains that dissapeared are MUs that have a capacity. The ones that remained are all engines without capacity. As I previously used 0xFF to end adding articulated parts and changed that to the proper constant, I thought the problem had something to do with that. But it didn't.
Anyways, when uncommented, NML translates that to this piece of NFO (part of action 0):Now this property 15 (cargo type) is the problem, as there's no entry FF in my cargo table. When I decode the grf, remove the three prop 15 definitions and reencode (grfcodec), the train works as it should.Code: Select all
28 wx0001 15 FF 29 wx0000 15 FF 1D dx00000000 15 FF
So clearly this property 15 is the problem, however I have no idea if this is because I did something wrong or not. I can't imagine that I have to put passengers in my cargo table, as that's the whole point of using cargo classes...
If anyone could shed some light on this that would be grand!
Users browsing this forum: No registered users and 13 guests