Example #1
0
// called on the master server when the league message is received
void nKrawall::ReceiveLeagueMessage(const tString& message)
{
    //  con << message;

    if (message[0] == 'K')
    {
        tString killer(message.c_str()+1);
        tString victim(message.c_str()+1+killer.Len());

        MasterFrag(killer, victim);
    }
    else if (message[0] == 'R')
    {
        tString numP(message.c_str()+1);
        int pos = 1 + numP.Len();

        int numPlayers = atoi(numP);
        tArray<tString> players(numPlayers);
        for (int i = numPlayers-1; i>=0; i--)
        {
            players(i) = tString(message.c_str()+pos);
            pos += players(i).Len();
        }

        MasterRoundEnd(&players[0], numPlayers);
    }
}
// ----------------------------------------------------------------------------
float * ofOpenALSoundPlayer::getSystemSpectrum(int bands){
	initSystemFFT(bands);
	systemBins.assign(systemBins.size(),0);
	if(players().empty()) return &systemBins[0];

	int signalSize = (bands-1)*2;
	if(int(systemWindowedSignal.size())!=signalSize){
		systemWindowedSignal.resize(signalSize);
	}
	systemWindowedSignal.assign(systemWindowedSignal.size(),0);

	set<ofOpenALSoundPlayer*>::iterator it;
	for(it=players().begin();it!=players().end();it++){
		if(!(*it)->isPlaying()) continue;
		float * buffer = (*it)->getCurrentBufferSum(signalSize);
		for(int i=0;i<signalSize;i++){
			systemWindowedSignal[i]+=buffer[i];
		}
	}

	float normalizer = 2. / windowSum;
	runWindow(systemWindowedSignal);
	kiss_fftr(systemFftCfg, &systemWindowedSignal[0], &systemCx_out[0]);
	for(int i= 0; i < bands; i++) {
		systemBins[i] += sqrtf(systemCx_out[i].r * systemCx_out[i].r + systemCx_out[i].i * systemCx_out[i].i) * normalizer;
	}
	return &systemBins[0];
}
Example #3
0
RoomView::RoomView(QWidget *parent,
                   SocketWrapper *socket,
                   int roomId) :
    QWidget(parent),
    ui(new Ui::RoomView),
    socket(socket),
    roomId(roomId)
{
    ui->setupUi(this);
    ui->roomId->setText(QString::number(roomId));
    connect(this, SIGNAL(getWaitingPlayers()),
            socket, SLOT(getWaitingPlayers()));
    connect(socket, SIGNAL(players(QJsonArray)),
            this, SLOT(players(QJsonArray)));
    connect(this, SIGNAL(leaveRoom()),
            socket, SLOT(leaveRoom()));
    Q_EMIT getWaitingPlayers();
}
Example #4
0
//------------------------------------------------------------------------------
// processFirePDU() callback -- 
//------------------------------------------------------------------------------
void NetIO::processFirePDU(const FirePDU* const pdu)
{
    // Get the Firing Player's ID
    unsigned short fPlayerId = pdu->firingEntityID.ID;
    unsigned short fSiteId = pdu->firingEntityID.simulationID.siteIdentification;
    unsigned short fApplicationId = pdu->firingEntityID.simulationID.applicationIdentification;
    
    //std::cout << "NetIO::processFirePDU() fired";
    //std::cout << "(" << pdu->firingEntityID.ID;
    //std::cout << "," << pdu->firingEntityID.simulationID.applicationIdentification ;
    //std::cout << "," << pdu->firingEntityID.simulationID.siteIdentification;
    //std::cout << ")" << std::endl;
    
    // Ignore our own PDUs
    if (fSiteId == getSiteID() && fApplicationId == getApplicationID()) return;
    
    //pdu->dumpData();
    
    // Get the Munition Player's ID
    unsigned short mPlayerId = pdu->munitionID.ID;
    unsigned short mSiteId = pdu->munitionID.simulationID.siteIdentification;
    unsigned short mApplicationId = pdu->munitionID.simulationID.applicationIdentification;
    
    // Get the Target Player's ID
    unsigned short tPlayerId = pdu->targetEntityID.ID;
    unsigned short tSiteId = pdu->targetEntityID.simulationID.siteIdentification;
    unsigned short tApplicationId = pdu->targetEntityID.simulationID.applicationIdentification;
    
    // ---
    // 1) Find the target (local) player
    // ---
    Simulation::Player* tPlayer = 0;
    if (tSiteId == getSiteID() && tApplicationId == getApplicationID()) {
        // Must be local
        SPtr<Basic::PairStream> players( getSimulation()->getPlayers() );
        tPlayer = getSimulation()->findPlayer(tPlayerId);
    }
    //std::cout << "Net Fire(2) tPlayer = " << tPlayer << std::endl;
    
    // ---
    // 2) Find the firing player and munitions (networked) IPlayers
    // ---
    Simulation::Nib* fNib = 0;
    Simulation::Nib* mNib = 0;
    if (fSiteId != getSiteID() || fApplicationId != getApplicationID()) {
        // Must be networked players
        fNib = findDisNib(fPlayerId, fSiteId, fApplicationId, INPUT_NIB);
        mNib = findDisNib(mPlayerId, mSiteId, mApplicationId, INPUT_NIB);
    }
    //std::cout << "Net Fire(3) fNib = " << fNib << ", mNib = " << mNib << std::endl;

    // --- Nothing really needs to be done.
}
Example #5
0
bool ActiveAnimations::hasActiveAnimations(CSSPropertyID property) const
{
    for (AnimationPlayerSet::const_iterator it = m_players.begin(); it != players().end(); ++it) {
        const AnimationPlayer& player = *it->key;
        ASSERT(player.source());
        // FIXME: Needs to consider AnimationGroup once added.
        ASSERT(player.source()->isAnimation());
        const Animation& animation = *toAnimation(player.source());
        if (animation.isCurrent() && animation.affects(property))
            return true;
    }
    return false;
}
Example #6
0
void UserManagement::saveUsers(QString fileName)
{
    //SAVES THE FILE BY WRITING A NEW ONE WITH THE APPROPRIATE INFORMATION
    QFile players(fileName);
    if (players.open(QFile::WriteOnly|QFile::Truncate))
    {
        QTextStream write(&players);
        for(int i=0; i<userPlayer.size();i++)
        {
            if(userTimestamp[i]!="NULL"&&userPlayer[i]!="NULL")//CHECKS THAT THE USER HASNT BEEN DELETED
            write<<userTimestamp[i]<<":"<<userPlayer[i]<<":"<<userLevel[i]<<"\r\n";
        }
        players.close();
    }

}
// now, the individual sound player:
//------------------------------------------------------------
ofOpenALSoundPlayer::ofOpenALSoundPlayer(){
	bLoop 			= false;
	bLoadedOk 		= false;
	pan 			= 0.0f; // range for oF is -1 to 1,
	volume 			= 1.0f;
	internalFreq 	= 44100;
	speed 			= 1;
	bPaused 		= false;
	isStreaming		= false;
	channels		= 0;
	duration		= 0;
	fftCfg			= 0;
	streamf			= 0;
#ifdef OF_USING_MPG123
	mp3streamf		= 0;
#endif
	players().insert(this);
}
int main(){

    long n; scanf("%ld\n", &n);
    std::vector<std::pair<long, long> > players(n);
    for(long p = 0; p < n; p++){
        long skill; scanf("%ld", &skill);
        players[p] = std::pair<long, long>(skill, p + 1);
    }

    sort(players.begin(), players.end());

    printf("%ld\n", (n + 1) / 2);
    for(long p = 0; p < n; p += 2){printf("%ld ", players[p].second);}
    printf("\n%ld\n", n / 2);
    for(long p = 1; p < n; p += 2){printf("%ld ", players[p].second);}
    puts("");

    return 0;
}
Example #9
0
int main() {
    soci::session sql(soci::sqlite3, "nhl.db");
    
    int count = 0;
    sql << "select count(*) from players", soci::into(count);    
    
    std::vector<int> playerIds(count);
    sql << "select player_id from players order by player_name", 
        soci::into(playerIds);
     
    std::vector<Player> players(count);
    std::cout << "Players\n--------- " << std::endl;
    for (auto& playerId : playerIds) {
        Player player;
        sql << "select * from players where player_id = :playerId",  
            soci::into(player), soci::use(playerId);
        players.push_back(player);
        
        std::cout << player.playerName + " - " + player.pos << std::endl;
    }
    
    return 0;    
}
//------------------------------------------------------------------------------
// processDetonationPDU() callback --
//------------------------------------------------------------------------------
void NetIO::processDetonationPDU(const DetonationPDU* const pdu)
{
   // Get the Firing Player's ID
   unsigned short fPlayerId = pdu->firingEntityID.ID;
   unsigned short fSiteId = pdu->firingEntityID.simulationID.siteIdentification;
   unsigned short fApplicationId = pdu->firingEntityID.simulationID.applicationIdentification;

   // Ignore our own PDUs
   if (fSiteId == getSiteID() && fApplicationId == getApplicationID()) return;

   // Get the Munition Player's ID
   unsigned short mPlayerId = pdu->munitionID.ID;
   unsigned short mSiteId = pdu->munitionID.simulationID.siteIdentification;
   unsigned short mApplicationId = pdu->munitionID.simulationID.applicationIdentification;

   // Get the Target Player's ID
   unsigned short tPlayerId = pdu->targetEntityID.ID;
   unsigned short tSiteId = pdu->targetEntityID.simulationID.siteIdentification;
   unsigned short tApplicationId = pdu->targetEntityID.simulationID.applicationIdentification;

   // ---
   // 1) Find the target player
   // ---
   simulation::Player* tPlayer = nullptr;
   if (tPlayerId != 0 && tSiteId != 0 && tApplicationId != 0) {
      simulation::Nib* tNib = findDisNib(tPlayerId, tSiteId, tApplicationId, OUTPUT_NIB);
      if (tNib != nullptr) {
         tPlayer = tNib->getPlayer();
      }
   }
   //std::cout << "Net kill(2) tPlayer = " << tPlayer << std::endl;

   // ---
   // 2) Find the firing player and munitions (networked) IPlayers
   // ---
   simulation::Player* fPlayer = nullptr;
   if (fPlayerId != 0 && fSiteId != 0 && fApplicationId != 0) {
      simulation::Nib* fNib = findDisNib(fPlayerId, fSiteId, fApplicationId, INPUT_NIB);
      if (fNib != nullptr) {
         fPlayer = fNib->getPlayer();
      }
      else {
         base::safe_ptr<base::PairStream> players( getSimulation()->getPlayers() );
         fPlayer = getSimulation()->findPlayer(fPlayerId);
      }
   }

   simulation::Nib* mNib = nullptr;
   if (mPlayerId != 0 && mSiteId != 0 && mApplicationId != 0) {
      mNib = findDisNib(mPlayerId, mSiteId, mApplicationId, INPUT_NIB);
   }

    //std::cout << "Net kill(3) fNib = " << fNib << ", mNib = " << mNib << std::endl;

   // ---
   // 3) Update the data of the munition's NIB and player
   // ---
   simulation::Weapon* mPlayer = nullptr;
   if (mNib != nullptr) {

      // ---
      // a) Set the munition's NIB to the location of the detonation
      // ---

      // Get the geocentric position, velocity and acceleration from the PDU
      osg::Vec3d geocPos;
      geocPos[base::Nav::IX] = pdu->location.X_coord;
      geocPos[base::Nav::IY] = pdu->location.Y_coord;
      geocPos[base::Nav::IZ] = pdu->location.Z_coord;

      osg::Vec3d geocVel;
      geocVel[base::Nav::IX] = pdu->velocity.component[0];
      geocVel[base::Nav::IY] = pdu->velocity.component[1];
      geocVel[base::Nav::IZ] = pdu->velocity.component[2];

      osg::Vec3d geocAcc(0,0,0);
      osg::Vec3d geocAngles(0,0,0);
      osg::Vec3d arates(0,0,0);

      // (re)initialize the dead reckoning function
      mNib->resetDeadReckoning(
         simulation::Nib::STATIC_DRM,
         geocPos,
         geocVel,
         geocAcc,
         geocAngles,
         arates);

      // Set the NIB's mode to DETONATED
      mNib->setMode(simulation::Player::DETONATED);

      // Find the munition player and set its mode, location and target position
      mPlayer = dynamic_cast<simulation::Weapon*>(mNib->getPlayer());
      if (mPlayer != nullptr) {

         // Munition's mode
         mPlayer->setMode(simulation::Player::DETONATED);

         // munition's position, velocity and acceleration at the time of the detonation
         mPlayer->setGeocPosition(geocPos);
         mPlayer->setGeocVelocity(geocVel);
         mPlayer->setGeocAcceleration(geocAcc);

         // detonation results
         mPlayer->setDetonationResults(simulation::Weapon::Detonation(pdu->detonationResult));

         // Munition's target player and the location of detonation relative to target
         mPlayer->setTargetPlayer(tPlayer,false);
         double x = pdu->locationInEntityCoordinates.component[0];
         double y = pdu->locationInEntityCoordinates.component[1];
         double z = pdu->locationInEntityCoordinates.component[2];
         osg::Vec3 loc(x,y,z);
         mPlayer->setDetonationLocation(loc);

         // Munition's launcher
         if (mPlayer->getLaunchVehicle() == nullptr && fPlayer != nullptr) {
            mPlayer->setLaunchVehicle(fPlayer);
         }
      }
   }

   // ---
   // 4) Check all local players for the effects of the detonation
   // ---
   if (mPlayer != nullptr) {
      mPlayer->checkDetonationEffect();
   }
}
Example #11
0
void ActiveAnimations::cancelAnimationOnCompositor()
{
    for (AnimationPlayerSet::iterator it = m_players.begin(); it != players().end(); ++it)
        it->key->cancelAnimationOnCompositor();
}
// ----------------------------------------------------------------------------
ofOpenALSoundPlayer::~ofOpenALSoundPlayer(){
	unload();
	kiss_fftr_free(fftCfg);
	players().erase(this);
}
Example #13
0
void UserManagement::readUserData(QString fileName)
{
    //READS THE USER.CSV FILE AND PARSES IT ACCORDINGLY
    QFile players(fileName);
    if (players.open(QIODevice::ReadOnly))
    {
        QTextStream reader(&players);
        QString data=reader.readLine();
        QStringList values;
        while(!data.isNull())
        {
            if(data.contains(":"))//checks for garbage that doesnt have :
            {
                values=data.split(":");
                userTimestamp.append(values[0]);
                if(nameValidation(values[1]))//CHECKS FOR NAME VALIDATION
                {
                    userPlayer.append(values[1]);
                }
                else
                {
                    userPlayer.append("");
                    players.remove();
                    userTimestamp.clear();
                    userPlayer.clear();
                    userLevel.clear();
                    saveUsers(fileName);
                    break;
                }
                if(levelValidation(values[2]))//CHECKS FOR LEVEL VALIDATION
                {
                    userLevel.append(values[2]);
                }
                else
                {
                        userPlayer.append("");
                        players.remove();
                        userTimestamp.clear();
                        userPlayer.clear();
                        userLevel.clear();
                        saveUsers(fileName);
                        break;
                    }
                data = reader.readLine();
            }
            else
                break;
        }
        players.close();
    }
    else//CHECKS IF FILE ISNT READ (AKA DOESNT EXIST)
    {

        userPlayer.append("");
        userTimestamp.append("");
        userLevel.append("");
    }
    if(userPlayer.size()==0)//CHECKS IF FILE IS EMPTY
    {
        userPlayer.append("");
        userTimestamp.append("");
        userLevel.append("");
        QMessageBox invalidPlayerData;
        invalidPlayerData.setText("Error! “pvz_players” has invalid player data!\nThe program will run with default settings.\nPlease create a new user.");
        invalidPlayerData.setStandardButtons(QMessageBox::Ok);
        invalidPlayerData.exec();
    }
}
int main(){
  //if( argc != 2)
  //  { cout << "requires localport" << endl; return(-1); }
  //int localport = atoi(argv[1]);
  int localport = 1234; 
  cout << "Hello!" << endl;
  dataholder players("playerlist.txt");
  dataholder highs("highscores.txt");

  string gamemap[15];
  getmap(gamemap);
  cout << "Current map:\n";
  for(int i = 0; i < 15; i++)
    cout << gamemap[i] << endl;  
  cout << "\n\n";
  
  int mainsocket = socket(AF_INET, SOCK_DGRAM, 0);
  if (mainsocket < 0){
    perror("socket creation");
    exit(1);
  }
  sockaddr_in localinfo;
  //localinfo.sin_len = sizeof(localinfo);
  localinfo.sin_family = AF_INET;
  localinfo.sin_addr.s_addr = htonl(INADDR_ANY);
  localinfo.sin_port = htons(localport);

  int r = bind(mainsocket, (sockaddr *) &localinfo, sizeof(localinfo));
  if (r<0){
    perror("bind");
    exit(1);
  }
  printf("ready\n");
  cout << "running on port " << localport << endl;
  
  char buffer[20000];
  int tokcount;
  string tok1;
  string tok2;
  string tok3;
  string tok4;
  string tosend;
  string strbuff;
  int a;
  string findret;

  while(true){
    tosend.clear();
    tokcount = 1;
    //struct sockadder_in incoming_info;
    //unsigned int socklen = sizeof(incoming);
    struct sockaddr_in incoming;
    unsigned int socklen = sizeof(incoming);

    r = recvfrom( mainsocket, &buffer, sizeof(buffer)-1, 0, 
                  (sockaddr *) &incoming, &socklen);
    printf("from %s port %d, %d characters: %s\n",
            inet_ntoa(incoming.sin_addr),
            ntohs(incoming.sin_port),
            r, buffer);
    
    buffer[r] = 0;
    cout << "Received: " << buffer << endl;
    if( r<0 ){
      perror("recvfrom");
      exit(1); }
    buffer[r] = 0;
    strbuff = buffer;
    // change to loop when adding data structures
    a = totoken(strbuff,tok1);
    if (a >= 0){
      tokcount++;
      a = totoken(strbuff,tok2);
      if (a >= 0){
        tokcount++;
        a = totoken(strbuff,tok3);
        if( a >= 0){
          tokcount++;
          a = totoken(strbuff,tok4);
          if( a >=0)
            tokcount++; } } }
    cout << "tokcount-> " << tokcount << endl;
    if (tokcount == 2){ // FINP, DELP, FINM, FINH, WINNER
      cout << "tok1: " << tok1 << "  tok2: " << tok2 << endl;
      string comp = "WIN";
      if(tok1 == "WINNER" || tok1 == "WIN" || tok1 == comp)
       cout << "They are the same\n";
      if( tok1 == "FINP" ){
        a = players.find(tok2,findret);
        if( a == -1)
          tosend = "could not find";
        else{
          tosend = "PLR:";
          tosend += findret;
        }
      }
      else if(tok1 == "WINNER" || tok1 == "WIN" || tok1 == comp){
        r = recvfrom( mainsocket, &buffer, sizeof(buffer)-1, 0, 
                  (sockaddr *) &incoming, &socklen);
        buffer[r] = 0;
        cout << "ABOUT TO ADD: " << buffer << " TO HIGHSCORES\n";	
        highs.highadd(buffer);
        cout << "Added " << buffer << " to highscores\n";
        tosend = "good";
      }
      else if (tok1 == "DELP"){
        a = players.find(tok2,findret);
        if( a == -1)
          tosend = "ERR:invalid gamertag";
        else{
          players.take(a-1,a+3);
          tosend = "good\n";}
      }
      else if (tok1 == "FINM"){
        tosend = "good";
      }
      else if( tok1 == "FINH"){
        a = highs.find(tok2,findret);
        if( a == -1)
          tosend = "cound not find";
        else{
          tosend = "SCO:";
          tosend += findret;
        }
      }
      else { tosend = "ERR: invalid first token"; }
    }
    else if (tokcount == 3){// ADDM
      cout << "tok1: " << tok1 << "  tok2: " << tok2 << "  tok3: " << tok3<< endl;
      if( tok1 == "ADDM"){
        tosend = "good";
      }
      else 
        tosend = "ERR: invalid first token";
    }
    else if (tokcount == 4){// ADDH, ADDP, U
       cout << "tok1: " << tok1 << "  tok2: " << tok2 << "  tok3: " << tok3 << "  tok4: " << tok4 << endl;
      if(tok1 == "U"){
        players.find(tok2, findret);
        tosend += tok2;
        tosend += ':';
        tosend += tok3;
        tosend += ':';
        tosend += tok4;
        cout << "Comparing tosend and findret\n";
        cout << "Tosend: " << tosend << "   findret: " << findret << endl;
        if(tosend == findret)
         tosend = '1';
        else tosend = '0';
      }
      else if (tok1 == "ADDP"){
        a = players.find(tok3,findret);
        if(a == -1){
          players.add(4,tok2,tok3,tok4);
          tosend = "good";
        }
        else tosend = "ERR:gamertag taken";
      }
      else if( tok1 == "ADDH"){
        tosend = "good";
      }
    }
    else {
      if (tok1 == "off") tosend = "off";
      else if (tok1 == "save"){
        players.writeout(); //finish later
        highs.writeout();
      }
      else if (tok1 == "MAP"){
        for( int i = 0; i < 15; i++){
          tosend += gamemap[i];
          tosend += '!';
        }
      }
      else  tosend = "ERR: invalid message structure";}

    cout << "---REPONSE---\n" << tosend << endl << endl;

    r = sendto(mainsocket, tosend.c_str(), strlen(tosend.c_str()), 0,
               (sockaddr *) &incoming, sizeof(incoming));
    if (r<0){
      perror("sendto");
      exit(1); }
    if( tok1 == "off" ) break;
  }
 
  return 0;
}
Example #15
0
File: LevelGrid.cpp Project: ofx/dr
void LevelGrid::InitializeLevel(void)
{
    // Give the level vertices some space
    this->m_LeftLevelVertices  = (hgeVector**) malloc(sizeof(hgeVector*) * this->m_NumY);
    this->m_RightLevelVertices = (hgeVector**) malloc(sizeof(hgeVector*) * this->m_NumY);

    // Create some storage for track indices
    this->m_LeftLevelIndices  = (unsigned int*) malloc(sizeof(unsigned int) * this->m_NumY);
    this->m_RightLevelIndices = (unsigned int*) malloc(sizeof(unsigned int) * this->m_NumY);

    // Retrieve the list of players to generate activators
    std::list<Player*> *p = this->m_PlayerManager->GetPlayers();

    // Constructed the grid vertices, now build the level
    for (int i = 0 ; i < this->m_NumY ; ++i)
    {
        // Construct the left and right vertexlist
        this->m_LeftLevelVertices[i]  = this->m_GridVertices[i][StartX];
        this->m_RightLevelVertices[i] = this->m_GridVertices[i][StartX + this->m_TrackWidth];

        // Store indices
        this->m_LeftLevelIndices[i]  = StartX;
        this->m_RightLevelIndices[i] = StartX + this->m_TrackWidth;

        // Only create a "turn" every 2 vertices vertical
        if (i % 2 == 0)
        {
            int lr = rand() % 3 - 1;

            if (StartX + lr < (this->m_NumX - this->m_TrackWidth) && StartX + lr > 0)
            {
                StartX += lr;
            }
        }
    }

    // Create a vector from the list, we need direct lookup
    std::vector<Player*> players(p->begin(), p->end());
    
    // Initialize the number of activators
    this->m_NumActivators = 0;

    // Only add activators whenever there are players
    if (players.size() > 0)
    {
        // Determine the vertical distribution for activators
        int verticalDistribution = this->m_NumY / (players.size() * NUM_ACTIVATORS);

        // Create the activator array
        this->m_Activators = (Activator**) malloc(sizeof(Activator*) * (this->m_NumActivators = NUM_ACTIVATORS * players.size()));

        // This feels a bit hackish...
        std::vector<std::vector<unsigned int>> activatorTypes;
        for (int i = 0 ; i < players.size() ; ++i)
        {
            std::vector<unsigned int> activators;
            for (int j = 0 ; j < NUM_ACTIVATORS ; ++j)
            {
                activators.push_back(j);
            }
            std::random_shuffle(activators.begin(), activators.end());
            activatorTypes.push_back(activators);
        }
        std::random_shuffle(activatorTypes.begin(), activatorTypes.end());

        // Retrieve viewport
        unsigned int width = this->m_Engine->GetWidth();
        unsigned int height = this->m_Engine->GetHeight();

        // Determine deltas
        float dx = width / this->m_NumX;
        float dy = height / this->m_NumY;

        // Define the activator length list
        ACTIVATOR_LENGTH_LIST;

        // Run through the players and then run though activators to make sure that
        // we're never generating two activators for one player in sequence
        int y = 0;
        int n = 0;
        std::vector<std::vector<unsigned int>>::const_iterator it;
        for (int i = 0 ; i < NUM_ACTIVATORS ; ++i)
        {
            int k = 0;
            for (it = activatorTypes.begin() ; it != activatorTypes.end() ; ++it)
            {
                // Fetch a random int between left and right on track y
                int x = (rand() % ((this->m_RightLevelIndices[y] - 2) - (this->m_LeftLevelIndices[y] + 2))) + (this->m_LeftLevelIndices[y] + 2);
        
                // Fetch the activator type pointed to by i
                unsigned int activatorType = (*it).at(i);

                // Offset y in some direction
                srand(x * y);
                int offsetY = rand() % 5;
            
                if (y + offsetY >= this->m_NumY)
                {
                    y -= offsetY;
                }
                else
                {
                    y += offsetY;
                }

                // Get the selected vertex
                hgeVector *vec = this->m_GridVertices[y][x];

                // Create a new activator instance
                Activator *activator = new Activator();

                // Set the type
                activator->ActivatorType = activatorType;

                // Set the owner
                activator->Owner = players.at(k++);

                // In case the activator type is one of type weapon (pickup), add a random weapon to the activator
                if (activatorType == ACTIVATOR_TYPE_WEAPON)
                {
                    // Get a random index
                    int index = rand() % NUM_WEAPONS;

                    switch (index)
                    {
                        case WEAPON_INDEX_NEOSHOOTER:
                            activator->Data = new Neoshooter(activator->Owner, this->m_Engine->GetWorld());
                            break;
                        case WEAPON_INDEX_TRISCEPTRE:
                            activator->Data = new Trisceptre(activator->Owner, this->m_Engine->GetWorld());
                            break;
                    }
                }
            
                // Define the vertices
                activator->Vertices[0] = *vec; activator->Vertices[1] = *vec;
                activator->Vertices[2] = *vec; activator->Vertices[3] = *vec;

                // Offset the vertices conform winding
                activator->Vertices[1].x -= dx;
                activator->Vertices[2].x -= dx; activator->Vertices[2].y -= dy * ACTIVATOR_LENGTH_LIST_NAME[activatorType];
                activator->Vertices[3].y -= dy * ACTIVATOR_LENGTH_LIST_NAME[activatorType];

                // Add the activator
                this->m_Activators[n++] = activator;
            }

            // Increase the vertical pointer
            y += verticalDistribution;
        }
    }
}