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.

- Atomicity: the town no longer has a chance to build roads or buildings between removal and rebuilding of an airport (very annoying).

Or even worse - your competitor in multiplayer or singleplayer (AI) can interfere with construction

Also, I have noted one thing regarding the coding style:

Code:

/* 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)

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:

Code:

/** 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.

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

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.

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'

_________________I'm forced to wonder what causes people to be incapable of seeing the Search function.Have patience, and don't whine - tutorials on how to compile OpenTTD on any OS can be found on the OpenTTD Wiki. Go look.Can now be spotted periodically on IRC under the same namecatcodec, grfcodec and nforenum for Arch Linux

I started a new game, placed small airport, attempt to upgrade, 'Too close to another airport'

_________________I'm forced to wonder what causes people to be incapable of seeing the Search function.Have patience, and don't whine - tutorials on how to compile OpenTTD on any OS can be found on the OpenTTD Wiki. Go look.Can now be spotted periodically on IRC under the same namecatcodec, grfcodec and nforenum for Arch Linux

A clean build, patched with upgrade airports and nothing else, still fails to allow upgrading airports.Exactly as I said in the previous post.

_________________I'm forced to wonder what causes people to be incapable of seeing the Search function.Have patience, and don't whine - tutorials on how to compile OpenTTD on any OS can be found on the OpenTTD Wiki. Go look.Can now be spotted periodically on IRC under the same namecatcodec, grfcodec and nforenum for Arch Linux

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?

_________________* @Belugas wonders what is worst... a mom or a wife...<Lakie> Well, they do the same thing but the code is different.______________My patchescheck my wiki page (sticky button) for a complete list

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.

_________________I'm forced to wonder what causes people to be incapable of seeing the Search function.Have patience, and don't whine - tutorials on how to compile OpenTTD on any OS can be found on the OpenTTD Wiki. Go look.Can now be spotted periodically on IRC under the same namecatcodec, grfcodec and nforenum for Arch Linux

Any reason this hasn't found its way into trunk? It's requested fairly often.

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.

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'

Gremnon wrote:

A clean build, patched with upgrade airports and nothing else, still fails to allow upgrading airports.

Did the patch apply cleanly?

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?

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.

_________________I'm forced to wonder what causes people to be incapable of seeing the Search function.Have patience, and don't whine - tutorials on how to compile OpenTTD on any OS can be found on the OpenTTD Wiki. Go look.Can now be spotted periodically on IRC under the same namecatcodec, grfcodec and nforenum for Arch Linux

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum