From 318e3cd19ef771efc0962aefaea1fe3a70c0e7c4 Mon Sep 17 00:00:00 2001 From: Cong Date: Tue, 10 Dec 2013 21:20:45 +1100 Subject: [PATCH] Complete message for explore objectives (#198) --- src/cdogs/mission.c | 21 +++++++++++++-------- src/cdogs/mission.h | 1 + src/game.c | 1 + 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/cdogs/mission.c b/src/cdogs/mission.c index 621a3c9fe..ae62dbda6 100644 --- a/src/cdogs/mission.c +++ b/src/cdogs/mission.c @@ -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) { @@ -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; } diff --git a/src/cdogs/mission.h b/src/cdogs/mission.h index a1996de65..2bf1317c8 100644 --- a/src/cdogs/mission.h +++ b/src/cdogs/mission.h @@ -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); diff --git a/src/game.c b/src/game.c index b837d25b4..18247fd77 100644 --- a/src/game.c +++ b/src/game.c @@ -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