Skip to content

Commit

Permalink
Complete message for explore objectives (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
cxong committed Dec 10, 2013
1 parent ea3ac38 commit 318e3cd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/cdogs/mission.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,18 @@ void SetPaletteRanges(int wall_range, int floor_range, int room_range, int alt_r
SetRange(ALT_COLORS, abs(alt_range) % COLORRANGE_COUNT);
}

void MissionSetMessageIfComplete(struct MissionOptions *options)
{
if (CanCompleteMission(options))
{
GameEvent msg;
msg.Type = GAME_EVENT_SET_MESSAGE;
strcpy(msg.u.SetMessage.Message, "Mission Complete");
msg.u.SetMessage.Ticks = -1;
GameEventsEnqueue(&gGameEvents, msg);
}
}

int CheckMissionObjective(
struct MissionOptions *options, int flags, ObjectiveType type)
{
Expand All @@ -922,14 +934,7 @@ int CheckMissionObjective(
return 0;
}
gMission.objectives[idx].done++;
if (CanCompleteMission(options))
{
GameEvent msg;
msg.Type = GAME_EVENT_SET_MESSAGE;
strcpy(msg.u.SetMessage.Message, "Mission Complete");
msg.u.SetMessage.Ticks = -1;
GameEventsEnqueue(&gGameEvents, msg);
}
MissionSetMessageIfComplete(options);
return 1;
}

Expand Down
1 change: 1 addition & 0 deletions src/cdogs/mission.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ void SetupQuickPlayCampaign(
void SetupMission(int index, int buildTables, CampaignOptions *campaign);
void SetPaletteRanges(int wall_range, int floor_range, int room_range, int alt_range);

void MissionSetMessageIfComplete(struct MissionOptions *options);
// If object is a mission objective, complete it and return true
int CheckMissionObjective(
struct MissionOptions *options, int flags, ObjectiveType type);
Expand Down
1 change: 1 addition & 0 deletions src/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ static void MissionUpdateObjectives(void)
if (mo->type == OBJECTIVE_INVESTIGATE)
{
o->done = ExploredPercentage();
MissionSetMessageIfComplete(&gMission);
}

// Don't draw anything else for optional objectives
Expand Down

0 comments on commit 318e3cd

Please sign in to comment.