Aircraft queueing & planespeed

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

Post Reply
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

I'm baack!!

With an update for the patch :).

I haven't tested it, but I just got it to compile again, no errors.

Now that I've moved to a new computer, re-installed Windows and MSVC, I'm finally back to keep it updated.

College is in full swing, so keeping it updated for SVN is pretty much all I can do now.

The first post contains the updated files now, enjoy.
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

Updated for SVN again - this time, with a new version of TourtiseSVN.

In any case, I'll probably be back to updating the patch weekly. Until a real developer gets sick of this thread popping up and integrates it into the nightlies, lol.
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
Vidar
Engineer
Engineer
Posts: 40
Joined: 11 Apr 2005 15:17
Location: The Netherlands

Post by Vidar »

I really think your patch is great, so I'm using it for a while now. I only made a small adjustment that makes planes slow down when they approach their destination. That's what makes it open source, right?

There is however a small bug in your patch. When choppers are on a queue to a platform and you decide te replace them by the new model by sending them to a hangar. They are unable to land on an airport. They just keep circling around. The other choppers assigned to the platform are also unable to land. So the first chopper stays in the current queue for the platform and blocks the other choppers while unable to enter the queue for the airport. It's your patch, so I didn't want to mess around with it, but hopefully this information will help you remove this bug.
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

I only made a small adjustment that makes planes slow down when they approach their destination. That's what makes it open source, right?
Yup, that's the beauty of open source :). Feel free to modify it.

The patch should already slow down aircraft automatically under certain conditions.

I'll see what I can do to improve it further. Feel free to show us your modifications, BTW. Perhaps we can all benefit :).
There is however a small bug in your patch. When choppers are on a queue to a platform and you decide te replace them by the new model by sending them to a hangar. They are unable to land on an airport. They just keep circling around. The other choppers assigned to the platform are also unable to land.
OK, yeah, I have to account for whenever something leaves the queue, and I guess I didn't account for that. I'll try to get it fixed in the next release of my patch.

Edit: The bug is reprodicible, so I should be able to fix it easily, when I get time.
It's your patch, so I didn't want to mess around with it
By all means, don't be afraid to mess around. It is, after all, open source :).
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
Cairan
Engineer
Engineer
Posts: 1
Joined: 22 Oct 2005 13:10
Location: Reykjavik, Iceland

Post by Cairan »

One thing which would be neat and interesting is the skipping of the queue for broken airplanes... When you see smoke starting to trail your aircraft, in real life you usualy request priority to land... So, it would be interesting to have airplanes which are in broken status to either skip the landing queue and/or land at the nearest/least congested field, go to the airport hangar and resume their flight...
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

Sounds like a good idea - is checking if (breakdown_ctr > 0) the correct way to check for breakdowns?
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Code: Select all

if (v->vehstatus&VS_AIRCRAFT_BROKEN) {
}
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

I've put some code in to put broken aircraft at the end of the queue and it works - BUT - it's best used with reduced breakdowns or without long queues. Otherwise, the problem the queue is designed to correct reappears: Aircraft that are breaking down hog the queue, at the expense of all other aircraft, including other broken ones. I think I'll make it optional for now, and see what I can do to come up with a better solution I can implement.
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

I've just submitted what I have so far. Not much time to work on it lately.
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

Updated for CVS. Now has option to send broken aircraft to the front of the queue - but it's optional because it tends to break what it was originally designed to fix! Especially without reduced breakdowns, some aircraft don't get a chance to land. Defaults to off.

And - I'm kinda dissapointed - it seems that the devs don't pay much attention to it. I know it's a popular patch; every time I update it and reset the download counters, I get a bunch of downloads.
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
egladil
OpenTTD Developer
OpenTTD Developer
Posts: 188
Joined: 07 Nov 2005 17:10
Location: Sweden

Post by egladil »

You are doing multiple typedefs of VehicleQueue in queue.h. This causes the build to fail. This particular message is when compiling on OS X. A similar message appears when compiling on linux (but in aircraft_cmd.c instead of cocoa_v.m since cocoa_v.m is only compiled on OS X.) I suggest you fix that. Also, the function declaration warning below should be resolved. Just add void inside the parameter list. ( VehicleQueue *new_VQueue(void); )

Code: Select all

In file included from video/../aystar.h:14,
                 from video/../player.h:6,
                 from video/../network.h:10,
                 from video/cocoa_v.m:61:
video/../queue.h:262: error: redefinition of typedef 'VehicleQueue'
video/../queue.h:221: error: previous declaration of 'VehicleQueue' was here
video/../queue.h:289: warning: function declaration isn't a prototype
Also, the OS X build fails with the error "!Disconnected train" when running it. The linux build didn't though.
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

Thanks for catching that :). I only compile in Windows right now, and MSVC seems to be a bit more forgiving than Linux and Mac OS X.

Fixed.
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
egladil
OpenTTD Developer
OpenTTD Developer
Posts: 188
Joined: 07 Nov 2005 17:10
Location: Sweden

Post by egladil »

Another thing. You add some new and change the type of some existing members in the vehicle struct. But you haven't updated the save/load code to reflect those changes. See the declaration of _common_veh_desc in vehicle.c.

Also, in InitializeVehicle you set v->u.air.desired_speed to one, without knowing if this is an aircraft or not. This might cause problems if the vehicle is not an aircraft and whatever type it is uses this position in memory. You can take a look at my yellow signals patch for how I initialize a similiar thing for trains.
Last edited by egladil on 09 Jan 2006 12:41, edited 2 times in total.
Moriarty
Tycoon
Tycoon
Posts: 1395
Joined: 12 Jun 2004 00:37
Location: United Kingdom of Great Britain and Northern Ireland
Contact:

Post by Moriarty »

And - I'm kinda dissapointed - it seems that the devs don't pay much attention to it. I know it's a popular patch; every time I update it and reset the download counters, I get a bunch of downloads.
I believe the solution to this is to chase the devs up on IRC and get them to evaluate it.
User avatar
LordOfThePigs
Route Supervisor
Route Supervisor
Posts: 435
Joined: 01 Jul 2004 10:28
Location: Jura/Switzerland

Post by LordOfThePigs »

CobraA1 wrote:And - I'm kinda dissapointed - it seems that the devs don't pay much attention to it. I know it's a popular patch; every time I update it and reset the download counters, I get a bunch of downloads.
I know how you feel ;)
Sometimes I'm told "Brilliant"...
Sometimes I'm told "Charming"...
And Often I'm told "Shut Up"!
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

Aack - you're right. Completely forgot that Union = shared memory space. Another artifact from the TTD days, when memory was limited.

I've moved it into the proper place now - when the aircraft is built.

Yeah, I was afraid to adjust the save file stuff. I've made some adjustments, but you'll have to check it to see if I did it properly. The savegame stuff seems a bit cryptic to me.

I've updated the patch.

edit: *groan* the savegame changes I made totally messed it up :(. It doen't load the title screen savegame now.

Renaming the title screen file works. I can't seem to figure out if OpenTTD has support for loading/saving different versions of savegames, though.
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
User avatar
Smoky555
Engineer
Engineer
Posts: 97
Joined: 06 Jan 2005 05:22
Location: Russia, Volgograd
Contact:

Post by Smoky555 »

I get error after applying this patch on 3393 SVN :(
Attachments
errr.JPG
errr.JPG (23.9 KiB) Viewed 6185 times
User avatar
Smoky555
Engineer
Engineer
Posts: 97
Joined: 06 Jan 2005 05:22
Location: Russia, Volgograd
Contact:

Post by Smoky555 »

Cobra, can you devide your patch and write a small patch only for aircraft speed?
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

It appears my changes to the savegame code have caused problems . . .

I'll think about what to do about it. It's possible I just might take out the changes to the savegame stuff until I can better understand it.

The aircraft speed stuff is a bit intertwined with the rest of the code, I'm afraid, as the aircraft queueing stuff need to be able to control the speed of the aircraft for various reasons. Still, I'll consider the proposal to create a separate patch.
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

Updated for SVN.
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 6 guests