OpenTTD

Tasklist

FS#5471 - Vehicles: callback to populate vehicle purchase list

Attached to Project: OpenTTD
Opened by David Dallaston (Pikka) - Monday, 11 February 2013, 12:53 GMT
Last edited by andythenorth (andythenorth) - Friday, 01 September 2017, 11:09 GMT
Type Feature Request
Category NewGRF
Status New
Assigned To No-one
Operating System All
Severity Medium
Priority Low
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 2
Private No

Details

It would be nice to have a callback to add/remove vehicles from the purchase list, so that different players could have different vehicles available (similar to the way, at the moment, one player can have access a prototype vehicle that other players do not).

The only use of this callback I can think of is:

c) giving players exclusive vehicles in multiplayer games (for example, player 1 gets German trains and player 2 gets French trains).

Callback returns 0 to allow and 1 to hide vehicle from buy list. Perhaps 2 to display vehicle but not allow construction? This callback (or some other callback) should also have the ability to auto-reject new vehicle prototypes. Otherwise players will be offered prototypes of vehicles they're not going to be able to build.

New variables which would be nice, but not essential, for this callback are:

a) availability of other vehicle (x). This would allow, for example, specialist wagons to be hidden before the locomotive which hauls them appears.
b) count of vehicle (this/x) (owned by this player/everyone). This would allow authors to limit the number of a particular vehicle, if they wanted to do that for some reason.
This task depends upon

Comment by Alberth (Alberth) - Monday, 11 February 2013, 12:58 GMT
Second attempt at the description, previous attempt was in  FS#5467 
Comment by Johannes E. Krause (Eddi) - Monday, 11 February 2013, 13:00 GMT
Implementation details:
src/engine_base.h:Engine already has this member:
CompanyMask company_avail; ///< Bit for each company whether the engine is available for that company.


it just needs a NewGRF-y way to set the value.
Comment by Johannes E. Krause (Eddi) - Monday, 11 February 2013, 13:03 GMT
A possible use-case for this callback would be to force availability of vehicles circumventing the builtin randomisation.
E.g for EMU-Wagons to become available immediately when the matching EMU gets offered as a prototype/general availability.
Comment by Alberth (Alberth) - Monday, 11 February 2013, 13:57 GMT
http://irclogs.qmsk.net/channels/openttd/link/1360588209#1360588209 some random conversation in #openttd about this issue.
Comment by David Dallaston (Pikka) - Monday, 11 February 2013, 14:23 GMT Comment by andythenorth (andythenorth) - Thursday, 31 August 2017, 20:37 GMT
Not convinced that this is super-useful, but eh.

Loading...