Auto select first challenge when coming from title.

This commit is contained in:
Steve 2016-03-02 22:24:59 +00:00
parent 2c71b16e17
commit 05185950e4
4 changed files with 12 additions and 5 deletions

View File

@ -74,8 +74,6 @@ void initChallengeHome(void)
planet.x = rand() % SCREEN_WIDTH;
planet.y = rand() % SCREEN_HEIGHT;
game.currentMission = NULL;
startIndex = 0;
show = SHOW_CHALLENGES;
@ -93,6 +91,13 @@ void initChallengeHome(void)
getWidget("ok", "stats")->action = statsOK;
/* select first challenge if none chosen */
if (!game.currentMission)
{
game.currentMission = game.challengeMissionHead.next;
updateChallengeMissionData();
}
endSectionTransition();
playMusic("music/covert_operations.mp3");
@ -107,9 +112,7 @@ static void unlockChallenges(void)
for (m = game.challengeMissionHead.next ; m != NULL ; m = m->next)
{
m->available = i <= completedChallenges;
m->available = 1;
m->available = (i <= completedChallenges || dev.debug);
completedChallenges += m->completedChallenges;
totalChallenges += m->totalChallenges;

View File

@ -63,4 +63,5 @@ extern char *getChallengeDescription(Challenge *c);
extern App app;
extern Battle battle;
extern Colors colors;
extern Dev dev;
extern Game game;

View File

@ -215,6 +215,8 @@ static void campaign(void)
static void challenges(void)
{
game.currentMission = NULL;
initChallengeHome();
}

View File

@ -59,4 +59,5 @@ extern void updateAllMissions(void);
extern App app;
extern Battle battle;
extern Colors colors;
extern Game game;
extern Entity *self;