(svn r18726) -Fix [FS#3463]: with non-uniform industries the 'supplies' text when building a station could be incorrect (missing a cargo)
-Change [NoAI]: AITile::GetCargoProduction now returns the number of producers and not the number of tiles of producers. -Fix [NoAI]: AITileList_IndustryProducing would omit some tiles for at which a station would get cargo.
This commit is contained in:
@@ -539,6 +539,30 @@ void TileArea::Add(TileIndex to_add)
|
||||
this->h = ey - sy + 1;
|
||||
}
|
||||
|
||||
bool TileArea::Intersects(const TileArea &ta) const
|
||||
{
|
||||
if (ta.w == 0 || this->w == 0) return false;
|
||||
|
||||
assert(ta.w != 0 && ta.h != 0 && this->w != 0 && this->h != 0);
|
||||
|
||||
uint left1 = TileX(this->tile);
|
||||
uint top1 = TileY(this->tile);
|
||||
uint right1 = left1 + this->w - 1;
|
||||
uint bottom1 = top1 + this->h - 1;
|
||||
|
||||
uint left2 = TileX(ta.tile);
|
||||
uint top2 = TileY(ta.tile);
|
||||
uint right2 = left2 + ta.w - 1;
|
||||
uint bottom2 = top2 + ta.h - 1;
|
||||
|
||||
return !(
|
||||
left2 > right1 ||
|
||||
right2 < left1 ||
|
||||
top2 > bottom1 ||
|
||||
bottom2 < top1
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void InitializeStations()
|
||||
{
|
||||
|
Reference in New Issue
Block a user