From 97bd83e7da0a1589f67c0029d021792092f173e3 Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Thu, 4 Apr 2013 18:22:04 +0100
Subject: [PATCH] [Fix] Small bug fixes.

---
 src/space.c | 1 +
 src/spfx.c  | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/space.c b/src/space.c
index a281ee7..e7f947d 100644
--- a/src/space.c
+++ b/src/space.c
@@ -219,6 +219,7 @@ char** space_getFactionPlanet(int* nplanets, int* factions, int nfactions) {
             tmp = realloc(tmp, sizeof(char*) * mtmp);
           }
           tmp[ntmp-1] = planet->name;
+          break; // No need to check all factions.
         }
     }
   (*nplanets) = ntmp;
diff --git a/src/spfx.c b/src/spfx.c
index 1989943..bf14da3 100644
--- a/src/spfx.c
+++ b/src/spfx.c
@@ -147,7 +147,7 @@ void spfx_clear(void) {
 
 static void spfx_destroy(SPFX* layer, int* nlayer, int spfx) {
   (*nlayer)--;
-  memmove(&layer[spfx], &layer[spfx+1], (*nlayer-spfx-1)*sizeof(SPFX));
+  memmove(&layer[spfx], &layer[spfx+1], (*nlayer-spfx)*sizeof(SPFX));
 }
 
 void spfx_update(const double dt) {