From 9ecdd106dcd5cf52073faf40ebd60560b598b4a6 Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 24 May 2016 11:46:20 +0100 Subject: [PATCH] Only award PANDORAN trophy at end of successful mission. --- src/battle/entities.c | 13 +++++++++++++ src/battle/entities.h | 1 + src/battle/fighters.c | 5 ----- src/battle/fighters.h | 1 - src/game/trophies.c | 2 ++ src/game/trophies.h | 1 + 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/battle/entities.c b/src/battle/entities.c index 1b45772..30431d7 100644 --- a/src/battle/entities.c +++ b/src/battle/entities.c @@ -681,6 +681,19 @@ void updateEntitySide(char *sideStr, char *name) } } +void awardPandoranCraftTrophy(void) +{ + Entity *e; + + for (e = deadHead.next ; e != NULL ; e = e->next) + { + if (e->killedBy == player && e->side == SIDE_PANDORAN) + { + awardTrophy("PANDORAN"); + } + } +} + void destroyEntities(void) { Entity *e; diff --git a/src/battle/entities.h b/src/battle/entities.h index 872a252..2cff27f 100644 --- a/src/battle/entities.h +++ b/src/battle/entities.h @@ -37,6 +37,7 @@ extern void updateCapitalShipComponentProperties(Entity *parent, long flags); extern Entity **getAllEntsWithin(int x, int y, int w, int h, Entity *ignore); extern int isOnBattleScreen(int x, int y, int w, int h); extern long lookup(char *name); +extern void awardTrophy(char *id); extern App app; extern Battle battle; diff --git a/src/battle/fighters.c b/src/battle/fighters.c index 46177a6..e2877d7 100644 --- a/src/battle/fighters.c +++ b/src/battle/fighters.c @@ -582,11 +582,6 @@ static void die(void) { battle.stats[STAT_EPIC_KILL_STREAK]++; } - - if (self->side == SIDE_PANDORAN) - { - awardTrophy("PANDORAN"); - } } if (self->flags & EF_DROPS_ITEMS) diff --git a/src/battle/fighters.h b/src/battle/fighters.h index 6c3e118..e77f64b 100644 --- a/src/battle/fighters.h +++ b/src/battle/fighters.h @@ -49,7 +49,6 @@ extern char *getTranslatedString(char *string); extern int getJSONValue(cJSON *node, char *name, int defValue); extern char **toTypeArray(char *types, int *numTypes); extern char *getJSONValueStr(cJSON *node, char *name, char *defValue); -extern void awardTrophy(char *id); extern void addRandomItem(int x, int y); extern void checkSuspicionLevel(void); extern void checkZackariaSuspicionLevel(void); diff --git a/src/game/trophies.c b/src/game/trophies.c index 000aabf..ac0489f 100644 --- a/src/game/trophies.c +++ b/src/game/trophies.c @@ -460,6 +460,8 @@ void awardChallengeTrophies(void) void awardPostMissionTrophies(void) { awardCraftTrophy(); + + awardPandoranCraftTrophy(); if (game.currentMission->epic) { diff --git a/src/game/trophies.h b/src/game/trophies.h index fa06a85..f2c2a82 100644 --- a/src/game/trophies.h +++ b/src/game/trophies.h @@ -40,6 +40,7 @@ extern Widget *getWidget(const char *name, const char *group); extern void drawWidgets(char *groupName); extern char *timeToDate(long millis); extern void textSize(char *text, int size, int *w, int *h); +extern void awardPandoranCraftTrophy(void); extern App app; extern Battle battle;