src/game/Strategic/Town_Militia.cc
static bool ServeNextFriendlySectorInTown(INT16* const neighbour_x, INT16* const neighbour_y)
{
	while (g_town_sectors[gubTownSectorServerIndex].town != BLANK_SECTOR)
	{
		INT32 const sector = g_town_sectors[gubTownSectorServerIndex++].sector;

		// if this sector is in the town we're looking for
		if (StrategicMap[SECTOR_INFO_TO_STRATEGIC_INDEX(sector)].bNameId != gubTownSectorServerTownId) continue;

		INT16 const x = SECTORX(sector);
		INT16 const y = SECTORY(sector);

		// Make sure we're not supposed to skip it
		if (x == gsTownSectorServerSkipX && y == gsTownSectorServerSkipY) continue;

		// check if it's "friendly" - not enemy controlled, no enemies in it, no combat in progress
		if (!SectorOursAndPeaceful(x, y, 0)) continue;

		*neighbour_x = x;
		*neighbour_y = y;
		return true;
	}
	return false;
}
/* Fetch the X,Y of the next town sector on the town list for the town specified
 * at initialization. It will skip an entry that matches the skip X/Y value, if
 * one was specified at initialization.
 * MUST CALL InitFriendlyTownSectorServer() before using! */
Fetch the X,Y of the next town sector on the town list for the town specified
at initialization. It will skip an entry that matches the skip X/Y value, if
one was specified at initialization.
MUST CALL InitFriendlyTownSectorServer() before using!
Fetch the X Y of the next town sector on the town list for the town specified at initialization . It will skip an entry that matches the skip X / Y value if one was specified at initialization . MUST CALL InitFriendlyTownSectorServer () before using!
static bool ServeNextFriendlySectorInTown(INT16* const neighbour_x, INT16* const neighbour_y)
{
	while (g_town_sectors[gubTownSectorServerIndex].town != BLANK_SECTOR)
	{
		INT32 const sector = g_town_sectors[gubTownSectorServerIndex++].sector;
		if (StrategicMap[SECTOR_INFO_TO_STRATEGIC_INDEX(sector)].bNameId != gubTownSectorServerTownId) continue;
		INT16 const x = SECTORX(sector);
		INT16 const y = SECTORY(sector);
		if (x == gsTownSectorServerSkipX && y == gsTownSectorServerSkipY) continue;
		if (!SectorOursAndPeaceful(x, y, 0)) continue;
		*neighbour_x = x;
		*neighbour_y = y;
		return true;
	}
	return false;
}
static bool ServeNextFriendlySectorInTown ( INT16 * const neighbour_x , INT16 * const neighbour_y ) { while ( g_town_sectors [ gubTownSectorServerIndex ] . town != BLANK_SECTOR ) { INT32 const sector = g_town_sectors [ gubTownSectorServerIndex ++ ] . sector ; if ( StrategicMap [ SECTOR_INFO_TO_STRATEGIC_INDEX ( sector ) ] . bNameId != gubTownSectorServerTownId ) continue ; INT16 const x = SECTORX ( sector ) ; INT16 const y = SECTORY ( sector ) ; if ( x == gsTownSectorServerSkipX && y == gsTownSectorServerSkipY ) continue ; if ( ! SectorOursAndPeaceful ( x , y , 0 ) ) continue ; * neighbour_x = x ; * neighbour_y = y ; return true ; } return false ; }
Fetch the X,Y of the next town sector on the town list for the town specified
 at initialization.
Fetch the X Y of the next town sector on the town list for the town specified at initialization .
// if this sector is in the town we're looking for // Make sure we're not supposed to skip it // check if it's "friendly" - not enemy controlled, no enemies in it, no combat in progress