Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call CB 15 when building vehicle #2581

Closed
DorpsGek opened this issue Jan 24, 2009 · 11 comments
Closed

Call CB 15 when building vehicle #2581

DorpsGek opened this issue Jan 24, 2009 · 11 comments
Labels
component: NewGRF This issue is related to NewGRFs flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

George opened the ticket and wrote:

R15235
The capacity that vehicle gets when build, is different from capacity it gets on refit for the same cargo.
It looks like CB 15 is not called when vehicle is build (I suppose it should).

Attachments

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/2581
@DorpsGek
Copy link
Member Author

frosch wrote:

Without looking at the grf: CB 15 is not called on construction. But CB 36 is.


This comment was imported from FlySpray: https://bugs.openttd.org/task/2581#comment5427

@DorpsGek
Copy link
Member Author

George wrote:

And what should happen, if CB 36 and CB 15 return different values?


This comment was imported from FlySpray: https://bugs.openttd.org/task/2581#comment5429

@DorpsGek
Copy link
Member Author

George wrote:

Well, changed a code to use CB 36
It does not solve the problem, because it calculates capacity for FF cargo, not the cargo that would be transported on build. And how can I get the cargo that is carried by vehicle when build (default cargo can be not available in the current game)? So, when creating FF view, what is the right way to define properties? May be they should be taken from built RV (without building the RV), not cargo FF (only graphics is taken from view FF)?

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/2581#comment5431

@DorpsGek
Copy link
Member Author

frosch wrote:

Does the section 'proposed solution' in http://devs.openttd.org/~frosch/doc/capacityadventure.txt suit your needs?


This comment was imported from FlySpray: https://bugs.openttd.org/task/2581#comment5470

@DorpsGek
Copy link
Member Author

DorpsGek commented Feb 1, 2009

George wrote:

It's not clean enough, how would it work for ARV? If I have two parts, and the capacity of the second parts depends on the part. which it is attached to, how would it be taken into account?


This comment was imported from FlySpray: https://bugs.openttd.org/task/2581#comment5478

@DorpsGek
Copy link
Member Author

DorpsGek commented Feb 1, 2009

frosch wrote:

then you have to use livery overrides to start a separate action3 chain for the rear part. after cb15 and 36 are handled you can rejoin them.

however in the purchase list you cannot access other vehicles. you have to return the whole capacity for the first part and none for the others.

note: from looking at others articulated vehicles the best strategy is to use the same id for the front part and all aritculated parts, and then differentiate depending on 'position in consist' (but that might not be very useful in the purchase list, as you cannot access that variable there)


This comment was imported from FlySpray: https://bugs.openttd.org/task/2581#comment5479

@DorpsGek
Copy link
Member Author

DorpsGek commented Feb 1, 2009

George wrote:

The idea to use the same ID for front an rare part is not good enough, because this limits the author to only 80h IDs.

If I specify capacity in the purchase window for the first part only, then what should happen if the default cargo is not available?

If I specify 0 capacity for the second part, than the code should allow to refit it with non-zero capacity on build.


This comment was imported from FlySpray: https://bugs.openttd.org/task/2581#comment5496

@DorpsGek
Copy link
Member Author

DorpsGek commented Feb 1, 2009

frosch wrote:

You have to return different values when in purchase list, and when actually building.

E.g.
ID 0x80: Front part, no capacity, attaches ID 0x00
ID 0x81: Front part, no capacity, attaches ID 0x00
ID 0x00: Rear part, capacity 100 if attached to 0x80, capacity 200 if attached to 0x200

Code:
ID 0x80: Return capacity 100 if in purchase list, 0 in other cases.
ID 0x81: Return capacity 200 if in purchase list, 0 in other cases.
ID 0x00: Return capacity 0 if in purchase list. Return capacity 100 or 200 when livery-overridden by ID 0x80 or 0x81.

The purchase list capacity should be returned by both CB 15 (for known cargo labels) and 36 (for unknown cargo labels).
The action 0 property does not really matter, when using CB 36. But there might be some hidden things that refitting is not allowed when certain capacities are zero. I have to look into that later.


This comment was imported from FlySpray: https://bugs.openttd.org/task/2581#comment5500

@DorpsGek
Copy link
Member Author

DorpsGek commented Feb 1, 2009

George wrote:

this sounds fine


This comment was imported from FlySpray: https://bugs.openttd.org/task/2581#comment5501

@DorpsGek
Copy link
Member Author

frosch wrote:

This has finally been implemented. See
http://newgrf-specs.tt-wiki.net/wiki/VehicleRefitting# Misc.vehicle_flag_5.27use_of_capacity_multiplier_for_default_cargo.27_set


This comment was imported from FlySpray: https://bugs.openttd.org/task/2581#comment10823

@DorpsGek
Copy link
Member Author

frosch closed the ticket.

Reason for closing: Implemented

in r23861


This comment was imported from FlySpray: https://bugs.openttd.org/task/2581

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) component: NewGRF This issue is related to NewGRFs enhancement labels Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: NewGRF This issue is related to NewGRFs flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant