Patch: Build and Refit

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

User avatar
ostlandr
Chairman
Chairman
Posts: 882
Joined: 12 May 2007 01:09
Location: Northeastern USA

Re: Patch: Build and Refit

Post by ostlandr »

I like this patch!

When I am playing with CargoDist, I often end up with multiple cargo types in a single train. With NARS2, I end up having to refit individual cars (wagons.) I end up doing lots of clumsy things like pulling wagons on and off the train in the depot screen, or keeping a cheap locomotive in the depot just so I can use it to refit cars. :| With this patch, I could (for example) buy two boxcars refitted to lumber, then two more refitted to goods, then two more refitted to plastic. 8)
Who is John Galt?
gule
Engineer
Engineer
Posts: 60
Joined: 16 Dec 2004 15:08
Location: Slovenia

Re: Patch: Build and Refit

Post by gule »

New version in first post.
If you are just viewing the list of vehicles (available vehicles), the buy and refit button is hidden.
User avatar
Vaulter
Traffic Manager
Traffic Manager
Posts: 185
Joined: 21 Dec 2004 05:35
Skype: andrey-zaharov
Location: St. Petersburg, Russia
Contact:

Re: Patch: Build and Refit

Post by Vaulter »

Nice patch!
Here is some stuff:
Changed behavior - now "build and refit" is just boolean button, when it at lowered state - refit goes after build
This was done for better supporting DRY in code (DRY - don't repeat yourself - copy pasting ;) ) and for better support another patches (leasing)
Added Russian strings.

Thanks!
Attachments
build-and-refit.t103.patch
against 1.0.3
(7.35 KiB) Downloaded 142 times
User avatar
DC-1
Engineer
Engineer
Posts: 88
Joined: 13 Mar 2013 13:53

Re: Patch: Build and Refit

Post by DC-1 »

Updated patch to stable 1.3.0
Attachments
build_and_refit-1.3.0_dc.diff
Build and refit patch for openttd-1.3.0
(5.99 KiB) Downloaded 107 times
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Patch: Build and Refit

Post by planetmaker »

I was asked "Well, why don't you commit it? :(".

Most important one: this patch is not multiplayer safe. In multiplayer always the vehicle build previously is being refit or an error is issued: _new_vehicle_id is only initialized after the build vehicle command is executed (on the server), so it is being used with stale information in network situations. Thus the patch does not work as advertized. Anyone wants to tackle it?

The other: back then I had no commit rights ;)
Attachments
build_refit_r26593.diff
the crucial part which is not MP safe
(862 Bytes) Downloaded 90 times
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Patch: Build and Refit

Post by Transportman »

Wouldn't it be possible to send the commands from the client to the server as if the player does the refit itself from the current menu? Or is that to hack-ish? Or does that suggestion does not make any sense for some other reason?
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Patch: Build and Refit

Post by planetmaker »

Transportman wrote:Wouldn't it be possible to send the commands from the client to the server as if the player does the refit itself from the current menu? Or is that to hack-ish? Or does that suggestion does not make any sense for some other reason?
Either that or a modification of the existing build command. But neither is done.
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Patch: Build and Refit

Post by adf88 »

To be just compatible, the refitting should be initiated inside CcBuildVehicle. But to have proper cost calculation the build vehicle command has to be altered. Unfortunately, there are no free bits in p1 or p2...

And here I discovered curious thing. Commands flagged with CMD_CLIENT_ID pass client ID through p2 .. WTF? Why does command "internals" mess with command parameters? I believe the proper way would be to pass the client id the same way the company ID is passed - through the "internal" mechanisms (CommandPacket). Perhaps even client ID could be used INSTEAD of company ID, commands would be executed as clients, not as companies.
:] don't worry, be happy and checkout my patches
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 39 guests