int main() {
  Genes machineGenes0{0,0,1};
  Genes bufferGenes0{0,0,1};
  Genes axleGenes0{0,1,1};
  UnitGene unitGenes0{machineGenes0, bufferGenes0, axleGenes0};

  Genes machineGenes1{0,1,0};
  Genes bufferGenes1{0,0,1};
  Genes axleGenes1{0,1,0};
  UnitGene unitGenes1{machineGenes1, bufferGenes1, axleGenes1};

  Genes machineGenes2{0,1,0};
  Genes bufferGenes2{0,0,1};
  Genes axleGenes2{0,1};
  UnitGene unitGenes2{machineGenes2, bufferGenes2, axleGenes2};

  Genes machineGenes3{0,1,0};
  Genes bufferGenes3{0,0,1};
  Genes axleGenes3{0,1,0};
  UnitGene unitGenes3{machineGenes3, bufferGenes3, axleGenes3};

  Individual individual{unitGenes0, unitGenes1, unitGenes2, unitGenes3};

  std::vector<std::vector<double>> missionData;
  void LoadMission(std::vector<std::vector<double>>& );
  LoadMission(missionData);

  std::shared_ptr<Combination> newCombination(new Combination(individual, missionData));
  newCombination->RunMission();
  return 0;
}
Example #2
0
int ExecMultiMenuOption (int nChoice)
{
	int	bUDP = 0, bStart = 0;

tracker.m_bUse = 0;
if ((nChoice == multiOpts.nStartUdpTracker) ||(nChoice == multiOpts.nJoinUdpTracker)) {
	if (gameStates.app.bNostalgia > 1)
		return 0;
	tracker.m_bUse = 1;
	bUDP = 1;
	bStart = (nChoice == multiOpts.nStartUdpTracker);
	}
else if ((nChoice == multiOpts.nStartUdp) || (nChoice == multiOpts.nJoinUdp)) {
	if (gameStates.app.bNostalgia > 1)
		return 0;
	bUDP = 1;
	bStart = (nChoice == multiOpts.nStartUdp);
	}
else if ((nChoice == multiOpts.nStartIpx) || (nChoice == multiOpts.nStartKali) || (nChoice == multiOpts.nStartMCast4))
	bStart = 1;
else if ((nChoice != multiOpts.nJoinIpx) && (nChoice != multiOpts.nJoinKali) &&	(nChoice != multiOpts.nJoinMCast4))
	return 0;
gameOpts->app.bSinglePlayer = 0;
LoadMission (gameData.missions.nLastMission);
if (bUDP && !(InitAutoNetGame () || NetworkGetIpAddr (bStart != 0)))
	return 0;
gameStates.multi.bServer = (nChoice & 1) == 0;
gameStates.app.bHaveExtraGameInfo [1] = gameStates.multi.bServer;
if (bUDP) {
	gameStates.multi.nGameType = UDP_GAME;
	IpxSetDriver (IPX_DRIVER_UDP); 
	if (nChoice == multiOpts.nStartUdpTracker) {
		int n = tracker.ActiveCount (1);
		if (n < -2) {
			if (n == -4)
				MsgBox (NULL, NULL, 1, TXT_OK, TXT_NO_TRACKERS);
			tracker.m_bUse = 0;
			return 0;
			}
		}
	}
else if ((nChoice == multiOpts.nStartIpx) || (nChoice == multiOpts.nJoinIpx)) {
	gameStates.multi.nGameType = IPX_GAME;
	IpxSetDriver (IPX_DRIVER_IPX); 
	}
else if ((nChoice == multiOpts.nStartKali) || (nChoice == multiOpts.nJoinKali)) {
	gameStates.multi.nGameType = IPX_GAME;
	IpxSetDriver (IPX_DRIVER_KALI); 
	}
else if ((nChoice == multiOpts.nStartMCast4) || (nChoice == multiOpts.nJoinMCast4)) {
	gameStates.multi.nGameType = IPX_GAME;
	IpxSetDriver (IPX_DRIVER_MCAST4); 
	}
if (bStart ? NetworkStartGame () : NetworkBrowseGames ())
	return 1;
IpxClose ();
return 0;
}
void select_item(GtkWidget *item, gchar *filename) {
	if (strcmp("dir", filename) == 0) { deselect_item(item, filename); return; }
	LoadMission(filename);

	gtk_label_set_text(GTK_LABEL(labels[0]), DATA.name);
	gtk_label_set_text(GTK_LABEL(labels[1]), DATA.author);
	gtk_label_set_text(GTK_LABEL(labels[2]), DATA.description);
	gtk_label_set_text(GTK_LABEL(labels[3]), DATA.briefing);
}
Example #4
0
int SelectAndLoadMission (int bMulti, int *bAnarchyOnly)
{
	int				i, j, nMissions, nDefaultMission, nNewMission = -1;
	CStack<char*>	msnNames (MAX_MISSIONS);
	CListBox			lb;

	static const char *menuTitles [4];

	menuTitles [0] = TXT_NEW_GAME;
	menuTitles [1] = TXT_NEW_D1GAME;
	menuTitles [2] = TXT_NEW_D2GAME;
	menuTitles [3] = TXT_NEW_GAME;

if (bAnarchyOnly)
	*bAnarchyOnly = 0;
do {
	msnNames.Reset ();
	nMissions = BuildMissionList (1, nNewMission);
	if (nMissions < 1)
		return -1;
	nDefaultMission = 0;
	for (i = 0; i < nMissions; i++) {
		msnNames.Push (gameData.missions.list [i].szMissionName);
		j = MsnHasGameVer (msnNames [i]) ? 4 : 0;
		if (!stricmp (msnNames [i] + j, gameConfig.szLastMission))
			nDefaultMission = i;
		}
	gameStates.app.nExtGameStatus = bMulti ? GAMESTAT_START_MULTIPLAYER_MISSION : GAMESTAT_SELECT_MISSION;
	gameOpts->app.nVersionFilter = NMCLAMP (gameOpts->app.nVersionFilter, 1, 3);
	nNewMission = lb.ListBox (bMulti ? TXT_MULTI_MISSION : menuTitles [gameOpts->app.nVersionFilter], msnNames, nDefaultMission);
	GameFlushInputs ();
	if (nNewMission == -1)
		return -1;      //abort!
	} while (!gameData.missions.list [nNewMission].nDescentVersion);
strcpy (gameConfig.szLastMission, msnNames [nNewMission]);
if (!LoadMission (nNewMission)) {
	MsgBox (NULL, NULL, 1, TXT_OK, TXT_MISSION_ERROR);
	return -1;
	}
gameStates.app.bD1Mission = (gameData.missions.list [nNewMission].nDescentVersion == 1);
gameData.missions.nLastMission = nNewMission;
if (bAnarchyOnly)
	*bAnarchyOnly = gameData.missions.list [nNewMission].bAnarchyOnly;
return nNewMission;
}
Example #5
0
//------------------------------------------------------------------------------
//loads the named mission if exists.
//Returns true if mission loaded ok, else false.
int LoadMissionByName (char *szMissionName, int nSubFolder)
{
	int n, i, j;

if (nSubFolder < 0) {
	*gameFolders.szMsnSubDir = '\0';
	PrintLog ("   searching mission '%s'\n", szMissionName);
	}
n = BuildMissionList (1, nSubFolder);
for (i = 0; i < n; i++)
	if (!stricmp (szMissionName, gameData.missions.list [i].filename))
		return LoadMission (i);
for (i = 0; i < n; i++)
	if (!gameData.missions.list [i].nDescentVersion && strcmp (gameData.missions.list [i].szMissionName, "[..]")) {
		if ((j = LoadMissionByName (szMissionName, i)))
			return j;
		MoveMsnFolderUp ();
		n = BuildMissionList (1, -1);
		}
return 0;		//couldn't ffs mission
}
Example #6
0
void NewGameMenu (void)
{
	CMenu				menu;
	int				optSelMsn, optMsnName, optLevelText, optLevel, optLaunch, optLoadout;
	int				nMission = gameData.missions.nLastMission, bMsnLoaded = 0;
	int				i, choice = 0;
	char				szDifficulty [50];
	char				szLevelText [32];
	char				szLevel [5];
#if DBG
	int				optLives;
	char				szLives [5];
#endif

	static int		nPlayerMaxLevel = 1;
	static int		nLevel = 0;

if (gameStates.app.bNostalgia) {
	LegacyNewGameMenu ();
	return;
	}
gameStates.app.bD1Mission = 0;
gameStates.app.bD1Data = 0;
gameOpts->app.nVersionFilter = 3;
SetDataVersion (-1);
if (nMission < 0)
	gameFolders.szMsnSubDir [0] = '\0';
else if (gameOpts->app.bSinglePlayer) {
	if (!strstr (gameFolders.szMsnSubDir, "single/"))
		nMission = -1;
	gameFolders.szMsnSubDir [0] = '\0';
	}
hogFileManager.UseMission ("");

for (;;) {
	menu.Destroy ();
	menu.Create (15);

	optSelMsn = menu.AddMenu (TXT_SEL_MISSION, KEY_I, HTX_MULTI_MISSION);
	optMsnName = menu.AddText ((nMission < 0) ? TXT_NONE_SELECTED : gameData.missions.list [nMission].szMissionName, 0);
	if ((nMission >= 0) && (nPlayerMaxLevel > 1)) {
		sprintf (szLevelText, "%s (1-%d)", TXT_LEVEL_, nPlayerMaxLevel);
		Assert (strlen (szLevelText) < 100);
		optLevelText = menu.AddText (szLevelText, 0); 
		menu [optLevelText].m_bRebuild = 1;
		sprintf (szLevel, "%d", nLevel);
		optLevel = menu.AddInput (szLevel, 4, HTX_MULTI_LEVEL);
		}
	else
		optLevel = -1;
#if DBG
	menu.AddText ("");
	menu.AddText ("Initial Lives:");
	sprintf (szLives, "%d", gameStates.gameplay.nInitialLives);
	optLives = menu.AddInput (szLives, 4);
#endif
	menu.AddText ("                              ", 0);
	sprintf (szDifficulty + 1, TXT_DIFFICULTY2, MENU_DIFFICULTY_TEXT (gameStates.app.nDifficultyLevel));
	*szDifficulty = *(TXT_DIFFICULTY2 - 1);
	nOptDifficulty = menu.AddSlider (szDifficulty + 1, gameStates.app.nDifficultyLevel, 0, 4, KEY_D, HTX_GPLAY_DIFFICULTY);
	menu.AddText ("", 0);
	optLoadout = menu.AddMenu (TXT_LOADOUT_OPTION, KEY_B, HTX_MULTI_LOADOUT);

	if (nMission >= 0) {
		menu.AddText ("", 0);
		optLaunch = menu.AddMenu (TXT_LAUNCH_GAME, KEY_L, "");
		menu [optLaunch].m_bCentered = 1;
		}
	else
		optLaunch = -1;

	i = menu.Menu (NULL, TXT_NEWGAME_MENUTITLE, NewGameMenuCallback, &choice);
	if (i < 0) {
		SetFunctionMode (FMODE_MENU);
		return;
		}
	if (choice == optLoadout)
		LoadoutOptionsMenu ();
	else if (choice == optSelMsn) {
		i = SelectAndLoadMission (0, NULL);
		if (i >= 0) {
			bMsnLoaded = 1;
			nMission = i;
			nLevel = 1;
			PrintLog ("   getting highest level allowed to play\n");
			nPlayerMaxLevel = GetHighestLevel ();
			if (nPlayerMaxLevel > gameData.missions.nLastLevel)
				nPlayerMaxLevel = gameData.missions.nLastLevel;
			}
		}
	else if (choice == optLevel) {
		i = atoi (menu [optLevel].m_text);
#if DBG
		if (!i || (i < -gameData.missions.nSecretLevels) || (i > nPlayerMaxLevel))
#else
		if ((i <= 0) || (i > nPlayerMaxLevel))
#endif
			MsgBox (NULL, NULL, 1, TXT_OK, TXT_INVALID_LEVEL); 
		else if (nLevel == i)
			break;
		else
			nLevel = i;
		}
	else if (nMission >= 0) {
		if ((optLevel > 0) && !(nLevel = atoi (menu [optLevel].m_text))) {
			MsgBox (NULL, NULL, 1, TXT_OK, TXT_INVALID_LEVEL); 
			nLevel = 1;
			}
		else
			break;
		}
#if DBG
	else {
		i = atoi (menu [optLives].m_text);
		if (i > 0)
			gameStates.gameplay.nInitialLives = min (i, 255);
		}
#endif
	}

i = menu [nOptDifficulty].m_value;
if (gameStates.app.nDifficultyLevel != i) {
	gameStates.app.nDifficultyLevel = i;
	gameData.bosses.InitGateIntervals ();
	}
SavePlayerProfile ();

paletteManager.DisableEffect ();
if (!bMsnLoaded)
	LoadMission (nMission);
if (!StartNewGame (nLevel))
	SetFunctionMode (FMODE_MENU);
}
Example #7
0
void LegacyNewGameMenu (void)
{
	int				nNewLevel, nHighestPlayerLevel;
	int				nMissions;
	CStack<char*>	m (MAX_MISSIONS);
	int				i, choice = 0, nFolder = -1, nDefaultMission = 0;
	CListBox			lb;

	static int		nMission = -1;

	static const char	*menuTitles [4];

menuTitles [0] = TXT_NEW_GAME;
menuTitles [1] = TXT_NEW_D1GAME;
menuTitles [2] = TXT_NEW_D2GAME;
menuTitles [3] = TXT_NEW_GAME;

gameStates.app.bD1Mission = 0;
gameStates.app.bD1Data = 0;
SetDataVersion (-1);
if ((nMission < 0) || gameOpts->app.bSinglePlayer)
	gameFolders.szMsnSubDir [0] = '\0';
hogFileManager.UseMission ("");
do {
	nMissions = BuildMissionList (0, nFolder);
	if (nMissions < 1)
		return;
	for (i = 0; i < nMissions; i++) {
		m.Push (gameData.missions.list [i].szMissionName);
		if (!stricmp (m [i], gameConfig.szLastMission))
			nDefaultMission = i;
		}
	nMission = lb.ListBox (menuTitles [gameOpts->app.nVersionFilter], m, nDefaultMission);
	GameFlushInputs ();
	if (nMission == -1)
		return;         //abort!
	nFolder = nMission;
	}
while (!gameData.missions.list [nMission].nDescentVersion);
strcpy (gameConfig.szLastMission, m [nMission]);
if (!LoadMission (nMission)) {
	MsgBox (NULL, NULL, 1, TXT_OK, TXT_ERROR_MSNFILE); 
	return;
}
gameStates.app.bD1Mission = (gameData.missions.list [nMission].nDescentVersion == 1);
gameData.missions.nLastMission = nMission;
nNewLevel = 1;

PrintLog ("   getting highest level allowed to play\n");
nHighestPlayerLevel = GetHighestLevel ();

if (nHighestPlayerLevel > gameData.missions.nLastLevel)
	nHighestPlayerLevel = gameData.missions.nLastLevel;

if (nHighestPlayerLevel > 1) {
	CMenu	m (2);
	char	szInfo [80];
	char	szNumber [10];

try_again:
	sprintf (szInfo, "%s %d", TXT_START_ANY_LEVEL, nHighestPlayerLevel);
	m.AddText (szInfo, 0);
	strcpy (szNumber, "1");
	m.AddInput (szNumber, 10, "");
	choice = m.Menu (NULL, TXT_SELECT_START_LEV);
	if ((choice == -1) || !m [1].m_text [0])
		return;
	nNewLevel = atoi (m [1].m_text);
	if ((nNewLevel <= 0) || (nNewLevel > nHighestPlayerLevel)) {
		m [0].SetText (const_cast<char*> (TXT_ENTER_TO_CONT));
		MsgBox (NULL, NULL, 1, TXT_OK, TXT_INVALID_LEVEL); 
		goto try_again;
	}
}

SavePlayerProfile ();
if (!DifficultyMenu ())
	return;
paletteManager.DisableEffect ();
if (!StartNewGame (nNewLevel))
	SetFunctionMode (FMODE_MENU);
}
int main() {
  // Declare GA parameters - pop. size, variables, etc
  const int populationSize = 30;
  const int numberOfGenerations = 100;
  const int tournamentSize = 2;
  const double tournamentSelectionParameter = 0.75;
  const float crossOverProbability = 0.7;
  const float creepRateMutation = 0.1;
  const double mutationProbability = 0.05;

  // Vehicle related parameters for chromosome construction
  int numberOfUnits = 4; 			// Including Tractor
  std::vector<int> numberOfAxlesOnEachUnit{3,3,2,3};   // Can be made inputs later
  int numberOfEngines = 3;			// D11, D13, D16
  int numberOfElectricMotors = 3;
  int numberOfElectricBuffers = 3;

  std::vector<int> machineParameters{numberOfEngines, numberOfElectricMotors, numberOfElectricBuffers};
  std::vector<std::vector<int>> vehicleConfigurationParameters{machineParameters, numberOfAxlesOnEachUnit};

  // Initialise the population
  Population population = InitialisePopulation(populationSize, vehicleConfigurationParameters);
  // Check if population is correctly initialised
  std::cout<<"Population initialised"<<std::endl;
  PrintMembersOfPopulation(population);

  // Create files for storing population of each generation & fitnesses of each individual in each generation
  std::fstream populationEachGeneration;
  std::fstream fitnessEachGeneration;   

  //Delete any existing instances of the files to be created
  remove("PopulationEachGeneration.txt");
  remove("FitnessEachGeneration.txt");

  std::vector<double> bestFitnessOverGenerations;

  std::vector<std::vector<double>> missionData;
  LoadMission(missionData);

  // Loop begins - generation evolution start
  for(int generationIndex=0;generationIndex<numberOfGenerations;generationIndex++) {
    std::cout<<"GENERATION NUMBER : "<<generationIndex<<std::endl;
    // Store current population in file PopulationEachGeneration.txt
    //StoreCurrentPopulationInFile(population, populationEachGeneration, rangeAllVariables);

    // Declare variables required for fitness evaluation
    Fitnesses fitness;	// Keep inside scope of each generation
    double tempFitness;     // Keep inside scope of each generation

    // Evaluate the fitness of each member in the population and assign to 'fitness' vector
    fitness = EvaluatePopulationFitness(population, missionData);
    StoreCurrentFitnessInPopulation(fitness, fitnessEachGeneration);

    // Declare variables required for best individual search
    long double maximumFitness;
    int bestIndividualIndex;
    Individual bestIndividual;       

    // Find best individual in the current population
    bestIndividualIndex = GetBestIndividualIndex(fitness); //, population, rangeAllVariables); 
    bestIndividual = population[bestIndividualIndex];
    maximumFitness = fitness[bestIndividualIndex];
    bestFitnessOverGenerations.push_back(maximumFitness);

    //PrintFitness(fitness);
    //std::cout<<"The best Individual is "<<bestIndividualIndex<<std::endl;
    std::cout<<"The optimal function value is "<<maximumFitness<<std::endl;

    // Based on fitness, perform selection & crossover without replacement
    Population tempPopulation;
    tempPopulation = population;

    for(int i=0;i<populationSize;i=i+2) { // i=i+2 since 2 individuals are crossed over
      // Select two random individuals using tournament selection
      std::vector<Individual> individualsToCrossover;  // Both individuals to be crossed over placed in a vector
      for(int j=0;j<tournamentSize;j++) {
        int temporaryIndex=TournamentSelection(fitness, tournamentSelectionParameter, tournamentSize);
        //std::cout<<"Chosen Individual :"<<temporaryIndex<<std::endl;
        individualsToCrossover.push_back(population[temporaryIndex]);
      } // end of Tournament Selection

      // Perform crossover
      // ALGORITHM ONE - INDIVIDUAL UNIT GENE CONSIDERATION FOR CROSSOVER
      std::vector<Individual> crossedOverIndividuals = CrossOver(individualsToCrossover, crossOverProbability);
      tempPopulation[i]=crossedOverIndividuals[0];
      tempPopulation[i+1]=crossedOverIndividuals[1];
	   
      // ALGORITHM TWO - CROSSOVER AT UNIT GENE BOUNDARIES FOR WHOLE INDIVIDUALS
      /*double randomDouble = GetRandomDouble();
      if(randomDouble < crossOverProbability) {
        //std::cout<<"CrossOver Initiated"<<std::endl;
        std::vector<Individual> crossedOverIndividuals = CrossOver(individualsToCrossover);
        tempPopulation[i]=crossedOverIndividuals[0];
        tempPopulation[i+1]=crossedOverIndividuals[1];
      } 
      else {
        // Place original pair of individuals in corresponding (consecutive) locations in tempPopulation
        //std::cout<<"No Crossover"<<std::endl;	
        tempPopulation[i]=individualsToCrossover[0];
        tempPopulation[i+1]=individualsToCrossover[1];
      }  // end of Crossover*/
    } // End of Selection and Crossover

    //std::cout<<std::endl<<"After Crossover"<<std::endl;
    //PrintMembersOfPopulation(tempPopulation);

    // Mutate each individual
    MutatePopulation(tempPopulation, mutationProbability); // Population mutated

    //std::cout<<std::endl<<"After Mutation"<<std::endl;
    //PrintMembersOfPopulation(tempPopulation);

    // Elitism
    tempPopulation[0]=population[bestIndividualIndex];

    for(int i=0;i<tempPopulation.size();i++)
      population[i]=tempPopulation[i];
  } // end of generation loop


  // Declare variables required for final fitness evaluation
  Fitnesses finalFitness;      // Keep inside scope of each generation
  double tempFitness;     // Keep inside scope of each generation

  // Evaluate the fitness of each member in the population and assign to 'fitness' vector
  finalFitness = EvaluatePopulationFitness(population, missionData);
  //PrintFitness(finalFitness);

  // Declare variables required for best individual search
  long double finalMaximumFitness;
  int finalBestIndividualIndex;
  Individual finalBestIndividual;

  // Find best individual in the current population
  finalBestIndividualIndex = GetBestIndividualIndex(finalFitness); //, population, rangeAllVariables); 
  finalBestIndividual = population[finalBestIndividualIndex];
  finalMaximumFitness = finalFitness[finalBestIndividualIndex];

  PrintMembersOfPopulation(population);
  // Check if the best individual is being correctly calculated
  std::cout<<"The best Individual is "<<finalBestIndividualIndex<<std::endl;
  PrintIndividual(population[finalBestIndividualIndex]);
  std::cout<<"The optimal function value is "<<finalMaximumFitness<<std::endl;
  //std::cout<<std::endl;

  std::ofstream fileOperation;
  remove("fitness_vs_generation.txt");
  fileOperation.open("fitness_vs_generation.txt");
  if (fileOperation.is_open()) {
    for(int i=0;i<bestFitnessOverGenerations.size();i++) {
      fileOperation << bestFitnessOverGenerations[i] << '\n';
    }
    fileOperation.close();
  }
}// end of main()
void NetServer::sendLoginAccept( ClientPtr clt, Cockpit *cp )
{
    COUT<<"enter "<<__PRETTY_FUNCTION__<<endl;
    //Verify that client already has a character
    NetBuffer netbuf;
    Unit     *un = cp->GetParent();
    if (!un) {
        sendLoginError( clt );
        return;
    }
    //Put the save parts in buffers in order to load them properly
    netbuf.Reset();

    string datestr = _Universe->current_stardate.GetFullTrekDate();
    netbuf.addString( datestr );
    netbuf.addString( clt->savegame[0] );
    netbuf.addString( clt->savegame[1] );

    Packet    packet2;

    //Create a cockpit for the player and parse its savegame
    ObjSerial cltserial = un->GetSerial();

    COUT<<">>> SEND LOGIN ACCEPT =( serial #"<<cltserial<<" )= --------------------------------------"<<endl;
    COUT<<"SAVE="<<clt->savegame[0].length()<<" bytes - XML="<<clt->savegame[1].length()<<" bytes"<<endl;
    cerr<<"SENDING STARDATE : "<<datestr<<endl;
    //Add the initial star system filename + hash if crypto++ support too
    string sysname = cp->savegame->GetStarSystem();
    string relsys  = sysname+".system";
    netbuf.addString( relsys );

    //Generate the starsystem before addclient so that it already contains serials
    StarSystem    *sts    = zonemgr->addZone( sysname );

#ifdef CRYPTO
    unsigned char *digest = new unsigned char[FileUtil::Hash.DigestSize()];
    string sysxml;
    if ( !( sysxml = zonemgr->getSystem( relsys ) ).empty() )
        FileUtil::HashStringCompute( sysxml, digest );
    else if ( !sysname.empty() )
        FileUtil::HashFileCompute( relsys, digest, SystemFile );
    netbuf.addShort( FileUtil::Hash.DigestSize() );
    netbuf.addBuffer( digest, FileUtil::Hash.DigestSize() );
    delete[] digest;
#else
    netbuf.addShort( 0 );
#endif

    int zoneid = _Universe->StarSystemIndex( sts );
    netbuf.addShort( zoneid );

    //Add system string to packet...
    //Long, I know, but is there any other way to keep all the proper graphics-related data that the server discards?
    //netbuf.addString( zonemgr->getSystem(sysname) );

    packet2.send( LOGIN_ACCEPT, cltserial, netbuf.getData(),
                 netbuf.getDataLength(), SENDRELIABLE, &clt->cltadr, clt->tcp_sock, __FILE__, PSEUDO__LINE__( 241 ) );
    //Now that we have a starsystem, we will want to make a mission.
    if (Mission::getNthPlayerMission( _Universe->whichPlayerStarship( un ), 0 ) == NULL) {
        if (active_missions.size() == 1)
            active_missions[0]->DirectorInitgame();
        //Make a mission specially for this cockpit.
        unsigned int oldcp = _Universe->CurrentCockpit();
        _Universe->SetActiveCockpit( cp );
        _Universe->pushActiveStarSystem( _Universe->AccessCockpit()->activeStarSystem );
        LoadMission( "", vs_config->getVariable( "server", "serverscript", "import server;my_obj=server.player()" ), false );
        _Universe->popActiveStarSystem();
        _Universe->SetActiveCockpit( oldcp );
    }
}