Patch: Upgrade airports
Moderator: OpenTTD Developers
Patch: Upgrade airports
Hi,
I've made a patch that allows airports to be upgraded, that is, it allows to replace an airport in a station with another. It works much like railroad stations: you build a station over an existing one and the old one gets demolished. Specifically, to use this patch you must select an airport to be built and place it overlapping (partially or totally) an existing one, which will be removed and replaced atomically. The usual restrictions apply, so you must be on good terms with the local authority, the tiles to be used must be clear (except those belonging to the old airport), etc.
The advantages of this patch are:
- Easier interface: fewer clicks for the same job.
- Atomicity: the town no longer has a chance to build roads or buildings between removal and rebuilding of an airport (very annoying).
- Local authority ratings are checked before execution starts, so you won't find that you've demolished an airport and now the town authority doesn't allow you to replace it (nor to rebuild the old one).
I've found another patch to this same end, but it's a bit old and no longer applies cleanly against trunk (and it seemed to have some problems), so I've coded a new one.
This patch can be coupled with my airport-close patch for easiest replacing of airports.
----------------
EDIT: Current status:
Patches against: 0.6.0 | 0.6.1 | 0.7.0 | 0.7.[1-5] | 1.0.x | r24355
I've made a patch that allows airports to be upgraded, that is, it allows to replace an airport in a station with another. It works much like railroad stations: you build a station over an existing one and the old one gets demolished. Specifically, to use this patch you must select an airport to be built and place it overlapping (partially or totally) an existing one, which will be removed and replaced atomically. The usual restrictions apply, so you must be on good terms with the local authority, the tiles to be used must be clear (except those belonging to the old airport), etc.
The advantages of this patch are:
- Easier interface: fewer clicks for the same job.
- Atomicity: the town no longer has a chance to build roads or buildings between removal and rebuilding of an airport (very annoying).
- Local authority ratings are checked before execution starts, so you won't find that you've demolished an airport and now the town authority doesn't allow you to replace it (nor to rebuild the old one).
I've found another patch to this same end, but it's a bit old and no longer applies cleanly against trunk (and it seemed to have some problems), so I've coded a new one.
This patch can be coupled with my airport-close patch for easiest replacing of airports.
----------------
EDIT: Current status:
Patches against: 0.6.0 | 0.6.1 | 0.7.0 | 0.7.[1-5] | 1.0.x | r24355
- Attachments
-
- airport-upgrade-r11927.patch
- (8.73 KiB) Downloaded 1603 times
Last edited by cirdan on 27 Jun 2012 18:22, edited 13 times in total.
Re: Patch: Upgrade airports
Good idea for a patch
Also, I have noted one thing regarding the coding style:
When you use comment as documentation comment for the function, start it with two "*" signs - this mean that it is comment for doxygen. Also, you can use special doxygen tags in the comment, like @param or @return to comment on function parameter or return value. So that piece of code should look rather somewhat like this:
Or even worse - your competitor in multiplayer or singleplayer (AI) can interfere with constructioncirdan wrote: - Atomicity: the town no longer has a chance to build roads or buildings between removal and rebuilding of an airport (very annoying).
Also, I have noted one thing regarding the coding style:
Code: Select all
/* Checks if an airport can be removed (no aircraft on it or landing) */
/* Returns cost on success, else an error */
static CommandCost CanRemoveAirport(Station *st, uint32 flags)
Code: Select all
/** Checks if an airport can be removed (no aircraft on it or landing)
* @param st Station to check
* @param flags ... the flags are explained here ....
* @return the cost in case of success, or an error code if it failed.
*/
static CommandCost CanRemoveAirport(Station *st, uint32 flags)
If you need something, do it yourself or it will be never done.
My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility
Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility
Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
Re: Patch: Upgrade airports
I don't usually play multiplayer, let alone with the AI, so I hadn't thought of that.Bilbo wrote:Good idea for a patch
Or even worse - your competitor in multiplayer or singleplayer (AI) can interfere with constructioncirdan wrote: - Atomicity: the town no longer has a chance to build roads or buildings between removal and rebuilding of an airport (very annoying).
My plan was to ignore documentation until I got a dev's attention, and hope no one would notice...Bilbo wrote:Also, I have noted one thing regarding the coding style:Code: Select all
/* Checks if an airport can be removed (no aircraft on it or landing) */ /* Returns cost on success, else an error */ static CommandCost CanRemoveAirport(Station *st, uint32 flags)
Seriously, thanks for the suggestion. The attached version has the comment ammended.
- Attachments
-
- airport-upgrade-r11947.patch
- (8.82 KiB) Downloaded 751 times
Re: Patch: Upgrade airports
Nice patch, cirdan, keep up the good work.
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Re: Patch: Upgrade airports
Updated against 0.6.0.
- Attachments
-
- airport-upgrade-0.6.0.patch
- (9.42 KiB) Downloaded 1220 times
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Patch: Upgrade airports
Okay, I'd like to drop a line . Any chance for current trunk?
It might be a nice addition to wwottdgd. Close airports is an essential and this might nicely complement it; closing works with the changes I made and posted in the relevant thread , but this not so far
It might be a nice addition to wwottdgd. Close airports is an essential and this might nicely complement it; closing works with the changes I made and posted in the relevant thread , but this not so far
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: Upgrade airports
Happy to oblige.
Note that the airport code has undergone some serious changes lately (to allow for noise-dependent maximum number of airports), so this patch may not be as stable as the last one. Please do report any bugs found.
Note that the airport code has undergone some serious changes lately (to allow for noise-dependent maximum number of airports), so this patch may not be as stable as the last one. Please do report any bugs found.
- Attachments
-
- airport-upgrade-v6-r13232.patch
- (10.3 KiB) Downloaded 633 times
Re: Patch: Upgrade airports
Patches against 0.6.1 and r13374.
- Attachments
-
- airport-upgrade-v6-0.6.1.patch
- (9.27 KiB) Downloaded 918 times
-
- airport-upgrade-v6-r13374.patch
- (10.26 KiB) Downloaded 805 times
Re: Patch: Upgrade airports
Rebased against r14876, to make up for recent changes in the code (and over 7 months without an update).
- Attachments
-
- airport-upgrade-v6-r14876.patch
- (10.25 KiB) Downloaded 670 times
-
- Tycoon
- Posts: 1395
- Joined: 12 Jun 2004 00:37
- Location: United Kingdom of Great Britain and Northern Ireland
- Contact:
Re: Patch: Upgrade airports
Any reason this hasn't found its way into trunk? It's requested fairly often.
Re: Patch: Upgrade airports
Almost forgot to mention.
Patched this into a clean trunk followed by close airport... try to upgrade an airport to a larger one, and get the error 'Too close to an other airport'
Patched this into a clean trunk followed by close airport... try to upgrade an airport to a larger one, and get the error 'Too close to an other airport'
-
- Chief Executive
- Posts: 697
- Joined: 10 Jun 2003 00:19
- Location: Australia
Re: Patch: Upgrade airports
The obvious questions are:
1) Does this happen if you don't patch with close airport.
2) Is there actually another airport that's too close?
1) Does this happen if you don't patch with close airport.
2) Is there actually another airport that's too close?
Re: Patch: Upgrade airports
1: Yes
2: No
I started a new game, placed small airport, attempt to upgrade, 'Too close to another airport'
2: No
I started a new game, placed small airport, attempt to upgrade, 'Too close to another airport'
Re: Patch: Upgrade airports
You didn't answer question 1:
In other words, does the problem exist in trunk or in the patch?Conditional Zenith wrote:1) Does this happen if you don't patch with close airport.
Re: Patch: Upgrade airports
Actually, I did:
Exactly as I said in the previous post.
A clean build, patched with upgrade airports and nothing else, still fails to allow upgrading airports.Gremnon wrote:1: Yes
Exactly as I said in the previous post.
Re: Patch: Upgrade airports
Did you patch r14876, or something newer? After reading your post I was thinking that it could be due to the changes done while incorporating distant-join stations into trunk. But that was after r14876. That was r14915 to r14919 to be precise. So.. what revision did you use?
Re: Patch: Upgrade airports
I also thought something might have upset it slightly with distant join, so I tried the revision before it, and r14938... both of which refused to allow upgrading.
Re: Patch: Upgrade airports
No idea. The patch was first submitted to flyspray more than a year ago, and I have been posting updates there every now and then. Last time I did I also asked the devs what their opinion was about the patch, but I'm yet to receive an answer.Moriarty wrote:Any reason this hasn't found its way into trunk? It's requested fairly often.
Gremnon wrote:Patched this into a clean trunk followed by close airport... try to upgrade an airport to a larger one, and get the error 'Too close to an other airport'
Did the patch apply cleanly?Gremnon wrote:A clean build, patched with upgrade airports and nothing else, still fails to allow upgrading airports.
Trunk is currently undergoing heavy changes on a regular basis, making it difficult to keep patches up to date. The recent distant-join changes have made my last patch unusable. Could you please check if the problems persist with the new version of the patch I'm attaching?
- Attachments
-
- airport-upgrade-v6-r14977.patch
- (10.35 KiB) Downloaded 486 times
Re: Patch: Upgrade airports
No, the patch didn't apply perfect, there were a few failures on each which I hand fixed... which might have been the cause in the first place, but I'm not certain.
Re: Patch: Upgrade airports
Yes, that could have been the cause. The changes introduced with the distant-join thing were small (in the relevant part of the code), but enough to interfere subtly with this patch.
By the way, does the new patch work for you?
By the way, does the new patch work for you?
Who is online
Users browsing this forum: No registered users and 5 guests