From 6bc5e6d5afcb362842851ea110b54cca1a8175ed Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Sat, 3 Aug 2013 13:25:43 +0100
Subject: [PATCH] [Add] You can now specify target graphic different from
 normal gfx.

---
 src/ship.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/ship.c b/src/ship.c
index 913ed4a..0ce237b 100644
--- a/src/ship.c
+++ b/src/ship.c
@@ -126,16 +126,26 @@ static Ship* ship_parse(xmlNodePtr parent) {
   do {
     /* Load all the data. */
     if(xml_isNode(node,"GFX")) {
+
+      /* Load the base graphic. */
       snprintf(str, strlen(xml_get(node)) +
                sizeof(SHIP_GFX) + sizeof(SHIP_EXT),
                SHIP_GFX"%s"SHIP_EXT, xml_get(node));
       tmp->gfx_space = gl_newSprite(str, 6, 6);
-      /* Target. */
-      snprintf(str, strlen(xml_get(node)) +
-               sizeof(SHIP_GFX)+sizeof(SHIP_TARGET)+sizeof(SHIP_EXT),
-               SHIP_GFX"%s"SHIP_TARGET SHIP_EXT, xml_get(node));
-      tmp->gfx_target = gl_newImage(str);
 
+      xmlr_attr(node, "target", stmp);
+      if(stmp != NULL) {
+        snprintf(str, strlen(stmp) +
+            sizeof(SHIP_GFX)+sizeof(SHIP_TARGET)+sizeof(SHIP_EXT),
+            SHIP_GFX"%s"SHIP_TARGET SHIP_EXT, stmp);
+        tmp->gfx_target = gl_newImage(str);
+        free(stmp);
+      } else { /* Load standard target graphic. */
+        snprintf(str, strlen(xml_get(node)) +
+          sizeof(SHIP_GFX)+sizeof(SHIP_TARGET)+sizeof(SHIP_EXT),
+          SHIP_GFX"%s"SHIP_TARGET SHIP_EXT, xml_get(node));
+        tmp->gfx_target = gl_newImage(str);
+      }
     }
     xmlr_strd(node, "GUI", tmp->gui);
     if(xml_isNode(node, "sound"))