Patch: Build and Refit
Moderator: OpenTTD Developers
Re: Patch: Build and Refit
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.
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.
Who is John Galt?
Re: Patch: Build and Refit
New version in first post.
If you are just viewing the list of vehicles (available vehicles), the buy and refit button is hidden.
If you are just viewing the list of vehicles (available vehicles), the buy and refit button is hidden.
- Vaulter
- Traffic Manager
- Posts: 185
- Joined: 21 Dec 2004 05:35
- Skype: andrey-zaharov
- Location: St. Petersburg, Russia
- Contact:
Re: Patch: Build and Refit
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!
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
Re: Patch: Build and Refit
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
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Patch: Build and Refit
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
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
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
-
- Tycoon
- Posts: 2781
- Joined: 22 Feb 2011 18:34
Re: Patch: Build and Refit
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
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Patch: Build and Refit
Either that or a modification of the existing build command. But neither is done.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?
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: Patch: Build and Refit
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.
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
Who is online
Users browsing this forum: No registered users and 39 guests