Auto select next available mission when clicking on a star system.

This commit is contained in:
Steve 2016-07-24 08:24:04 +01:00
parent f5aa0b3f85
commit a0c2b1e9f6
1 changed files with 17 additions and 1 deletions

View File

@ -47,6 +47,7 @@ static void returnFromOptions(void);
static void doStarSystemView(void);
static void updatePandoranAdvance(void);
static void fallenOK(void);
static Mission *nextAvailableMission(StarSystem *starSystem);
static StarSystem *selectedStarSystem;
static SDL_Texture *background;
@ -556,11 +557,26 @@ static void selectStarSystem(void)
{
show = SHOW_STAR_SYSTEM;
STRNCPY(game.selectedStarSystem, selectedStarSystem->name, MAX_NAME_LENGTH);
game.currentMission = selectedStarSystem->missionHead.next;
game.currentMission = nextAvailableMission(selectedStarSystem);
playSound(SND_GUI_SELECT);
}
}
static Mission *nextAvailableMission(StarSystem *starSystem)
{
Mission *m;
for (m = starSystem->missionHead.next ; m != NULL ; m = m->next)
{
if (m->available && !m->completed)
{
return m;
}
}
return starSystem->missionHead.next;
}
static void drawStarSystemDetail(void)
{
int y, start, i;