Page 1 of 1

GrowTown::_town_coord_mod

Posted: 07 Jan 2020 01:57
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

Re: GrowTown::_town_coord_mod

Posted: 07 Jan 2020 03:49
by _dp_
They add to each other so It's just a traversal of 13 closest tiles in a spiral-ish way.

Re: GrowTown::_town_coord_mod

Posted: 07 Jan 2020 03:57
by odalman
Thanks!