From 73d8e18a2a0b0ae2b8f43122c0f6e689aaf142d1 Mon Sep 17 00:00:00 2001 From: Allanis Date: Tue, 25 Jun 2013 22:34:15 +0100 Subject: [PATCH] [Add] Fuel is saved too now. --- src/player.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/player.c b/src/player.c index 3932ea4..6a0a5ca 100644 --- a/src/player.c +++ b/src/player.c @@ -1594,6 +1594,9 @@ static int player_saveShip(xmlTextWriterPtr writer, Pilot* ship, char* loc) { if(loc != NULL) xmlw_elem(writer, "location", loc); + /* Save the fuel. */ + xmlw_elem(writer, "fuel", "%f", ship->fuel); + /* Save the outfits. */ xmlw_startElem(writer, "outfits"); for(i = 0; i < ship->noutfits; i++) { @@ -1717,6 +1720,7 @@ static int player_parseDone(xmlNodePtr parent) { static int player_parseShip(xmlNodePtr parent, int is_player) { char* name, *model, *loc, *q, *id; int i, n; + double fuel; Pilot* ship; xmlNodePtr node, cur; @@ -1737,9 +1741,14 @@ static int player_parseShip(xmlNodePtr parent, int is_player) { node = parent->xmlChildrenNode; + fuel = 0; + do { if(!is_player == 0) xmlr_str(node, "location", loc); + /* Get fuel. */ + xmlr_float(node, "fuel", ship->fuel); + if(xml_isNode(node, "outfits")) { cur = node->xmlChildrenNode; do {