rem: init_probe ();
add: GLOBAL (BattleGroupRef) = GetProbeRef (); if (GLOBAL (BattleGroupRef) == 0) { CloneShipFragment (URQUAN_PROBE_SHIP, &GLOBAL (npc_built_ship_q), 0);  GLOBAL (BattleGroupRef) = PutGroupInfo (~0L, 1); SetProbeRef (GLOBAL (BattleGroupRef)); } if (!init_probe ()) GenerateRandomIP (INIT_NPCS);
context: GenerateSOL (BYTE control){	COUNT i;	DWORD rand_val;	PPLANET_DESC pCurDesc;	switch (control)	{		case INIT_NPCS:			init_probe ();			break;		case REINIT_NPCS:			if (GET_GAME_STATE (CHMMR_BOMB_STATE) != 3)				GenerateRandomIP (REINIT_NPCS);			else			{				GLOBAL (BattleGroupRef) = 0;				ReinitQueue (&GLOBAL (npc_built_ship_q));			}			break;		case GENERATE_ENERGY:			generate_energy_nodes ();			break;		case GENERATE_LIFE:			generate_tractors ();			break;		case GENERATE_ORBITAL:			generate_orbital ();			break;		case GENERATE_NAME:			i = pSolarSysState->pBaseDesc - pSolarSysState->PlanetDesc;			wstrcpy (GLOBAL_SIS (PlanetName), GAME_STRING (PLANET_NUMBER_BASE + i));			SET_GAME_STATE (BATTLE_PLANET,					pSolarSysState->PlanetDesc[i].data_index);			break;		case GENERATE_MOONS:		{			GenerateRandomIP (GENERATE_MOONS);			i = pSolarSysState->pBaseDesc - pSolarSysState->PlanetDesc;			switch (i)			{				case 2: /* moons of EARTH */				{					COUNT angle;					pSolarSysState->MoonDesc[0].data_index = (BYTE)~0;					pSolarSysState->MoonDesc[0].radius = MIN_MOON_RADIUS;					angle = HALF_CIRCLE + QUADRANT;					pSolarSysState->MoonDesc[0].location.x =							COSINE (angle, pSolarSysState->MoonDesc[0].radius);					pSolarSysState->MoonDesc[0].location.y =							SINE (angle, pSolarSysState->MoonDesc[0].radius);					pSolarSysState->MoonDesc[1].data_index = SELENIC_WORLD;					pSolarSysState->MoonDesc[1].radius = MIN_MOON_RADIUS							+ (MAX_MOONS - 1) * MOON_DELTA;					rand_val = TFB_Random ();					angle = NORMALIZE_ANGLE (LOWORD (rand_val));					pSolarSysState->MoonDesc[1].location.x =							COSINE (angle, pSolarSysState->MoonDesc[1].radius);					pSolarSysState->MoonDesc[1].location.y =							SINE (angle, pSolarSysState->MoonDesc[1].radius);					break;				}				case 4: /* moons of JUPITER */					pSolarSysState->MoonDesc[0].data_index = RADIOACTIVE_WORLD;					pSolarSysState->MoonDesc[1].data_index = HALIDE_WORLD;					pSolarSysState->MoonDesc[2].data_index = CYANIC_WORLD;					pSolarSysState->MoonDesc[3].data_index = PELLUCID_WORLD;					break;				case 5: /* moons of SATURN */					pSolarSysState->MoonDesc[0].data_index = ALKALI_WORLD;					break;				case 7: /* moons of NEPTUNE */					pSolarSysState->MoonDesc[0].data_index = VINYLOGOUS_WORLD;					break;			}			break;		}		case GENERATE_PLANETS:		{#define SOL_SEED 334241042L			TFB_SeedRandom (SOL_SEED);			pSolarSysState->SunDesc[0].NumPlanets = 9;			for (i = 0, pCurDesc = pSolarSysState->PlanetDesc; i < 9; ++i, ++pCurDesc)			{				COUNT angle;				UWORD word_val;				pCurDesc->rand_seed = rand_val = TFB_Random ();				word_val = LOWORD (rand_val);				angle = NORMALIZE_ANGLE ((COUNT)HIBYTE (word_val));				switch (i)				{					case 0: /* MERCURY */						pCurDesc->data_index = METAL_WORLD;						pCurDesc->radius = EARTH_RADIUS * 39L / 100;						pCurDesc->NumPlanets = 0;						break;					case 1: /* VENUS */						pCurDesc->data_index = PRIMORDIAL_WORLD;						pCurDesc->radius = EARTH_RADIUS * 72L / 100;						pCurDesc->NumPlanets = 0;						angle = NORMALIZE_ANGLE (FULL_CIRCLE - angle);						break;					case 2: /* EARTH */						pCurDesc->data_index = WATER_WORLD | PLANET_SHIELDED;						pCurDesc->radius = EARTH_RADIUS;						pCurDesc->NumPlanets = 2;						break;					case 3: /* MARS */						pCurDesc->data_index = DUST_WORLD;						pCurDesc->radius = EARTH_RADIUS * 152L / 100;						pCurDesc->NumPlanets = 0;						break;					case 4: /* JUPITER */						pCurDesc->data_index = RED_GAS_GIANT;						pCurDesc->radius = EARTH_RADIUS * 500L /* 520L */ / 100;						pCurDesc->NumPlanets = 4;						break;					case 5: /* SATURN */						pCurDesc->data_index = ORA_GAS_GIANT;						pCurDesc->radius = EARTH_RADIUS * 750L /* 952L */ / 100;						pCurDesc->NumPlanets = 1;						break;					case 6: /* URANUS */						pCurDesc->data_index = GRN_GAS_GIANT;						pCurDesc->radius = EARTH_RADIUS * 1000L /* 1916L */ / 100;						pCurDesc->NumPlanets = 0;						break;					case 7: /* NEPTUNE */						pCurDesc->data_index = BLU_GAS_GIANT;						pCurDesc->radius = EARTH_RADIUS * 1250L /* 2999L */ / 100;						pCurDesc->NumPlanets = 1;						break;					case 8: /* PLUTO */						pCurDesc->data_index = PELLUCID_WORLD;						pCurDesc->radius = EARTH_RADIUS * 1550L /* 3937L */ / 100;						pCurDesc->NumPlanets = 0;						angle = FULL_CIRCLE - OCTANT;						break;				}				pCurDesc->location.x =						COSINE (angle, pCurDesc->radius);				pCurDesc->location.y =						SINE (angle, pCurDesc->radius);			}			break;		}		default:			GenerateRandomIP (control);			break;	}}