From 3ad64a1d1dc43c524a547957c22eb0a0dce7a4b7 Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 2 Nov 2015 19:10:07 +0000 Subject: [PATCH] Fixed pulse logic. --- src/galaxy/galacticMap.c | 50 ++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/src/galaxy/galacticMap.c b/src/galaxy/galacticMap.c index 93379ad..fc571a2 100644 --- a/src/galaxy/galacticMap.c +++ b/src/galaxy/galacticMap.c @@ -187,31 +187,37 @@ static void addPulses(void) pulseTail->next = pulse; pulseTail = pulse; } - else if (starSystem->completedChallenges < starSystem->totalChallenges && pulseTimer % (FPS * 2) == 0) + else if (starSystem->completedChallenges < starSystem->totalChallenges) { - pulse = malloc(sizeof(Pulse)); - memset(pulse, 0, sizeof(Pulse)); - - pulse->x = starSystem->x; - pulse->y = starSystem->y; - pulse->life = 255; - pulse->r = pulse->g = 255; - - pulseTail->next = pulse; - pulseTail = pulse; + if (pulseTimer % (FPS * 2) == 0) + { + pulse = malloc(sizeof(Pulse)); + memset(pulse, 0, sizeof(Pulse)); + + pulse->x = starSystem->x; + pulse->y = starSystem->y; + pulse->life = 255; + pulse->r = pulse->g = 255; + + pulseTail->next = pulse; + pulseTail = pulse; + } } - else if (starSystem->totalMissions > 0 && pulseTimer % (FPS * 3) == 0) + else if (starSystem->totalMissions > 0) { - pulse = malloc(sizeof(Pulse)); - memset(pulse, 0, sizeof(Pulse)); - - pulse->x = starSystem->x; - pulse->y = starSystem->y; - pulse->life = 255; - pulse->g = 255; - - pulseTail->next = pulse; - pulseTail = pulse; + if (pulseTimer % (FPS * 3) == 0) + { + pulse = malloc(sizeof(Pulse)); + memset(pulse, 0, sizeof(Pulse)); + + pulse->x = starSystem->x; + pulse->y = starSystem->y; + pulse->life = 255; + pulse->g = 255; + + pulseTail->next = pulse; + pulseTail = pulse; + } } } }