Example #1
0
 /** Returns true if the split screen display leaves an empty space that
  *  can be used to display the minimap.
  */
 bool getIfEmptyScreenSpaceExists() const
 {
     const float sqrt_num_players = sqrtf((float)getNumLocalPlayers());
     const int rows = (int)ceil(sqrt_num_players);
     const int cols = (int)round(sqrt_num_players);
     const int total_spaces = rows * cols;
     return (total_spaces - getNumLocalPlayers() > 0);
 }   // getIfEmptyScreenSpaceExists
Example #2
0
/** Receive and store the information from sendKartsInformation()
*/
void RaceManager::setupPlayerKartInfo()
{

    std::vector<RemoteKartInfo> kart_info;

    // Get the local kart info
    for(unsigned int i=0; i<getNumLocalPlayers(); i++)
        kart_info.push_back(getLocalKartInfo(i));

    // Now sort by (hostid, playerid)
    std::sort(kart_info.begin(), kart_info.end());

    // Set the player kart information
    setNumPlayers(kart_info.size());

    // Set the global player ID for each player
    for(unsigned int i=0; i<kart_info.size(); i++)
    {
        kart_info[i].setGlobalPlayerId(i);
        setPlayerKart(i, kart_info[i]);
    }

    computeRandomKartList();
}   // setupPlayerKartInfo