Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Fri Nov 28, 2014 3:37 pm

All times are UTC




Post new topic Reply to topic  [ 85 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: Patch: Upgrade airports
PostPosted: Sun Jan 20, 2008 12:20 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Sat Apr 07, 2007 6:08 pm
Posts: 368
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


Attachments:
airport-upgrade-r11927.patch [8.73 KiB]
Downloaded 882 times

_________________
My patches: Close airports | Upgrade airports | Autoconvert depots | New map features


Last edited by cirdan on Wed Jun 27, 2012 6:22 pm, edited 13 times in total.
Top
 Profile  
 
PostPosted: Sun Jan 20, 2008 5:01 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed Jun 06, 2007 9:07 pm
Posts: 1710
Location: Czech Republic
Good idea for a patch

cirdan wrote:
- 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.

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)


Top
 Profile  
 
PostPosted: Tue Jan 22, 2008 9:55 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Sat Apr 07, 2007 6:08 pm
Posts: 368
Bilbo wrote:
Good idea for a patch

cirdan wrote:
- 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

I don't usually play multiplayer, let alone with the AI, so I hadn't thought of that.

Bilbo wrote:
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)

My plan was to ignore documentation until I got a dev's attention, and hope no one would notice... :-)

Seriously, thanks for the suggestion. The attached version has the comment ammended.


Attachments:
airport-upgrade-r11947.patch [8.82 KiB]
Downloaded 212 times

_________________
My patches: Close airports | Upgrade airports | Autoconvert depots | New map features
Top
 Profile  
 
PostPosted: Fri Jan 25, 2008 11:19 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Mar 06, 2004 11:51 pm
Posts: 1484
Location: The sunny side of Alps
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'!


Top
 Profile  
 
PostPosted: Thu Apr 03, 2008 6:38 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Sat Apr 07, 2007 6:08 pm
Posts: 368
Updated against 0.6.0.


Attachments:
airport-upgrade-0.6.0.patch [9.42 KiB]
Downloaded 256 times

_________________
My patches: Close airports | Upgrade airports | Autoconvert depots | New map features
Top
 Profile  
 
PostPosted: Sat May 24, 2008 10:31 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Wed Nov 07, 2007 10:44 pm
Posts: 8445
Location: Sol d
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 :(

_________________
Image
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


Top
 Profile  
 
PostPosted: Sun May 25, 2008 2:44 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Sat Apr 07, 2007 6:08 pm
Posts: 368
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.


Attachments:
airport-upgrade-v6-r13232.patch [10.3 KiB]
Downloaded 145 times

_________________
My patches: Close airports | Upgrade airports | Autoconvert depots | New map features
Top
 Profile  
 
PostPosted: Tue Jun 03, 2008 8:13 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Sat Apr 07, 2007 6:08 pm
Posts: 368
Patches against 0.6.1 and r13374.


Attachments:
airport-upgrade-v6-0.6.1.patch [9.27 KiB]
Downloaded 174 times
airport-upgrade-v6-r13374.patch [10.26 KiB]
Downloaded 170 times

_________________
My patches: Close airports | Upgrade airports | Autoconvert depots | New map features
Top
 Profile  
 
PostPosted: Tue Jan 06, 2009 9:04 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Sat Apr 07, 2007 6:08 pm
Posts: 368
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 152 times

_________________
My patches: Close airports | Upgrade airports | Autoconvert depots | New map features
Top
 Profile  
 
PostPosted: Sat Jan 10, 2009 1:32 am 
Offline
Tycoon
Tycoon

Joined: Sat Jun 12, 2004 12:37 am
Posts: 1389
Location: United Kingdom of Great Britain and Northern Ireland
Any reason this hasn't found its way into trunk? It's requested fairly often.


Top
 Profile  
 
PostPosted: Sat Jan 10, 2009 2:10 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Sep 16, 2005 12:23 pm
Posts: 1492
Location: /home
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 name
catcodec, grfcodec and nforenum for Arch Linux


Top
 Profile  
 
PostPosted: Sat Jan 10, 2009 3:25 pm 
Offline
Chief Executive
Chief Executive

Joined: Tue Jun 10, 2003 12:19 am
Posts: 697
Location: Australia
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?


Top
 Profile  
 
PostPosted: Sat Jan 10, 2009 3:35 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Sep 16, 2005 12:23 pm
Posts: 1492
Location: /home
1: Yes
2: No

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 name
catcodec, grfcodec and nforenum for Arch Linux


Top
 Profile  
 
PostPosted: Sat Jan 10, 2009 6:21 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Sun Sep 09, 2007 5:03 am
Posts: 3156
Location: home
You didn't answer question 1:
Conditional Zenith wrote:
1) Does this happen if you don't patch with close airport.
In other words, does the problem exist in trunk or in the patch?


Top
 Profile  
 
PostPosted: Sat Jan 10, 2009 6:26 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Sep 16, 2005 12:23 pm
Posts: 1492
Location: /home
Actually, I did:
Gremnon wrote:
1: Yes


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 name
catcodec, grfcodec and nforenum for Arch Linux


Top
 Profile  
 
PostPosted: Sat Jan 10, 2009 7:26 pm 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
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 patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage


Top
 Profile  
 
PostPosted: Sat Jan 10, 2009 7:35 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Sep 16, 2005 12:23 pm
Posts: 1492
Location: /home
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 name
catcodec, grfcodec and nforenum for Arch Linux


Top
 Profile  
 
PostPosted: Sat Jan 10, 2009 8:00 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Sat Apr 07, 2007 6:08 pm
Posts: 368
Moriarty wrote:
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?


Attachments:
airport-upgrade-v6-r14977.patch [10.35 KiB]
Downloaded 155 times

_________________
My patches: Close airports | Upgrade airports | Autoconvert depots | New map features
Top
 Profile  
 
PostPosted: Sat Jan 10, 2009 8:11 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Sep 16, 2005 12:23 pm
Posts: 1492
Location: /home
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 name
catcodec, grfcodec and nforenum for Arch Linux


Top
 Profile  
 
PostPosted: Sat Jan 10, 2009 8:54 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Sat Apr 07, 2007 6:08 pm
Posts: 368
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?

_________________
My patches: Close airports | Upgrade airports | Autoconvert depots | New map features


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 85 posts ]  Go to page 1, 2, 3, 4, 5  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


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

Search for:
Jump to:  

Powered by phpBB © 2000-2013 phpBB Group

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2013.
Hosted by Zernebok Hosting.