Patch: Minimum Town Distance

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
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Re: Patch: Minimum Town Distance

Post by CommanderZ »

The compatibility with the rvision the patch is for is quaranteed in fact, with newer builds it might work. But the larger the gap is, the lower the probability that it would work is.
User avatar
Octopuss
Traffic Manager
Traffic Manager
Posts: 135
Joined: 08 Mar 2004 20:20
Location: Czech republic

Re: Patch: Minimum Town Distance

Post by Octopuss »

Ah. So it's not too good idea I guess.
Why don't they just add it to the official release I wonder... Patches like this look pretty good to me.
I'll just stick with nightlies, all this is beyond me.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Patch: Minimum Town Distance

Post by DaleStan »

CommanderZ wrote:The compatibility with the rvision the patch is for is quaranteed
Inasmuch as anything under the GPL is guaranteed to do anything.
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
Octopuss
Traffic Manager
Traffic Manager
Posts: 135
Joined: 08 Mar 2004 20:20
Location: Czech republic

Re: Patch: Minimum Town Distance

Post by Octopuss »

Looks like wleader doesn't want to have anything to do with this anymore :)
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Patch: Minimum Town Distance

Post by belugas »

Octopuss wrote:Why don't they just add it to the official release I wonder...
1) Releases are (in most cases if not all) just bugfixes
2) A feature that has never been in nightly (thus in trunk) will never get into Releases either.
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
User avatar
Octopuss
Traffic Manager
Traffic Manager
Posts: 135
Joined: 08 Mar 2004 20:20
Location: Czech republic

Re: Patch: Minimum Town Distance

Post by Octopuss »

That seems pretty logical. I made a feature request a few days ago so I hope it will catch someone's attention :)
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch: Minimum Town Distance

Post by 2007Alain2007 »

Hi there i have updated the Minumum Distance Patch to r15555 here is the upload and i have allso updated the KGAT patch pack with this pacth as well
KGAT Distance patch r15555.patch
For Community Integrated Version http://code.google.com/p/civopenttd/
User avatar
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Re: Patch: Minimum Town Distance

Post by pavel1269 »

updated .... not from KGAT :-O
from 11814 .-)

EDIT: newer update
Last edited by pavel1269 on 16 Mar 2009 14:49, edited 1 time in total.
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch: Minimum Town Distance

Post by 2007Alain2007 »

that patch is not from my patch pack its just something i used to know what patchs i have updated or changed :)
For Community Integrated Version http://code.google.com/p/civopenttd/
User avatar
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Re: Patch: Minimum Town Distance

Post by pavel1269 »

new update ... repaired some stuff ....
also added new setting .... distance between town <-> industry
Attachments
min_town-ind_r15741.patch
(9.35 KiB) Downloaded 122 times
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch: Minimum Town Distance

Post by 2007Alain2007 »

updated to r15821
min_town-ind_r15821.patch
Minimum Town Distance R15821.7z
For Community Integrated Version http://code.google.com/p/civopenttd/
User avatar
Octopuss
Traffic Manager
Traffic Manager
Posts: 135
Joined: 08 Mar 2004 20:20
Location: Czech republic

Re: Patch: Minimum Town Distance

Post by Octopuss »

do the nightlies change so much there is an update needed every few build?
Btw thanks for the work, this is very nice patch and even more valuable since CommanderZ stopped working on his masterpiece :)
User avatar
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Re: Patch: Minimum Town Distance

Post by pavel1269 »

yesterday, there was like 25revisions :-P wich broke almost every single patch ;-)
User avatar
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Re: Patch: Minimum Town Distance

Post by CommanderZ »

Btw thanks for the work, this is very nice patch and even more valuable since CommanderZ stopped working on his masterpiece
What masterpiece do you mean? The Town count one? It is AFAIK in trunk (not by me though).
User avatar
Octopuss
Traffic Manager
Traffic Manager
Posts: 135
Joined: 08 Mar 2004 20:20
Location: Czech republic

Re: Patch: Minimum Town Distance

Post by Octopuss »

more map settings :P
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch: Minimum Town Distance

Post by 2007Alain2007 »

in this pacth

- if (IsCloseToTown(tile, 20)) continue;
+ if (IsCloseToTown(tile, _settings_game.economy.minimum_distance_town)) continue;

but line has been changed in trunk to

if (CmdFailed(TownCanBePlacedHere(tile))) continue;

so should it be changed in the patch to work to

if (CmdFailed(TownCanBePlacedHere(tile _settings_game.economy.minimum_distance_town))) continue;

just a bit of help need
For Community Integrated Version http://code.google.com/p/civopenttd/
User avatar
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Re: Patch: Minimum Town Distance

Post by pavel1269 »

2007Alain2007 wrote:in this pacth

- if (IsCloseToTown(tile, 20)) continue;
+ if (IsCloseToTown(tile, _settings_game.economy.minimum_distance_town)) continue;

but line has been changed in trunk to

if (CmdFailed(TownCanBePlacedHere(tile))) continue;
will update tomorow ;-)
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch: Minimum Town Distance

Post by 2007Alain2007 »

ok cool thanks and it means i update my patch pack towomow then :( lol
For Community Integrated Version http://code.google.com/p/civopenttd/
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Minimum Town Distance

Post by Roujin »

2007Alain2007 wrote:in this pacth

- if (IsCloseToTown(tile, 20)) continue;
+ if (IsCloseToTown(tile, _settings_game.economy.minimum_distance_town)) continue;

but line has been changed in trunk to

if (CmdFailed(TownCanBePlacedHere(tile))) continue;

so should it be changed in the patch to work to

if (CmdFailed(TownCanBePlacedHere(tile _settings_game.economy.minimum_distance_town))) continue;

just a bit of help need
even though pavel said he'll update it, I'll try to explain what happens here so you get a bit of understanding ;)
What the code does here (should be more or less clear from the naming): it calls a function called "IsCloseToTown" with parameters "tile" and "20". From the naming of the function, we can guess that it checks if the tile we're interested in is less than 20 tiles from an already existing town.
It has been changed to another function called "TownCanBePlacedHere" with only "tile" as parameter. That means that now this function is responsible for doing the job the old function "IsCloseToTown" did before. Unfortunately, this new function does not accept a parameter for the number of tiles, so you would have to search for the place where this function is defined and see what it does.

In this case, it's a bit further up in the same file, town_cmd.cpp. (It could have been in some other file, so sometimes you have to search for it in the whole source, but this time you're lucky. ;))
The function definition starts with a little comment describing what it does and then

Code: Select all

static CommandCost TownCanBePlacedHere(TileIndex tile)
 {
If you look inside the function, you'll find again something you know: "if (IsCloseToTown(tile, 20))". You should be able to make the appropriate change here. ;)
* @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
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch: Minimum Town Distance

Post by 2007Alain2007 »

tryed it and i have a look latter tonight as well at it
For Community Integrated Version http://code.google.com/p/civopenttd/
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Bing [Bot] and 53 guests