rem: GET_GAME_STATE (FOUND_PLUTO_SPATHI) ) == 1 ? 1 : 0
add: GET_GAME_STATE (FOUND_PLUTO_SPATHI) == 1 ) ? 1 : 0
context: ActivateStarShip (COUNT which_ship, SIZE state){	HSTARSHIP hStarShip, hNextShip;	hStarShip = GetStarShipFromIndex (			&GLOBAL (avail_race_q), which_ship			);	if (hStarShip)	{		switch (state)		{			case SPHERE_TRACKING:			case SPHERE_KNOWN:			{				EXTENDED_SHIP_FRAGMENTPTR StarShipPtr;				StarShipPtr = (EXTENDED_SHIP_FRAGMENTPTR)LockStarShip (						&GLOBAL (avail_race_q), hStarShip						);				if (state == SPHERE_KNOWN)					which_ship = StarShipPtr->ShipInfo.known_strength;				else if (StarShipPtr->ShipInfo.actual_strength == 0)				{					if (!(StarShipPtr->ShipInfo.ship_flags							& (GOOD_GUY | BAD_GUY)))						which_ship = 0;				}				else if (StarShipPtr->ShipInfo.known_strength == 0						&& StarShipPtr->ShipInfo.actual_strength != (COUNT)~0)				{					StarShipPtr->ShipInfo.known_strength = 1;					StarShipPtr->ShipInfo.known_loc =							StarShipPtr->ShipInfo.loc;				}				UnlockStarShip (						&GLOBAL (avail_race_q), hStarShip						);				return (which_ship);			}			case ESCORT_WORTH:			{				COUNT ShipCost[] =				{					RACE_SHIP_COST				};				COUNT total = 0;				for (hStarShip = GetHeadLink (&GLOBAL (built_ship_q));						hStarShip; hStarShip = hNextShip)				{					SHIP_FRAGMENTPTR StarShipPtr;					StarShipPtr = (SHIP_FRAGMENTPTR) LockStarShip (							&GLOBAL (built_ship_q), hStarShip);					hNextShip = _GetSuccLink (StarShipPtr);					total += ShipCost[GET_RACE_ID (StarShipPtr)];					UnlockStarShip (&GLOBAL (built_ship_q), hStarShip);				}				return total;			}			case ESCORTING_FLAGSHIP:			{				for (hStarShip = GetHeadLink (&GLOBAL (built_ship_q));						hStarShip; hStarShip = hNextShip)				{					BYTE ship_type;					SHIP_FRAGMENTPTR StarShipPtr;					StarShipPtr = (SHIP_FRAGMENTPTR) LockStarShip (							&GLOBAL (built_ship_q), hStarShip);					hNextShip = _GetSuccLink (StarShipPtr);					ship_type = GET_RACE_ID (StarShipPtr);					UnlockStarShip (&GLOBAL (built_ship_q), hStarShip);					if ((COUNT) ship_type == which_ship)						return 1;				}				return 0;			}			case FEASIBILITY_STUDY:				return (MAX_BUILT_SHIPS						- CountLinks (&GLOBAL (built_ship_q)));			default:			{				SHIP_FRAGMENTPTR StarShipPtr;				if (state <= 0)				{					StarShipPtr = (SHIP_FRAGMENTPTR)LockStarShip (							&GLOBAL (avail_race_q), hStarShip							);					if (state == CHECK_ALLIANCE)					{						state = StarShipPtr->ShipInfo.ship_flags								& (GOOD_GUY | BAD_GUY);						UnlockStarShip (								&GLOBAL (avail_race_q), hStarShip								);						return ((COUNT)state);					}					else if (StarShipPtr->ShipInfo.ship_flags							& (GOOD_GUY | BAD_GUY))					{						StarShipPtr->ShipInfo.ship_flags &= ~(GOOD_GUY | BAD_GUY);						if (state == 0)							StarShipPtr->ShipInfo.ship_flags |= GOOD_GUY;						else						{							StarShipPtr->ShipInfo.ship_flags |= BAD_GUY;							if (which_ship == ORZ_SHIP)							{								BOOLEAN ShipRemoved;								ShipRemoved = FALSE;								for (hStarShip = GetHeadLink (										&GLOBAL (built_ship_q										)); hStarShip; hStarShip = hNextShip)								{									BOOLEAN RemoveShip;									SHIP_FRAGMENTPTR StarShipPtr2;									StarShipPtr2 = (SHIP_FRAGMENTPTR)LockStarShip (											&GLOBAL (built_ship_q),											hStarShip											);									hNextShip = _GetSuccLink (StarShipPtr2);									RemoveShip = (BOOLEAN)(											GET_RACE_ID (StarShipPtr2) == ORZ_SHIP											);									UnlockStarShip (											&GLOBAL (built_ship_q),											hStarShip											);									if (RemoveShip)									{										ShipRemoved = TRUE;										RemoveQueue (												&GLOBAL (built_ship_q),												hStarShip												);										FreeStarShip (												&GLOBAL (built_ship_q),												hStarShip												);									}								}																if (ShipRemoved)								{									LockMutex (GraphicsLock);									DeltaSISGauges (UNDEFINED_DELTA,											UNDEFINED_DELTA, UNDEFINED_DELTA);									UnlockMutex (GraphicsLock);								}							}						}					}					UnlockStarShip (							&GLOBAL (avail_race_q), hStarShip							);				}				else				{					/* 'state > 0', add ships to the escorts */					BYTE which_window;					COUNT i;					which_window = 0;					/*  Must... resist... commenting on this code... */					for						(								i = 0;																i < (COUNT)state							&&								(										hStarShip = CloneShipFragment										(												(COUNT)which_ship,												(PQUEUE)(&GLOBAL (built_ship_q)),												(BYTE)												(														(																which_ship == SPATHI_SHIP &&																								GET_GAME_STATE (FOUND_PLUTO_SPATHI)														) == 1 ? 1 : 0												)										)								);							i++						)					{						HSTARSHIP hOldShip;						RemoveQueue (								&GLOBAL (built_ship_q),								hStarShip								);						while ((hOldShip = GetStarShipFromIndex (								&GLOBAL (built_ship_q),								which_window++								)))						{							BYTE win_loc;							StarShipPtr = (SHIP_FRAGMENTPTR)LockStarShip (									&GLOBAL (built_ship_q), hOldShip									);							win_loc = GET_GROUP_LOC (StarShipPtr);							UnlockStarShip (									&GLOBAL (built_ship_q), hOldShip									);							if (which_window <= win_loc)								break;						}						StarShipPtr = (SHIP_FRAGMENTPTR)LockStarShip (								&GLOBAL (built_ship_q), hStarShip								);						SET_GROUP_LOC (StarShipPtr, which_window - 1);						if (which_ship == SPATHI_SHIP								&& GET_GAME_STATE (FOUND_PLUTO_SPATHI) == 1)						{							OwnStarShip (StarShipPtr,									GOOD_GUY,									NAME_OFFSET + NUM_CAPTAINS_NAMES);						}						UnlockStarShip (								&GLOBAL (built_ship_q), hStarShip								);						InsertQueue (								&GLOBAL (built_ship_q),								hStarShip, hOldShip								);					}					LockMutex (GraphicsLock);					DeltaSISGauges (UNDEFINED_DELTA,							UNDEFINED_DELTA, UNDEFINED_DELTA);					UnlockMutex (GraphicsLock);					return (i);				}				break;			}		}		return (1);	}	return (0);}