src/game/Strategic/Strategic_Movement.cc
static UINT8 AddGroupToList(GROUP* const g)
{
	// First, find a unique ID
	for (UINT8 id = 0; ++id;)
	{
		const UINT32 index = id / 32;
		const UINT32 bit   = id % 32;
		const UINT32 mask  = 1 << bit;
		if (uniqueIDMask[index] & mask) continue;

		// Found a free id
		g->ubGroupID         = id;
		uniqueIDMask[index] |= mask;

		// Append group to list
		GROUP** i = &gpGroupList;
		while (*i != NULL) i = &(*i)->next;
		*i = g;

		return id;
	}
	throw std::runtime_error("Out of group IDs");
}
//When adding any new group to the list, this is what must be done:
//1)  Find the first unused ID (unique)
//2)  Assign that ID to the new group
//3)  Insert the group at the end of the list.
When adding any new group to the list, this is what must be done:
1)  Find the first unused ID (unique)
2)  Assign that ID to the new group
3)  Insert the group at the end of the list.
When adding any new group to the list this is what must be done : 1 ) Find the first unused ID ( unique ) 2 ) Assign that ID to the new group 3 ) Insert the group at the end of the list .
static UINT8 AddGroupToList(GROUP* const g)
{
	for (UINT8 id = 0; ++id;)
	{
		const UINT32 index = id / 32;
		const UINT32 bit   = id % 32;
		const UINT32 mask  = 1 << bit;
		if (uniqueIDMask[index] & mask) continue;
		g->ubGroupID         = id;
		uniqueIDMask[index] |= mask;
		GROUP** i = &gpGroupList;
		while (*i != NULL) i = &(*i)->next;
		*i = g;
		return id;
	}
	throw std::runtime_error("Out of group IDs");
}
static UINT8 AddGroupToList ( GROUP * const g ) { for ( UINT8 id = 0 ; ++ id ; ) { const UINT32 index = id / 32 ; const UINT32 bit = id % 32 ; const UINT32 mask = 1 << bit ; if ( uniqueIDMask [ index ] & mask ) continue ; g -> ubGroupID = id ; uniqueIDMask [ index ] |= mask ; GROUP * * i = & gpGroupList ; while ( * i != NULL ) i = & ( * i ) -> next ; * i = g ; return id ; } throw std :: runtime_error ( " " ) ; }
When adding any new group to the list, this is what must be done:
1)  Find the first unused ID (unique)
2)  Assign that ID to the new group
3)  Insert the group at the end of the list.
When adding any new group to the list this is what must be done : 1 ) Find the first unused ID ( unique ) 2 ) Assign that ID to the new group 3 ) Insert the group at the end of the list .
// First, find a unique ID // Found a free id // Append group to list