void AlliancesWindow::Update() { // // Build a list of all teams; LList<Team *> teams; for( int i = 0; i < g_app->GetWorld()->m_teams.Size(); ++i ) { Team *team = g_app->GetWorld()->m_teams[i]; teams.PutData( team ); } // // Now put the other teams in, in alliance order int currentIndex = 0; while( teams.Size() > 0 ) { Team *baseTeam = teams[0]; m_teamOrder[currentIndex] = baseTeam->m_teamId; ++currentIndex; teams.RemoveData(0); for( int i = 0; i < teams.Size(); ++i ) { Team *possibleAlly = teams[i]; if( possibleAlly->m_allianceId == baseTeam->m_allianceId ) { m_teamOrder[currentIndex] = possibleAlly->m_teamId; ++currentIndex; teams.RemoveData(i); --i; } } } // // Are there any votes we can see? for( int i = 0; i < MAX_TEAMS; ++i ) { m_votes[i] = -1; } currentIndex = 0; for( int i = 0; i < g_app->GetWorld()->m_votingSystem.m_votes.Size(); ++i ) { if( g_app->GetWorld()->m_votingSystem.m_votes.ValidIndex(i) ) { Vote *vote = g_app->GetWorld()->m_votingSystem.m_votes[i]; if( vote->m_result == Vote::VoteUnknown && vote->CanSeeVote( g_app->GetWorld()->m_myTeamId ) ) { m_votes[currentIndex] = i; ++currentIndex; } } } // // Make sure we are the right size m_h = 120 + g_app->GetWorld()->m_teams.Size() * 42; m_h += currentIndex * 45; if( currentIndex > 0 ) m_h += 10; m_h = max(m_h, 300 ); GetButton("Close")->m_y = m_h - 25; }