Page 1 of 1

Inconsistent catchment areas?

Posted: 05 May 2007 11:46
by PhilSophus
I had recently a look at the functions MoveGoodsToStation (which determines to which station passengers and cargo are moved) and UpdateStationAcceptance (which determines the acceptance of a station based on the surrounding houses and industries).

To my understanding, the catchment area of the station is different for arriving cargo and departing cargo. Please have a look at the attached image for illustration: Both bus stops are the same station (built with the distant-join-station patch). The acceptance is obviously determined by the bounding box of the station plus catchment radius (the brown area). However, passengers are only transfered to the station in the catchment area of each station tile (the area marked with owner signs).

In the depicted situation this leads to the station accepting passengers but never producing some, which seams quite inconsistent to me. (Until now, I falsely assumed the relevant area was the bounding rectangle in both cases.)

Is there a reason for this inconsistency? I would consider the variant in MoveGoodsToStation (only taking the catchment areas of real station tiles) the more logical one and as the code is already there, being more complicated does not seam to be an argument. Or do I miss something?

If there is demand (and no argument against it), I could prepare a patch to change the acceptance (and move to industry) area.

Posted: 05 May 2007 11:50
by Wolf01
that's due to the "incorrect" catchement area of the original game
the catchement area uses only 2 vertices to work, and is always a rectangle
you already spot the shown catchement areas, which sould be the correct, and you spotted the fake catchement area too, which is the bare land

i and frostregen abandoned the "show catchement areas" patch due to this problem, which none of us wanted to fix

Posted: 05 May 2007 11:58
by PhilSophus
Wolf01 wrote:i and frostregen abandoned the "show catchement areas" patch due to this problem, which none of us wanted to fix
That's funny. I was just thinking about such a patch, which is why I noticed the problem. But unless I miss something it does not seam so complicated to fix the problem. And if some people really want the original behavior one could make a patch setting.

Posted: 05 May 2007 12:42
by gkirilov
A good way to have this problem solved is to have the following patch setting:
- the station coverage is only the blue area given by the station - for both accepted cargo and produced cargo (the bought land on the screenshot)
- the station coverage is the rectangle(square) area determined by the 2 most distant tiles of the station - for both accepted cargo and produced cargo.
(the demolished land on the screenshot)
This way we have consistency for produced and accepted cargo. Plus we can build 64x64 stations which cover the whole area inside them very easy.

Posted: 05 May 2007 14:11
by antichaos
I've also spent some time with this code recently, doing a rewrite of DeliverGoodsToIndustry which can share cargo between multiple industries weighted according to the number of each industry's tiles in the stations catchment area. The area I used is the one defined in UpdateStationAcceptance, which is the bounding rectangle.

I like the idea of using the more realistic area from MoveGoodsToStation, but the code there doesn't actually give you the full catchment area of the station - only of the tiles that are within a certain radius of the producer.

Since we are now using c++, I'd suggest setting up a linked list of the tiles in the catchment area which is stored in the station struct and could be accessed by all the functions that reference the catchment area.

The other problem is that the tile highlighting routine isn't able to handle anything other than points, lines or rectangles, so we'd need to rewrite UpdateTileSelection in viewport.cpp. I still haven't quite figured out how and where the place_mode is controlled though.