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

Hazelrah
Traffic Manager
Traffic Manager
Posts: 196
Joined: 13 Apr 2005 05:41

Post by Hazelrah »

CobraA1,

I hope you've just hit a busy spell and haven't given up on this patch's inclusion into the MiniIN!

I just wanted to let you know that I've added your patch on the MiniIN wiki page under the " Likely to be added if updated by author" section. Due to richk67's posts in this topic, I'm pretty sure that's the case.

Good luck!

-Hazelrah
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

I dunno what's wrong with those helicopters :(. I just can't think of what could cause that.

Other than that, the patch should work fine.
"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
AlexH.
Engineer
Engineer
Posts: 24
Joined: 29 Jul 2006 00:35
Location: Northern Poland
Contact:

Post by AlexH. »

I just wanted to let you know that I've added your patch on the MiniIN wiki page under the " Likely to be added if updated by author" section.
It looks that there it already added, with note saying: "updated to 4000+. awaiting confirmation it is current". I have removed that entry, leaving yours.
I ride the sky, I rule the night
Till I am free, with sword and sorcery.
The gods look down, hear battle sound.
I carry on, until the fight is won
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

It's updated now.
"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
AlexH.
Engineer
Engineer
Posts: 24
Joined: 29 Jul 2006 00:35
Location: Northern Poland
Contact:

Post by AlexH. »

Works perfectly!
Very nice is regulation of plane speed, from default to realistic. I didn't found also any errors while using helicopters and helipads. Unfortunately patch corrupts while trying to update MiniIN to latest build (5688). Under r5656 is ok.
I ride the sky, I rule the night
Till I am free, with sword and sorcery.
The gods look down, hear battle sound.
I carry on, until the fight is won
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

Umm, I didn't fix the helicopter stuff, as I never figured what the exact problem was. Perhaps it was not my patch? Not sure.

The latest conflict is due to them lagging behind the trunk, which had a conflict to resolve. I will release an update soon.

Edit: I resolved the conflicts and uploaded a new version of the patch for MiniIN.
"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
AlexH.
Engineer
Engineer
Posts: 24
Joined: 29 Jul 2006 00:35
Location: Northern Poland
Contact:

Post by AlexH. »

No? My helicopters flew without problems, maybe something will happen later... hope no :)
I ride the sky, I rule the night
Till I am free, with sword and sorcery.
The gods look down, hear battle sound.
I carry on, until the fight is won
richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Post by richk67 »

OK I'll take another look, but maybe not for a couple of days. (busy)

CobraA1: can you post a link to your patch, or the full MiniIN patch in the MiniIN TODO topic in Suggestions? Just helps keep me organised ;)
OTTD NewGRF_ports. Add an airport design via newgrf.Superceded by Yexo's NewGrf Airports 2
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
User avatar
AlexH.
Engineer
Engineer
Posts: 24
Joined: 29 Jul 2006 00:35
Location: Northern Poland
Contact:

Post by AlexH. »

Oops - there is too many options in Vehicles panel and buttons for your patch are unclickable, the only way to modify coeff is to edit openttd.cfg file
I ride the sky, I rule the night
Till I am free, with sword and sorcery.
The gods look down, hear battle sound.
I carry on, until the fight is won
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

Oh dear, it appears as time goes on, the number of troubles with my patch only increases :(. I don't have much time, but I'll see what I can do.
"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
AlexH.
Engineer
Engineer
Posts: 24
Joined: 29 Jul 2006 00:35
Location: Northern Poland
Contact:

Post by AlexH. »

There is another issue - when on a long route plane breaks down, it immediately blocks whole airport, as it comes in front of landing queue. Maybe enable moving broken planes in front of the queue only when they circle above airport?
I ride the sky, I rule the night
Till I am free, with sword and sorcery.
The gods look down, hear battle sound.
I carry on, until the fight is won
User avatar
Aracirion
Traffic Manager
Traffic Manager
Posts: 241
Joined: 15 Jan 2006 15:15
Contact:

Post by Aracirion »

couldn't broken-down planes be directed to the nearest airport, instead of finishing their whole journey half-speed? That would be more realistic as well as more convenient ...
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

ok, fixed the saveload stuff, pointed the wiki to the correct place to find the MiniIN patch, added a link to the thread, fixed the size of the patches box, added to the TODO thread after some searching, etc etc, so hope things are OK now.


Aracirion: Personally, I leave "Give priority to broken aircraft" (in the stations section of the patches) turned off. Personally, I don't use it, and it's mostly there for people who like it. Aircraft simply break down too predictably and too often for this to really be realistic.

Also, I'm not sure if there's any code in place to locate the nearest airport? If not, then writing such a thing would be non-trivial, and I don't really have much time for large code changes right now.
"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
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

CobraA1 wrote:Also, I'm not sure if there's any code in place to locate the nearest airport? If not, then writing such a thing would be non-trivial, and I don't really have much time for large code changes right now.
It seems to me like it should be pretty easy:
(In something that vaguely resembles C)

Code: Select all

int mindist=INT_MAX,curdist
stationID closest=NO_STATION
foreach(station st in stations){
    if(!has_airport(st))continue;
    curdist=/*Insert distance function here. I might use Manhattan distance (x+y) since it's notably faster than Euclidean, and because TTD uses (AIUI) 3-3-4 "right" triangles*/;
    if(curdist<mindist){
        closest=GetStationID(st);
        mindist=curdist;
    }
}
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

ok, well, here's what really has to happen:

-The broken aircraft has to be detected (very easy, it's just a flag)
-The nearest hangar has to be found that supports the condition that the airport the hangar is at must accept aircraft (not just helicopters)
-The aircraft's current command must be changed to head to the hangar
-The aircraft must be taken out of any queues it belongs to
"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
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

CobraA1 wrote:-The nearest hangar
If you want to be that picky, what you're interested in is, for planes, distance from plane to runway start to runway end to hangar, and, for choppers, distance from chopper to landing point to hangar. But I figure that the XY of the station sign ought to be a close enough approximation.
CobraA1 wrote:has to be found that supports the condition that the airport the hangar is at must accept aircraft (not just helicopters)
So you check the airport type after checking whether the station has an airport. I'm not at all familiar with that part of the code, but I am under the impression that this should be relatively simple; an if cascade on the is_chopper() and is_large() results, and nested in there, an if(airport_type() <has appropriate value>).

Oh, you have to check ownership too.
CobraA1 wrote:-The aircraft's current command must be changed to head to the hangar
Hmm... No clue here. It doesn't seem like it ought to be that hard, but I've got no conclusion to "I know it's already implemented because ..."
CobraA1 wrote:-The aircraft must be taken out of any queues it belongs to
I know you already have code to do this, as you have to do that anyway whenever the user changes the plane's orders.

But yes, I did substantially oversimplify it.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

If you want to be that picky
I realized I have to be - after all, if the plane has broken down, it needs to be fixed, and the place to fix a plane is at a hangar.

I'll take a look, I guess it's doable.
"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
Aracirion
Traffic Manager
Traffic Manager
Posts: 241
Joined: 15 Jan 2006 15:15
Contact:

Post by Aracirion »

CobraA1 wrote:I'll take a look, I guess it's doable.
oh wow that would be cool .. .I didnt want to give you a lot of work :roll: just wanted to make a suggestion I had thought of sometime ... there was plenty of time to think about it while watching my broken-down planes limp to their original destination .....
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

Turns out that's the easy part - there's built in functions for that kind of stuff.

The most difficult task seems to be sending the aircraft to the new depot - the command is stuck into the GUI interface, and not very accessible from code.
"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
Luckz
Engineer
Engineer
Posts: 20
Joined: 02 Aug 2006 03:48
Location: CGN / VLN

Post by Luckz »

DaleStan wrote:
CobraA1 wrote:has to be found that supports the condition that the airport the hangar is at must accept aircraft (not just helicopters)
So you check the airport type after checking whether the station has an airport. I'm not at all familiar with that part of the code, but I am under the impression that this should be relatively simple; an if cascade on the is_chopper() and is_large() results, and nested in there, an if(airport_type() <has appropriate value>).

Oh, you have to check ownership too.
..and keep in mind that you might be allowed to use stations you don't own.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 0 guests