Replacing to different types of trains - almost done

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

mtlife
Engineer
Engineer
Posts: 19
Joined: 24 May 2005 15:53
Contact:

Post by mtlife »

i think A LOT of ppl want to use this :) (or am i the only one too lazy to replace 100 trains?)
User avatar
MadFrog
Engineer
Engineer
Posts: 68
Joined: 11 Sep 2005 12:30
Location: Finland

Post by MadFrog »

Great Patch! I was finally able to get OTTD compiled and add this patch :)
Has anyone made latest nightly compatible of it?

edit: fixed a small bug, trains wouldnt leave depot after track conversion for some reason... Don't know if I messed up with applying the patch first time , but at least now it's working ok with 0.4.0.1 :wink:
User avatar
MadFrog
Engineer
Engineer
Posts: 68
Joined: 11 Sep 2005 12:30
Location: Finland

Post by MadFrog »

Could someone post some info on using diff (creating .diff patches)?

And are there newer patches tackling the issue of transition from rail to monorail to maglev? I'm interested in making a patch to convert easily all tracks & trains, quite like the one they've made for TTDPatch.

To all the developers of OTTD, I'd like to say big thanks, this is one of my all time favourite games :D
User avatar
MadFrog
Engineer
Engineer
Posts: 68
Joined: 11 Sep 2005 12:30
Location: Finland

Post by MadFrog »

Ok, got TortoiseSVN up and running. Lets get to work :)
mtlife
Engineer
Engineer
Posts: 19
Joined: 24 May 2005 15:53
Contact:

Post by mtlife »

nice 1, cant wait
Psycho Dude
Engineer
Engineer
Posts: 4
Joined: 11 Sep 2005 14:30

Post by Psycho Dude »

mtlife wrote:i think A LOT of ppl want to use this :) (or am i the only one too lazy to replace 100 trains?)
100 is still "doable", but indeed, it aint a bad thing to have something like this lol :P. A great thanks for this patch, makes life so much easier :).
User avatar
MadFrog
Engineer
Engineer
Posts: 68
Joined: 11 Sep 2005 12:30
Location: Finland

Post by MadFrog »

Here's the .diff for (almost) latest nightly. Seems to work ok, at least for me :)
Attachments
Trainreplace_v2890.diff
(13.16 KiB) Downloaded 314 times
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Any chances uploading it to SF or directly to the trunk (with peter's or other kind developer's help)?
User avatar
MadFrog
Engineer
Engineer
Posts: 68
Joined: 11 Sep 2005 12:30
Location: Finland

Post by MadFrog »

Sure, allthough I dunno if everyone's allowed to upload their changes to trunk. Or how it's done... :lol:
User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

well, more than likely, you've have to write a patch, then submit it, and maybe if you are lucky, it will get intergrated into the trunk.
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]
User avatar
MadFrog
Engineer
Engineer
Posts: 68
Joined: 11 Sep 2005 12:30
Location: Finland

Post by MadFrog »

There's at least one bug, so I'll try and fix it first:

I noticed that when all the trains have been replaced, you can't clone them. Game thinks they're still trains, I guess, and so they can't be built in mono/maglev depots :lol:
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Is there any "make dirty" function for vehicles? I know there is one for tiles, the one for vehicles could be useful :roll:
Also check if all track-depending values of all wagons have been changed.
User avatar
MadFrog
Engineer
Engineer
Posts: 68
Joined: 11 Sep 2005 12:30
Location: Finland

Post by MadFrog »

I don't know about dirty-function. I was planning to check all values for wagons and trains, but I've had a lot of stuff going on at work, so haven't had time :( ...

Do you know has anyone done the 'all trains to depot'-button or anything like it? I thought I'd try to make a one button solution to converting to other track types. It could order all trains to depots, change them and convert track... Or just convert trains whereever they are :lol:
User avatar
MadFrog
Engineer
Engineer
Posts: 68
Joined: 11 Sep 2005 12:30
Location: Finland

Post by MadFrog »

Can someone please make this patch work with the latest nightly? Or give a hint how to make it work? I've tried to fix it, but there seems to be something that prevents it from working. Maybe the game has just changed too much. I've tried changing CmdReplaceVehicle in player.c, so that it doesn't check for engine types etc. but it just doesn't work :(

I just can't play OTTD without autoreplacing my trains to monorail/maglev ;)
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

MadFrog wrote:Can someone please make this patch work with the latest nightly? Or give a hint how to make it work? I've tried to fix it, but there seems to be something that prevents it from working. Maybe the game has just changed too much. I've tried changing CmdReplaceVehicle in player.c, so that it doesn't check for engine types etc. but it just doesn't work :(
MaybeReplaceVehicle() and ReplaceVehicle() have been completely redesigned to solve some major issues, so a patch like this one will need some work to apply. Also another reason why you fail is that this patch exploited a bug in the build command and needless to say we fixed that bug. We decided long ago that this patch is not the solution to this problem.
MadFrog wrote:I just can't play OTTD without autoreplacing my trains to monorail/maglev ;)
tough luck. Try to find a solution that will work without exploiting bugs
User avatar
MadFrog
Engineer
Engineer
Posts: 68
Joined: 11 Sep 2005 12:30
Location: Finland

Post by MadFrog »

Yeah, I was just hoping for a quick and dirty hack solution to do this while there is no other patch yet. Of course with a little effort one could probably come up with a good way of doing the replacement...
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

MadFrog wrote:Yeah, I was just hoping for a quick and dirty hack solution to do this while there is no other patch yet. Of course with a little effort one could probably come up with a good way of doing the replacement...
we don't use dirty hacks. It will be easier to actually make a real solution for this and get it added to the trunk so it just works in the future.
User avatar
MadFrog
Engineer
Engineer
Posts: 68
Joined: 11 Sep 2005 12:30
Location: Finland

Post by MadFrog »

I know that would be the right way to do it. I was just looking for a quick solution for my self. And tinkering with this patch is a good way for me to get to know how the game works :lol:

So Im not trying to get this patch into trunk as we've discussed before. Obviously, it'd have to be done right, if it's to be added to game permanently.
User avatar
Born Acorn
Tycoon
Tycoon
Posts: 7596
Joined: 10 Dec 2002 20:36
Skype: bornacorn
Location: Wrexham, Wales
Contact:

Post by Born Acorn »

I think the easiest (not the easiest, but the simplest logically) way to do it would be "multistop" style train depots, so two depots next to each other are treated as one, even if different types, allowing replacing of trains into monorail/maglev. The train goes into its depot, is sold, and the maglev train next door comes out.
Image
User avatar
MadFrog
Engineer
Engineer
Posts: 68
Joined: 11 Sep 2005 12:30
Location: Finland

Post by MadFrog »

Well... The thing is, we want to:
1) Save the train info (route, cargo etc.)
2) Sell the train
3) Buy a mono/maglev

So the problem now is, we cannot build the train in the same depot. And also the train info would have to be saved somewhere. This patch just changes one bit of info in the train, and voila, its maglev. This is not good because its hacky and ugly.

Building multistop depots might be the answer, but I'm not sure it would be feasible codewise. And it might not be very usable, either, maybe. Consider making all your depots multistop just for a quick change of all vehicles to the next type.

I think a nice solution might be one, where you could change depots into other types and trains inside would be sold (maybe confirmed first) and then new vehicles of the converted type (selected from a list or whatever) would be bought automatically. This would allow all the rail to be converted at one time (tell trains to go to depots, convert all rail, including depots and automatically sell/buy trains). I have a hunch this has been suggested before, but just my opinion... :roll:
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 3 guests