rem: printf ("1)FlushGroupInfo(%lu): WG = %u(%lu), NG = %u, SI = %u\n", offset, which_group, pGH->GroupOffset[which_group], pGH->NumGroups, pGH->star_index);
add: fprintf (stderr, "1)FlushGroupInfo(%lu): WG = %u(%lu), NG = %u, SI = %u\n", offset, which_group, pGH->GroupOffset[which_group], pGH->NumGroups, pGH->star_index);
context: FlushGroupInfo (GROUP_HEADER *pGH, DWORD offset, BYTE which_group, PVOID		fp){	BYTE RaceType, NumShips;	HSTARSHIP hStarShip;	SHIP_FRAGMENTPTR FragPtr;	if (which_group == 0)	{		if (pGH->GroupOffset[0] == 0)			pGH->GroupOffset[0] = LengthResFile (fp);		{			QUEUE temp_q;			HSTARSHIP hNextShip;			temp_q = GLOBAL (npc_built_ship_q);			SetHeadLink (&GLOBAL (npc_built_ship_q), 0);			SetTailLink (&GLOBAL (npc_built_ship_q), 0);			for (hStarShip = GetHeadLink (&temp_q);					hStarShip; hStarShip = hNextShip)			{				BYTE crew_level;				FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (						&temp_q, hStarShip						);				hNextShip = _GetSuccLink (FragPtr);				crew_level = FragPtr->ShipInfo.crew_level;				which_group = GET_GROUP_ID (FragPtr);				UnlockStarShip (						&temp_q, hStarShip						);				if (crew_level == 0)				{					if (GLOBAL (BattleGroupRef))						PutGroupInfo (GLOBAL (BattleGroupRef), which_group);					else						FlushGroupInfo (pGH, 0L, which_group, fp);					pGH->GroupOffset[which_group] = 0;					RemoveQueue (							&temp_q, hStarShip							);					FreeStarShip (							&temp_q, hStarShip							);				}			}			GLOBAL (npc_built_ship_q) = temp_q;			which_group = 0;		}	}	else if (which_group > pGH->NumGroups)	{		pGH->NumGroups = which_group;		pGH->GroupOffset[which_group] = LengthResFile (fp);		hStarShip = GetHeadLink (&GLOBAL (npc_built_ship_q));		FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (				&GLOBAL (npc_built_ship_q), hStarShip				);		RaceType = GET_RACE_ID (FragPtr);		SeekResFile (fp, pGH->GroupOffset[which_group], SEEK_SET);		WriteResFile ((PBYTE)&RaceType, sizeof (RaceType), 1, fp);		UnlockStarShip (				&GLOBAL (npc_built_ship_q), hStarShip				);	}	SeekResFile (fp, offset, SEEK_SET);	WriteResFile (pGH, sizeof (*pGH), 1, fp);#ifdef DEBUGprintf ("1)FlushGroupInfo(%lu): WG = %u(%lu), NG = %u, SI = %u\n",offset, which_group, pGH->GroupOffset[which_group], pGH->NumGroups, pGH->star_index);#endif /* DEBUG */	NumShips = (BYTE)CountLinks (&GLOBAL (npc_built_ship_q));	if (which_group)		SeekResFile (fp, pGH->GroupOffset[which_group]				+ sizeof (RaceType), SEEK_SET);	else	{		RaceType = (BYTE)cur_player;		SeekResFile (fp, pGH->GroupOffset[0], SEEK_SET);		WriteResFile (&RaceType, sizeof (RaceType), 1, fp);	}	WriteResFile (&NumShips, sizeof (NumShips), 1, fp);	hStarShip = GetHeadLink (&GLOBAL (npc_built_ship_q));	while (NumShips--)	{		HSTARSHIP hNextShip;		PBYTE Ptr;		FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (				&GLOBAL (npc_built_ship_q), hStarShip				);		hNextShip = _GetSuccLink (FragPtr);		RaceType = GET_RACE_ID (FragPtr);		WriteResFile ((PBYTE)&RaceType, sizeof (RaceType), 1, fp);#ifdef DEBUGif (which_group == 0)printf ("F) type %u, loc %u<%d, %d>, task 0x%02x:%u\n",RaceType,GET_GROUP_LOC (FragPtr),FragPtr->ShipInfo.loc.x,FragPtr->ShipInfo.loc.y,GET_GROUP_MISSION (FragPtr),GET_GROUP_DEST (FragPtr));#endif /* DEBUG */		Ptr = (PBYTE)&FragPtr->RaceDescPtr;		WriteResFile ((PBYTE)Ptr,				((PBYTE)&FragPtr->ShipInfo.race_strings) - Ptr,				1, fp);		UnlockStarShip (				&GLOBAL (npc_built_ship_q), hStarShip				);		hStarShip = hNextShip;	}}