Turning off the 'free' house

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

Post Reply
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Turning off the 'free' house

Post by Aphid »

I wish to not receive an effectively 'free' house whenever 'Fund new Buildings' is used in the Town menu.

Fund new buildings sets the house timer of a town to one day from whatever value it was manually set to, even if the town is not growing.

There's multiple ways in which it 'could' be done, but I believe most would require some kind of change to OpenTTD.

Method:

1) Add to configure patches.

- It would be a Somewhat obscure setting that has minimal impact on most games.

2) Allow scripts to override this functionality.

- E.g. if a script sets a town growth rate to be once every 200 days it will plant a house every 200 days, no matter if someone presses the fund town button.

3) Allow newGRF to override this functionality.

Also, I've noticed:

The classes GSTown and AITown have no way of providing AI or script with the information if/when a town is funded or not. Nor is the secondary way of verifying this (using the TownZone of a square, as a human player would be able to do it) possible.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Turning off the 'free' house

Post by planetmaker »

Sorry... I'm left puzzled: what's the actual issue or problem?

You want the "fund new buildings" action to NOT work?

Oh, and as GS being the entitiy to steer global gameplay, they have the ability to drive town growth. Thus that's a thing of global nature which should not be exposed to NewGRFs.
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Re: Turning off the 'free' house

Post by Aphid »

Well, the actual issue/problem should be obvious:

Suppose I have a GS or situation limiting town growth. I then can't play with the fund town button enabled as that disables/overrides the functionality of the former for any company with sufficient money. And obtaining sufficient money isn't hard at all. One house does not seem like a big deal until someone presses the button a hundred times.

Town growth does three things:

1) Build a house immediately
2) Expand town zones
3) Increase house building tempo.

I want to be able to get just [2], and 'forward' the information about [3] to a script and AI even and especially if the former overrides the house building tempo. For example the script could increase the growth tempo of a funded town with the goals met somewhat. As of now a script has no way to know the user pressed this button/did this action. Worse still, an AI has no way to know a human player is doing this apart from doing so in a roundabout manner, e.g. using the town's house count. Even then this is no 'guarantee' of giving the right answer (is the town funded or not?) as the build speed can be a number low enough (<= 5 days) that there's no real New-GRF proof way of certainly knowing.

Wanting to disable [1] is fairly natural. Novapolis solves it, for example, by changing the house build function in openTTD itself to build an empty tile if the goals are not met. But try the following; simply start a game in a desert map and give yourself a billion. You'll be able to significantly increase the size of a town in the desert without bringing this town water and food. Without effect [1] the only effect that happens in a game with script is [2] because [3] is overridden.

Example script way of doing it would be:

Code: Select all

bool GSTown::IsFunded(int TownID)
We already have GSTown::GetRoadReworkDuration() for a script which is of questionable usefulness. The above however would be very useful.

Even better would be:

Code: Select all

 bool GSTown::EnableFunding(int TownID, int CompanyID, bool Enable = true)
Supply (id,true), turns on the fund town button. Supply COMPANY_INVALID to do all companies, and some ID to do a particular company to enable/disable.
I have a distinct feeling this may fall under Area Control as one of the actions though.

Example setting way of doing it would be:

Replace the 'Economy.towns.allow fund buildings' setting with a dropbox setting, including 'off' 'without free house' and 'with free house' options, or whatever would be a descriptive name.
Honza_
Engineer
Engineer
Posts: 120
Joined: 29 Aug 2010 10:29

Re: Turning off the 'free' house

Post by Honza_ »

planetmaker wrote:Sorry... I'm left puzzled: what's the actual issue or problem?
You want the "fund new buildings" action to NOT work?
.
What Aphid means, is that with GS, when coding citybuilder style goal and cargo delivery is not met for a period of time, you can still grow town with Fund building button, if that is enabled, making GS useless.

A little more intelligent would be, it GS had priority over Fund buildings, and that button would only steer building when cargo requirements are fulfilled. Practically, Fund Buildings would only build something if GS is not stopping growth rate (currently to stop growth one has to set some high GR, which is in my opinion obscure solution).
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Google [Bot] and 16 guests