Aircraft queueing & planespeed
Moderator: OpenTTD Developers
Yeah - apparently at 1000+ MPH @ x8 speeds, the landing is barely a couple of cycles of the game loop, and that throws everything out of whack.about the bug with concorde landing to fast and taxying above runway (if it's what xyz was talking about),
I'm implementing a couple of solutions:
a) Clamping the aircraft to the correct height when it lands.
b) Decreasing the speed of the aircraft as it approaches the airport. It's silly & unrealistic for the aircraft to go from 1000 MPH to a stop in the blink of an eye.
Excellent idea! Start a new thread for this, though: Although I love the idea, that's not part of the purpose of my patch. I may, however, take a look into this if I have time.i'v just got an idea:
is it posible to put a "open/close aeroport" button that will keep all the airplains in the queue. this will be usefull when updating the aeroports.
Gotta remember when creating language packs that the europeans use "aeroport," and Americans use "airport."
Hmm, it seems you're correct. Fixed.multiply by _patches.aircraft_speed_coeff isn't needed 'cause v->max_speed isn't modified by your patch.
Not really. Other than the holding pattern, it should be the same as the unpatched OpenTTD, which already has this in place.If you're interested by having plane altitude depending of it's current speed
The original code is:
Code: Select all
switch (v->max_speed) {
case 37: return 162;
case 74: return 171;
default: return 180;
Edit: I've uploaded my changes. The supersonic aircraft should now slow down to subsonic before entering the landing sequence, and landed aircraft should be forced to ground level.
"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
Another update - and I'm thinking about doing as a summer project (after the current college semester is over) some more major changes, based upon my experiences with playing Falcon 4.0: Allied Force.
If you've never experienced Falcon 4.0: AF's campaign engine, and you are a flight/combat sim enthusiast - you don't know what you're missing . This isn't the canned missions of most other flight sims: In AF, the computer is simulating an actual war, and generates missions to accomplish its goals. Each and every plane, vehicle, etc is on a mission trying to accomplish something.
IMHO, they model the the landing system of a real airport quite well - the aircraft controllers give me directions, and since I'm not the only plane landing (I'm part of a real simulated war), they'll have me land as part of a sequence & stuff. I may attempt to duplicate that in future versions of the patch.
Anyways, I needed to do an update of the patch, because the devs decided to completely rework part of the patch UI. This will affect *everybody's* patches, BTW - so if you made a patch, update it!!
If you've never experienced Falcon 4.0: AF's campaign engine, and you are a flight/combat sim enthusiast - you don't know what you're missing . This isn't the canned missions of most other flight sims: In AF, the computer is simulating an actual war, and generates missions to accomplish its goals. Each and every plane, vehicle, etc is on a mission trying to accomplish something.
IMHO, they model the the landing system of a real airport quite well - the aircraft controllers give me directions, and since I'm not the only plane landing (I'm part of a real simulated war), they'll have me land as part of a sequence & stuff. I may attempt to duplicate that in future versions of the patch.
Anyways, I needed to do an update of the patch, because the devs decided to completely rework part of the patch UI. This will affect *everybody's* patches, BTW - so if you made a patch, update it!!
"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
The patch is designed to work with the current SVN, which recently added that file. It will not work with the currently released 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
They changed the way patches work again - and fixed the problem with a bunch of hardcoded numbers . Patch updated to reflect that.
"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
Hi,
I found some bugs in your patch. Four times I think you've put code inside an assert(), which is a big no-no, as everything inside an assert will be completely striped out in a release build. Asserts must never contain actual code, only debugging aids. As it stands right now, only debug builds are working correctly.
-- Michael Lutz
I found some bugs in your patch. Four times I think you've put code inside an assert(), which is a big no-no, as everything inside an assert will be completely striped out in a release build. Asserts must never contain actual code, only debugging aids. As it stands right now, only debug builds are working correctly.
-- Michael Lutz
I can only find three:
assert(st->airport_queue->push(st->airport_queue, v)); //near aircraft_cmd.c:900
assert(st->airport_queue->push(st->airport_queue, v)); //near aircraft_cmd.c:1670
assert(st->helicopter_queue->push(st->helicopter_queue, v)); //near aircraft_cmd.c:1675
And yes, that is absolutely broken. My version of the C library has #define assert(x) ((void)0) in non-debug builds. Other versions probably use similar constructs.
Either (1) implement and use verify:
or (2) move the queue manipulations outside the assert.
assert(st->airport_queue->push(st->airport_queue, v)); //near aircraft_cmd.c:900
assert(st->airport_queue->push(st->airport_queue, v)); //near aircraft_cmd.c:1670
assert(st->helicopter_queue->push(st->helicopter_queue, v)); //near aircraft_cmd.c:1675
And yes, that is absolutely broken. My version of the C library has #define assert(x) ((void)0) in non-debug builds. Other versions probably use similar constructs.
Either (1) implement and use verify:
Code: Select all
#ifdef _DEBUG // IIRC, _DEBUG is #defined only for debug builds. If that's not the case, use the appropriate symbol.
#define verify(x) assert(x)
#else
#define verify(x) (x)
#endif
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
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Hi Cobra - can you make sure your patch is up to date with current SVN, and I'll add it to the Integrated Nightly build. Thanks.
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
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
Code: Select all
if (u->type == VEH_Aircraft) {
/* Take out of airport queue
*/
if(u->queue_item != NULL)
{
v->queue_item->queue->del(v->queue_item->queue, v);
}
}
Sorry that I haven't been working on my patch. I've been working on other stuff, and just don't have the time. Perhaps in a few months I may get back to working on the patch again, but for now I won't be working on it.
"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
Alright, looks like everybody wants it in the nightlies.
I've taken a bit of time to fix the assertions and the uv problems, and updated it for the latest SVN.
Other than that, no changes.
My idea of redoing the landing sequence, alas, won't come to be this year, as I've been busy with other projects.
I've taken a bit of time to fix the assertions and the uv problems, and updated it for the latest SVN.
Other than that, no changes.
My idea of redoing the landing sequence, alas, won't come to be this year, as I've been busy with other projects.
"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
I need help merging some changes (this is the MiniIN code - MiniIn players rejoice, I am working on it!):
I can't really see what they're doing, it seems like the code's changed pretty radically - suggestions?
Code: Select all
<<<<<<< .mine
case OT_LOADING:
SetDParam(0, v->current_order.station);
SetDParam(1, v->cur_speed * 8 / _patches.aircraft_speed_coeff);
str = STR_882F_LOADING_UNLOADING;
break;
=======
case OT_LOADING: {
// Vehicle window displays the amount loaded and total capacity while loading in a station
const Vehicle *u;
uint16 cargo_count=0, cargo_cap=0;
>>>>>>> .theirs
u = v->next;
cargo_count = v->cargo_count + u->cargo_count;
cargo_cap = v->cargo_cap + u->cargo_cap;
if (cargo_count == 0 && !(v->current_order.flags & OF_FULL_LOAD)) {
// Total cargo = 0 and order for current station is not Full Load means we're unloading
str = STR_VEHICLE_UNLOADING;
} else {
str = STR_VEHICLE_LOADING;
if (cargo_count > 0) {
// common notation (cargo_count/cargo_cap)*100 won't work because uint16/uint16 returns a uint16
// making the display show either 0% or 100%
SetDParam(0, ((cargo_count*100)/cargo_cap));
} else {
// Can't divide by zero. This shouldn't happen, but in case it does... display 0%
// if total capacity is 0.
SetDParam(0, 0);
}
}
break;
}
"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
i have no idea from where you fetched that code.
i'll take a look at miniIN diffs and i hope i can finde something.
Next time please write somewhere where you get that code from, that will help a lot i found the part, at least i hope i found the right. Is aircraft_gui.c right?
I'll add the code in some minutes
edit1:
so here it is:
the strings to display are:
But you use
which has no params, but you set two by using SetDParam.
So i can't give yome help here without any further code. For me it looks like the two "SetDParam..." lines are never used, they got set, right but no lang string requires them as far as i can see
to your question about merging
some edits:
btw your code is outdated, you need to update your miniIN working copy
i'll take a look at miniIN diffs and i hope i can finde something.
Next time please write somewhere where you get that code from, that will help a lot i found the part, at least i hope i found the right. Is aircraft_gui.c right?
I'll add the code in some minutes
edit1:
so here it is:
the strings to display are:
Code: Select all
STR_VEHICLE_LOADING :{LTBLUE}Loading {NUM}%
STR_VEHICLE_UNLOADING :{LTBLUE}Unloading
STR_VEHICLE_DEPARTING :{LTBLUE}Departing
Code: Select all
STR_882F_LOADING_UNLOADING :{LTBLUE}Loading / Unloading
So i can't give yome help here without any further code. For me it looks like the two "SetDParam..." lines are never used, they got set, right but no lang string requires them as far as i can see
to your question about merging
Code: Select all
....
// Can't divide by zero. This shouldn't happen, but in case it does... display 0%
// if total capacity is 0.
SetDParam(0, 0);
}
SetDParam(0, v->current_order.station);
SetDParam(1, v->cur_speed * 8 / _patches.aircraft_speed_coeff);
}
break;
}
btw your code is outdated, you need to update your miniIN working copy
Last edited by gigajum on 26 Jun 2006 04:32, edited 5 times in total.
Alright, looks like you're right.
The second parameter is the aircraft's speed indicator, which is carelessley copied from the other case statements, even though it isn't used in this particular string.
Thanks for pointing that out, it'll need to be fixed in both the MiniIN and the trunk patches.
More than likely, I can just dump my code and use theirs - it looks like I don't need any modifications for that section of code.
In addition, I finally got the MiniIN code to compile, so I'm going to create a new savegame with an intercontinential airport for testing my patch with.
I hope now to see what the problem is with the largest airport, and should have a MiniIN patch available soon.
EDIT: MiniIN Patch is here! Attached to this post.
The second parameter is the aircraft's speed indicator, which is carelessley copied from the other case statements, even though it isn't used in this particular string.
Thanks for pointing that out, it'll need to be fixed in both the MiniIN and the trunk patches.
More than likely, I can just dump my code and use theirs - it looks like I don't need any modifications for that section of code.
In addition, I finally got the MiniIN code to compile, so I'm going to create a new savegame with an intercontinential airport for testing my patch with.
I know, I'll do that also now that I can finish editing my patch.btw your code is outdated, you need to update your miniIN working copy
I hope now to see what the problem is with the largest airport, and should have a MiniIN patch available soon.
EDIT: MiniIN Patch is here! Attached to this post.
- Attachments
-
- queue_MiniIN.patch
- (46.03 KiB) Downloaded 462 times
Last edited by CobraA1 on 10 Aug 2006 20:31, edited 4 times in total.
"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
Thanks CobraA1. Ive not checked it with the Intercontinental, but have definitely got problems with the Helistation. The helicopters stop in mid air someway short of the helistation, never to proceed further.CobraA1 wrote:I hope now to see what the problem is with the largest airport, and should have a MiniIN patch available soon.
EDIT: MiniIN Patch is here! Attached to this post.
Also, your settings vars need to be CONDVARs with the min version number of 35; in vehicle.c you also need to update the min/max version numbers to be 0..34, and 35..SL_MAX_VERSION.
At the mo, I'll hold fire uploading this, as it definitely breaks the helistations. Any chance of an update? Thanks.
- Attachments
-
- vehicle.c
- Vehicle.c with the changes I think are needed to maintain saveload.
- (73.59 KiB) Downloaded 320 times
-
- settings.c
- My update to the settings.c file with queueing in.
- (79.97 KiB) Downloaded 331 times
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
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
Who is online
Users browsing this forum: No registered users and 38 guests