Permalink
Browse files

* Added local maps.

  • Loading branch information...
1 parent 1242968 commit df38052eed6c1f111dd3528b6877492c6e951f48 @bobbens committed Mar 25, 2012
Showing with 54 additions and 4 deletions.
  1. +0 −2 src/mapData.h
  2. +44 −2 src/outfit.c
  3. +10 −0 src/outfit.h
View
@@ -16,11 +16,9 @@
* Basically just marks an amount of systems when the player buys it as known.
*/
struct OutfitMapData_s {
-
StarSystem **systems; /**< systems to mark as known. */
JumpPoint **jumps; /**< jump points to mark as known. */
Planet **assets; /**< assets to mark as known. */
-
};
#endif /* MAPDATA_H */
View
@@ -73,6 +73,7 @@ static void outfit_parseSJammer( Outfit *temp, const xmlNodePtr parent );
static void outfit_parseSFighterBay( Outfit *temp, const xmlNodePtr parent );
static void outfit_parseSFighter( Outfit *temp, const xmlNodePtr parent );
static void outfit_parseSMap( Outfit *temp, const xmlNodePtr parent );
+static void outfit_parseSLocalMap( Outfit *temp, const xmlNodePtr parent );
static void outfit_parseSGUI( Outfit *temp, const xmlNodePtr parent );
static void outfit_parseSLicense( Outfit *temp, const xmlNodePtr parent );
@@ -475,6 +476,15 @@ int outfit_isMap( const Outfit* o )
return (o->type==OUTFIT_TYPE_MAP);
}
/**
+ * @brief Checks if outfit is a local space map.
+ * @param o Outfit to check.
+ * @return 1 if o is a map.
+ */
+int outfit_isLocalMap( const Outfit* o )
+{
+ return (o->type==OUTFIT_TYPE_LOCALMAP);
+}
+/**
* @brief Checks if outfit is a license.
* @param o Outfit to check.
* @return 1 if o is a license.
@@ -759,6 +769,7 @@ const char* outfit_getTypeBroad( const Outfit* o )
else if (outfit_isFighterBay(o)) return "Fighter Bay";
else if (outfit_isFighter(o)) return "Fighter";
else if (outfit_isMap(o)) return "Map";
+ else if (outfit_isLocalMap(o)) return "Local Map";
else if (outfit_isGUI(o)) return "GUI";
else if (outfit_isLicense(o)) return "License";
else return "Unknown";
@@ -848,6 +859,7 @@ static OutfitType outfit_strToOutfitType( char *buf )
O_CMP("fighter", OUTFIT_TYPE_FIGHTER);
O_CMP("jammer", OUTFIT_TYPE_JAMMER);
O_CMP("map", OUTFIT_TYPE_MAP);
+ O_CMP("localmap", OUTFIT_TYPE_LOCALMAP);
O_CMP("license", OUTFIT_TYPE_LICENSE);
O_CMP("gui", OUTFIT_TYPE_GUI);
@@ -1763,6 +1775,35 @@ static void outfit_parseSMap( Outfit *temp, const xmlNodePtr parent )
/**
+ * @brief Parses the map tidbits of the outfit.
+ *
+ * @param temp Outfit to finish loading.
+ * @param parent Outfit's parent node.
+ */
+static void outfit_parseSLocalMap( Outfit *temp, const xmlNodePtr parent )
+{
+ xmlNodePtr node;
+ node = parent->children;
+
+ temp->slot.type = OUTFIT_SLOT_NA;
+ temp->slot.size = OUTFIT_SLOT_SIZE_NA;
+
+ do {
+ xml_onlyNodes(node);
+ xmlr_float(node,"hide",temp->u.lmap.hide);
+ WARN("Outfit '%s' has unknown node '%s'",temp->name, node->name);
+ } while (xml_nextNode(node));
+
+
+ /* Set short description. */
+ temp->desc_short = malloc( OUTFIT_SHORTDESC_MAX );
+ nsnprintf( temp->desc_short, OUTFIT_SHORTDESC_MAX,
+ "%s",
+ outfit_getType(temp) );
+}
+
+
+/**
* @brief Parses the GUI tidbits of the outfit.
*
* @param temp Outfit to finish loading.
@@ -1989,6 +2030,8 @@ static int outfit_parse( Outfit* temp, const char* file )
temp->slot.type = OUTFIT_SLOT_NA;
temp->slot.size = OUTFIT_SLOT_SIZE_NA;
}
+ else if (outfit_isLocalMap(temp))
+ outfit_parseSLocalMap( temp, node );
else if (outfit_isGUI(temp))
outfit_parseSGUI( temp, node );
else if (outfit_isLicense(temp))
@@ -2082,8 +2125,7 @@ int outfit_load (void)
* @brief Parses all the maps.
*
*/
-
-int outfit_mapParse()
+int outfit_mapParse (void)
{
int i;
Outfit *o;
View
@@ -55,6 +55,7 @@ typedef enum OutfitType_ {
OUTFIT_TYPE_FIGHTER_BAY, /**< Contains other ships. */
OUTFIT_TYPE_FIGHTER, /**< Ship contained in FIGHTER_BAY. */
OUTFIT_TYPE_MAP, /**< Gives the player more knowledge about systems. */
+ OUTFIT_TYPE_LOCALMAP, /**< Gives the player more knowledge about the current system. */
OUTFIT_TYPE_GUI, /**< GUI for the player. */
OUTFIT_TYPE_LICENSE, /**< License that allows player to buy special stuff. */
OUTFIT_TYPE_SENTINEL /**< indicates last type */
@@ -276,6 +277,13 @@ struct OutfitMapData_s;
typedef struct OutfitMapData_s OutfitMapData_t;
/**
+ * @brief Represents a local map.
+ */
+typedef struct OutfitLocalMapData_ {
+ double hide; /**< Hide level to detect. */
+} OutfitLocalMapData;
+
+/**
* @brief Represents a jammer.
*/
typedef struct OutfitJammerData_ {
@@ -328,6 +336,7 @@ typedef struct Outfit_ {
OutfitFighterBayData bay; /**< FIGHTER_BAY */
OutfitFighterData fig; /**< FIGHTER */
OutfitMapData_t *map; /**< MAP */
+ OutfitLocalMapData lmap; /**< LOCALMAP */
OutfitGUIData gui; /**< GUI */
} u; /**< Holds the type-based outfit data. */
} Outfit;
@@ -355,6 +364,7 @@ int outfit_isJammer( const Outfit* o );
int outfit_isFighterBay( const Outfit* o );
int outfit_isFighter( const Outfit* o );
int outfit_isMap( const Outfit* o );
+int outfit_isLocalMap( const Outfit* o );
int outfit_isGUI( const Outfit* o );
int outfit_isLicense( const Outfit* o );
int outfit_isSecondary( const Outfit* o );

0 comments on commit df38052

Please sign in to comment.