GrowTown::_town_coord_mod

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
odalman
Engineer
Engineer
Posts: 37
Joined: 07 Jan 2020 01:46

GrowTown::_town_coord_mod

Post by odalman »

Can someone please add a comment that explains GrowTown::_town_coord_mod, especially the duplicated values. I plotted the points in a coordinate system and it does not seem to make sense. The code looks like this:

Code: Select all

static const TileIndexDiffC _town_coord_mod[] = {
		{-1,  0},
		{ 1,  1},
		{ 1, -1},
		{-1, -1},
		{-1,  0},
		{ 0,  2},
		{ 2,  0},
		{ 0, -2},
		{-1, -1},
		{-2,  2},
		{ 2,  2},
		{ 2, -2},
		{ 0,  0}
	};
The plotted pattern looks like this (number of entries at each point):

Code: Select all

10101
00010
02101
02010
00101
_dp_
Transport Coordinator
Transport Coordinator
Posts: 278
Joined: 18 Dec 2013 12:32

Re: GrowTown::_town_coord_mod

Post by _dp_ »

They add to each other so It's just a traversal of 13 closest tiles in a spiral-ish way.
odalman
Engineer
Engineer
Posts: 37
Joined: 07 Jan 2020 01:46

Re: GrowTown::_town_coord_mod

Post by odalman »

Thanks!
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 18 guests