rem: printf ("\n");
add: fprintf (stderr, "\n");
context: GetGroupInfo (DWORD offset, BYTE which_group){	PVOID fp;	fp = OpenResFile (			offset && which_group ? DEFGRPINFO_FILE : RANDGRPINFO_FILE,			"r+b"			);	if (fp)	{		BYTE RaceType, NumShips;		GROUP_HEADER GH;		HSTARSHIP hStarShip;		SHIP_FRAGMENTPTR FragPtr;		SeekResFile (fp, offset, SEEK_SET);		ReadResFile (&GH, sizeof (GH), 1, fp);#ifdef DEBUGprintf ("GetGroupInfo(%lu): %u(%lu) out of %u\n", offset, which_group, GH.GroupOffset[which_group], GH.NumGroups);#endif /* DEBUG */		if (which_group == (BYTE)~0)		{			COUNT month_index, day_index, year_index;			ReinitQueue (&GLOBAL (npc_built_ship_q));#ifdef DEBUGprintf ("%u == %u\n", GH.star_index, (COUNT)(CurStarDescPtr - star_array));#endif /* DEBUG */			day_index = GH.day_index;			month_index = GH.month_index;			year_index = GH.year_index;			if (offset == 0					&& (GH.star_index != (COUNT)(CurStarDescPtr - star_array)					|| !ValidateEvent (ABSOLUTE_EVENT,					&month_index, &day_index, &year_index)))			{				CloseResFile (fp);#ifdef DEBUGif (GH.star_index == (COUNT)(CurStarDescPtr - star_array))printf ("GetGroupInfo: battle groups out of date %u/%u/%u!\n",month_index, day_index, year_index);#endif /* DEBUG */				fp = OpenResFile (RANDGRPINFO_FILE, "wb");				GH.NumGroups = 0;				GH.star_index = (COUNT)~0;				GH.GroupOffset[0] = 0;				WriteResFile (&GH, sizeof (GH), 1, fp);			}			else			{				for (which_group = 1; which_group <= GH.NumGroups; ++which_group)				{					if (GH.GroupOffset[which_group] == 0)						continue;					SeekResFile (fp, GH.GroupOffset[which_group], SEEK_SET);					ReadResFile (&RaceType, sizeof (RaceType), 1, fp);					ReadResFile (&NumShips, sizeof (NumShips), 1, fp);					if (NumShips)					{						BYTE task, group_loc;						DWORD rand_val;						hStarShip = CloneShipFragment (RaceType,								&GLOBAL (npc_built_ship_q), 0);						FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (								&GLOBAL (npc_built_ship_q), hStarShip								);						OwnStarShip (FragPtr, BAD_GUY, 0);						SET_GROUP_ID (FragPtr, which_group);						rand_val = Random ();						task = (BYTE)(LOBYTE (LOWORD (rand_val)) % ON_STATION);						if (task == FLEE)							task = ON_STATION;						SET_ORBIT_LOC (FragPtr,								NORMALIZE_FACING (LOBYTE (HIWORD (rand_val))));						group_loc = pSolarSysState->SunDesc[0].NumPlanets;						if (group_loc == 1 && task == EXPLORE)							task = IN_ORBIT;						else							group_loc = (BYTE)((									HIBYTE (LOWORD (rand_val)) % group_loc									) + 1);						SET_GROUP_DEST (FragPtr, group_loc);						rand_val = Random ();						FragPtr->ShipInfo.loc.x =								(LOWORD (rand_val) % 10000) - 5000;						FragPtr->ShipInfo.loc.y =								(HIWORD (rand_val) % 10000) - 5000;						if (task == EXPLORE)							FragPtr->ShipInfo.group_counter =									((COUNT)Random ()									% MAX_REVOLUTIONS)									<< FACING_SHIFT;						else						{							FragPtr->ShipInfo.group_counter = 0;							if (task == ON_STATION)							{								COUNT angle;								POINT org;								XFormIPLoc (										&pSolarSysState->PlanetDesc[												group_loc - 1												].image.origin,										&org,										FALSE										);								angle = FACING_TO_ANGLE (										GET_ORBIT_LOC (FragPtr) + 1										);								FragPtr->ShipInfo.loc.x = org.x										+ COSINE (angle, STATION_RADIUS);								FragPtr->ShipInfo.loc.y = org.y										+ SINE (angle, STATION_RADIUS);								group_loc = 0;							}						}						SET_GROUP_MISSION (FragPtr, task);						SET_GROUP_LOC (FragPtr, group_loc);#ifdef DEBUGprintf ("battle group %u(0x%04x) strength %u, type %u, loc %u<%d, %d>, task %u\n",which_group,hStarShip,NumShips,RaceType,group_loc,FragPtr->ShipInfo.loc.x,FragPtr->ShipInfo.loc.y,task);#endif /* DEBUG */						UnlockStarShip (								&GLOBAL (npc_built_ship_q), hStarShip								);					}				}				if (offset)					InitGroupInfo (FALSE);						/* Random battle group */				else if (ValidateEvent (ABSOLUTE_EVENT, /* still fresh */						&month_index, &day_index, &year_index))				{					CloseResFile (fp);					return (TRUE);				}			}		}		else if (GH.GroupOffset[which_group])		{			BYTE BaseGroup;			COUNT ShipsLeft;			ShipsLeft = CountLinks (&GLOBAL (npc_built_ship_q));			if (which_group == 0)			{				SeekResFile (fp, GH.GroupOffset[0], SEEK_SET);				ReadResFile (&BaseGroup, sizeof (BaseGroup), 1, fp);				if (BaseGroup)				{					if (GLOBAL (BattleGroupRef))						PutGroupInfo (GLOBAL (BattleGroupRef), BaseGroup);					else						FlushGroupInfo (&GH, offset, BaseGroup, fp);				}			}			else			{				cur_player = (SIZE)which_group;				if (offset)					PutGroupInfo (0L, 0);				else					FlushGroupInfo (&GH, 0L, 0, fp);				BaseGroup = which_group;			}			ReinitQueue (&GLOBAL (npc_built_ship_q));			SeekResFile (fp, GH.GroupOffset[which_group]					+ sizeof (BaseGroup), SEEK_SET);			ReadResFile (&NumShips, sizeof (NumShips), 1, fp);			while (NumShips--)			{				PBYTE Ptr;				ReadResFile ((PBYTE)&RaceType, sizeof (RaceType), 1, fp);				hStarShip = CloneShipFragment (RaceType,						&GLOBAL (npc_built_ship_q), 0);				FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (						&GLOBAL (npc_built_ship_q), hStarShip						);				Ptr = (PBYTE)&FragPtr->RaceDescPtr;				ReadResFile ((PBYTE)Ptr,						((PBYTE)&FragPtr->ShipInfo.race_strings) - Ptr,						1, fp);#ifdef DEBUGif (which_group == 0)printf ("G) 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 */				if (GET_GROUP_ID (FragPtr) != BaseGroup						|| which_group						|| ShipsLeft)				{#ifdef DEBUGprintf ("\n");#endif /* DEBUG */					if (RaceType == SHOFIXTI_SHIP							&& which_group							&& !GET_GAME_STATE (SHOFIXTI_RECRUITED))					{						BYTE captains_name_index;						if (!GET_GAME_STATE (SHOFIXTI_KIA))							captains_name_index =									NAME_OFFSET + NUM_CAPTAINS_NAMES;						else							captains_name_index =									NAME_OFFSET + NUM_CAPTAINS_NAMES + 1;						OwnStarShip (FragPtr, BAD_GUY, captains_name_index);					}					UnlockStarShip (							&GLOBAL (npc_built_ship_q), hStarShip							);				}				else				{#ifdef DEBUGprintf (" -- REMOVING\n");#endif /* DEBUG */					UnlockStarShip (							&GLOBAL (npc_built_ship_q), hStarShip							);					RemoveQueue (							&GLOBAL (npc_built_ship_q), hStarShip							);					FreeStarShip (							&GLOBAL (npc_built_ship_q), hStarShip							);				}			}		}		CloseResFile (fp);	}	return (GetHeadLink (&GLOBAL (npc_built_ship_q)) != 0);}