From c090942f81806d03a1e1fccad22c5744336a2a27 Mon Sep 17 00:00:00 2001 From: Steve Date: Fri, 20 May 2016 09:51:53 +0100 Subject: [PATCH] Implemented updateEntitySide(). --- src/battle/entities.c | 14 +++++++++++++- src/battle/entities.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/battle/entities.c b/src/battle/entities.c index 7a10b73..1b45772 100644 --- a/src/battle/entities.c +++ b/src/battle/entities.c @@ -665,8 +665,20 @@ void killEntity(char *name) } } -void updateEntitySide(char *side, char *entity) +void updateEntitySide(char *sideStr, char *name) { + Entity *e; + int side; + + side = lookup(sideStr); + + for (e = battle.entityHead.next ; e != NULL ; e = e->next) + { + if (strcmp(e->name, name) == 0) + { + e->side = side; + } + } } void destroyEntities(void) diff --git a/src/battle/entities.h b/src/battle/entities.h index a9b99ac..872a252 100644 --- a/src/battle/entities.h +++ b/src/battle/entities.h @@ -36,6 +36,7 @@ extern void addToQuadtree(Entity *e, Quadtree *root); 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 App app; extern Battle battle;