MissionPanel::MissionPanel(PlayerInfo &player) : MapPanel(player), available(player.AvailableJobs()), accepted(player.Missions()), availableIt(player.AvailableJobs().begin()), acceptedIt(player.AvailableJobs().empty() ? accepted.begin() : accepted.end()) { while(acceptedIt != accepted.end() && !acceptedIt->IsVisible()) ++acceptedIt; wrap.SetWrapWidth(380); wrap.SetFont(FontSet::Get(14)); wrap.SetAlignment(WrappedText::JUSTIFIED); // Select the first available or accepted mission in the currently selected // system, or along the travel plan. if(!FindMissionForSystem(selectedSystem) && player.HasTravelPlan()) { const auto &tp = player.TravelPlan(); for(auto it = tp.crbegin(); it != tp.crend(); ++it) if(FindMissionForSystem(*it)) break; } // Auto select the destination system for the current mission. if(availableIt != available.end()) selectedSystem = availableIt->Destination()->GetSystem(); else if(acceptedIt != accepted.end()) selectedSystem = acceptedIt->Destination()->GetSystem(); // Center the system slightly above the center of the screen because the // lower panel is taking up more space than the upper one. center = Point(0., -80.) - selectedSystem->Position(); }
MissionPanel::MissionPanel(PlayerInfo &player) : MapPanel(player, -4), available(player.AvailableJobs()), accepted(player.Missions()), availableIt(player.AvailableJobs().begin()), acceptedIt(player.AvailableJobs().empty() ? accepted.begin() : accepted.end()) { while(acceptedIt != accepted.end() && !acceptedIt->IsVisible()) ++acceptedIt; // Center the system slightly above the center of the screen because the // lower panel is taking up more space than the upper one. center = Point(0., -80.) - selectedSystem->Position(); wrap.SetWrapWidth(380); wrap.SetFont(FontSet::Get(14)); wrap.SetAlignment(WrappedText::JUSTIFIED); }