Municipal(Town Owned) Airports

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

User avatar
JimboTG
Engineer
Engineer
Posts: 80
Joined: 08 Sep 2005 10:45
Location: Portsmouth, England

Municipal(Town Owned) Airports

Post by JimboTG »

Hi All,

Ok here goes...

I come from a delphi background and Im a pretty amateur programmer anyway, however using C++ for dummies and a bit of a crumby laptop Ive made a patch (hooray)

This is what it does...

(1.) as of 1990 every month find a town with a population of at least 15000
and find a nice flat non player owned area.
(2.) build an international airport and make the town the owner.
(3.) report in the news that a municipal airport has been built
(4.) allow any 5 planes of a user to use the airport
(5.) tax any plane that is dropping off or picking up cargo approximatly 20% of the income for that journey.
(6.) tax any plane that is serviced at a public hanger 20% of its value
(7.)prevents players from stopping there planes in a public airport for fairness
(8.) destroy all town owned airports and cover the bald spot if the patch is disabled during a game (at the end of the month)

i think thats about it.

Known Bug(s):-
(1.) cannot add goto hanger order on any airport (i think this is unrelated to me because its the same in a clean svn checkout).

So please guys, try it out, see what you think, post bug reports and pass on suggestions.

[EDIT] ps in my opinion this would probably do better if it was merged with CobraA1's aircraft queueing patch because as im sure you can imagine, 8 players sending 5 planes each to one airport, some of them aint gonna land.
Attachments
m_airport.diff
against r3066
(51.27 KiB) Downloaded 636 times
m_airport.zip
for those without a compiler
(455.96 KiB) Downloaded 746 times
Last edited by JimboTG on 20 Oct 2005 07:30, edited 18 times in total.
I cant put a signature here, I dropped my pen
User avatar
Born Acorn
Tycoon
Tycoon
Posts: 7597
Joined: 10 Dec 2002 20:36
Skype: bornacorn
Location: Wrexham, Wales
Contact:

Post by Born Acorn »

Nice. I like the idea! I just need to get a compiler and try to compile again.
Image
User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Re: Municipal Airports

Post by bobingabout »

JimboTG wrote: 4) tax any plane that is dropping off or picking up cargo approximatly 20% of the income for that journey.
sounds good. but maybe this percentage should be set by a patch option, like in the subsidiaries patch.
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]
User avatar
JimboTG
Engineer
Engineer
Posts: 80
Joined: 08 Sep 2005 10:45
Location: Portsmouth, England

Re: Municipal Airports

Post by JimboTG »

bobingabout wrote: maybe this percentage should be set by a patch option, like in the subsidiaries patch.
thanks for the input, the reason i set the percentage so high is that i didnt want to make it to easy. Bear in mind that if possible the airport will be built slap bang in the centre of the town and passenger/mail generation is extraordinarily high (even with 80 planes servicing it!) hence forth without even trying you can fill a boeing 747 every time it lands there. however will give it a bash :wink:
I cant put a signature here, I dropped my pen
Nappe1
Traffic Manager
Traffic Manager
Posts: 175
Joined: 19 Jan 2004 17:25
Location: kotka or Savitaipale, Finland
Contact:

Post by Nappe1 »

This patch sounds really good. I think there could same kind of system for bus stations as well, but without cargo pickup tax. This is the way how bus stations actually work in reality here. They are built by city, not bus companies. That would give to busses a small advantage over trains, because you don't need to destroy half of the downtown to get your station built.


P.S. JimboTG: I am coming with Delphi background as well and afaik there's at least two others here. ;)
User avatar
JimboTG
Engineer
Engineer
Posts: 80
Joined: 08 Sep 2005 10:45
Location: Portsmouth, England

Post by JimboTG »

i think the system could easily be converted for bus's, maybe even combining the two, however i wanna get the bugs out first before i introduce a whole bundle more of them.
I cant put a signature here, I dropped my pen
Nappe1
Traffic Manager
Traffic Manager
Posts: 175
Joined: 19 Jan 2004 17:25
Location: kotka or Savitaipale, Finland
Contact:

Post by Nappe1 »

JimboTG wrote:i think the system could easily be converted for bus's, maybe even combining the two, however i wanna get the bugs out first before i introduce a whole bundle more of them.
sure thing. It's better have one fully working feature instead of two that work when moon and stars are in correct position. :)
User avatar
JimboTG
Engineer
Engineer
Posts: 80
Joined: 08 Sep 2005 10:45
Location: Portsmouth, England

Post by JimboTG »

got an update,

The setting "Towns can build municipal airport" is remembered and set to on by default,

you can change the tax rate in the openttd.cfg file (kind of a compromise) under value municipal_airports_tax, the default is 20

also just did a bit of code tidying, there are some things that are a bit messy.

Have fun
I cant put a signature here, I dropped my pen
User avatar
JimboTG
Engineer
Engineer
Posts: 80
Joined: 08 Sep 2005 10:45
Location: Portsmouth, England

Post by JimboTG »

either ive written a truly brilliant patch with absoloutly no bugs or errors (laughable) or no one is trying it out, c'mon guys make it crash or do something strange I know you've all got it in you :wink:

anyway its totally been rewritten to make it a little more efficient and Ive added a news item so you will be informed when a new airport is built.

Im eagerly awaiting any comments... get typing!

find the latest version in the first post.
I cant put a signature here, I dropped my pen
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Hmm I've seen the diff file and seems your differ compared all files, even these unchanged.
Also I think you're patch is that universal so one can use it for docks, train stations and bus stations.
Please take a look at http://wiki.openttd.com/index.php/New_AI_/_Airport for more tips on future-AI-building airports

Great job, I'd like o see it in trunk or at least Integrated nightly.
User avatar
Born Acorn
Tycoon
Tycoon
Posts: 7597
Joined: 10 Dec 2002 20:36
Skype: bornacorn
Location: Wrexham, Wales
Contact:

Post by Born Acorn »

JimboTG wrote:either ive written a truly brilliant patch with absoloutly no bugs or errors (laughable) or no one is trying it out, c'mon guys make it crash or do something strange I know you've all got it in you :wink:

anyway its totally been rewritten to make it a little more efficient and Ive added a news item so you will be informed when a new airport is built.

Im eagerly awaiting any comments... get typing!

find the latest version in the first post.
Well I fast forwarded it and played it for 50 game years from 2000-2050, no crashes.

My only prob is that the Airport Sign and box have the dark blue company colour.
Image
User avatar
lucaspiller
Tycoon
Tycoon
Posts: 1228
Joined: 18 Apr 2004 20:27

Post by lucaspiller »

I get a few linker errors with gcc:

Code: Select all

===> Linking openttd
aircraft_cmd.o(.text+0x1f24): In function `AircraftEventHandler_Flying':
: undefined reference to `MA_OwnerHandler'
economy.o(.text+0x21fa): In function `LoadUnloadVehicle':
: undefined reference to `MA_Tax'
economy.o(.text+0x220b): In function `LoadUnloadVehicle':
: undefined reference to `MA_Tax'
order_cmd.o(.text+0xb61): In function `CmdInsertOrder':
: undefined reference to `MA_OwnerHandler'
order_gui.o(.text+0x9dd): In function `OrdersWndProc':
: undefined reference to `MA_OwnerHandler'
town_cmd.o(.text+0x3eb5): In function `TownsMonthlyLoop':
: undefined reference to `MunicipalAirport'
collect2: ld returned 1 exit status
make: *** [openttd] Error 1
Nice idea though. :D
No longer active here, but you can still reach me via email: luca[at]stackednotion[dot]com
User avatar
JimboTG
Engineer
Engineer
Posts: 80
Joined: 08 Sep 2005 10:45
Location: Portsmouth, England

Post by JimboTG »

@ Lucaspiller

I dont now what could be causing that because im not familiar with gcc, does anybody else know? post suggestions.

@ born acorn

I agree company colour should be different, i was thinking of going for gray, any thoughts?
I cant put a signature here, I dropped my pen
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

As gray as buoy\oil rig sign, I think :wink:
WLT
Engineer
Engineer
Posts: 17
Joined: 05 Apr 2005 10:57
Location: The City of Premiership Woe
Contact:

Post by WLT »

I noticd that the airport is built right in the middle of the city (covers the name), i havn't had time to play a full game but was wondering if this affects city growth as in this post

Town Growth Problem

As i dont know if this bug was fixed, if it wasnt then this patch may have a detromental effect of town growth.
User avatar
JimboTG
Engineer
Engineer
Posts: 80
Joined: 08 Sep 2005 10:45
Location: Portsmouth, England

Post by JimboTG »

as far as i can gather from test games (of which there have been A LOT) theres been no effect on town growth, but then again i haven't been paying attention to it. I will fire up a game and observe:- watch this space
I cant put a signature here, I dropped my pen
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

lucaspiller wrote:I get a few linker errors with gcc:
Did you add the new source file (m_airport.c) to the makefile?
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
User avatar
JimboTG
Engineer
Engineer
Posts: 80
Joined: 08 Sep 2005 10:45
Location: Portsmouth, England

Post by JimboTG »

regarding sign color,

i can do it by just setting the owner to OWNER_NONE. however by doing that any player could claim the airport as there own by building any other type of station next to it.

this applies to other things to for example:-

imagine someone likes ships and builds a buoy by the coast to guide there ships, but before they can set the orders another player builds a bus station on the tile next to it, are you with me so far? the buoys sign changes colour and the player who built the bus station owns it, which means that the original or any other player can't use it. I know you could just build another buoy near it and problem solved, but it shouldnt happen.

Ive found the code responsible but im not sure if this a bug or intentional for future features. :? so if any devs are monitoring this perhaps they would be so kind as to inform me whats what?
Last edited by JimboTG on 12 Oct 2005 23:18, edited 1 time in total.
I cant put a signature here, I dropped my pen
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Post by SirkoZ »

Wow - very nice patch!
I'll see to it getting included in the next Integrated_nightly build - the OpenTTD build with coolest patches. :D

BTW - I humbly ask you, DaleStan to review the code and fix possible "weak spots". :wink:

EDIT#2 :) - JimboTG could you possibly add a button to enable/disable the feature (this goes from amateur to amateur ;-) )?
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

JimboTG wrote:regarding sign color,

i can do it by just setting the owner to OWNER_NONE. however by doing that any player could claim the airport as there own by building any other type of station next to it.
I remember I've made track reconstruction disaster similiar way - the track is being claimed by a nearby town (blue fences) for a moment when bulldozers run around the tile. I was also wondering about the colour, but it's blue...


How about an option for scenario editor to spawn the municipial airport? Also how about town action to fund such a airport (like fund new buildings or build statue)?
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Semrush [Bot] and 20 guests