Show the most recent 9 missions at most (really only applies to Alba).

This commit is contained in:
Steve 2016-06-07 08:30:33 +01:00
parent c741216f01
commit 345a45f9c4
2 changed files with 31 additions and 18 deletions

View File

@ -531,7 +531,7 @@ static void selectStarSystem(void)
static void drawStarSystemDetail(void) static void drawStarSystemDetail(void)
{ {
int y; int y, start, i;
Mission *mission; Mission *mission;
SDL_Rect r; SDL_Rect r;
@ -559,7 +559,17 @@ static void drawStarSystemDetail(void)
y += 80; y += 80;
/*
* this only really counts for Alba, as it has 10 missions and there's only space for 9 to display.
* We need to subtract 1 from the completed missions to get the correct number (mission at the bottom will be the one to select).
*/
start = MIN(selectedStarSystem->completedMissions - 1 - MAX_LISTED_MISSIONS, 0);
i = 0;
for (mission = selectedStarSystem->missionHead.next ; mission != NULL ; mission = mission->next) for (mission = selectedStarSystem->missionHead.next ; mission != NULL ; mission = mission->next)
{
if (i >= start)
{ {
mission->rect.x = 200; mission->rect.x = 200;
mission->rect.y = y - 2; mission->rect.y = y - 2;
@ -582,6 +592,7 @@ static void drawStarSystemDetail(void)
y += 50; y += 50;
} }
}
if (game.currentMission->available) if (game.currentMission->available)
{ {

View File

@ -27,6 +27,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SHOW_STATS 4 #define SHOW_STATS 4
#define SHOW_TROPHIES 5 #define SHOW_TROPHIES 5
#define MAX_LISTED_MISSIONS 9
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...); extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
extern void initBattle(void); extern void initBattle(void);
extern void loadMission(char *filename); extern void loadMission(char *filename);