[Add] Fuel is saved too now.

This commit is contained in:
Allanis 2013-06-25 22:34:15 +01:00
parent d11eabd358
commit 73d8e18a2a

View File

@ -1594,6 +1594,9 @@ static int player_saveShip(xmlTextWriterPtr writer, Pilot* ship, char* loc) {
if(loc != NULL) xmlw_elem(writer, "location", loc); if(loc != NULL) xmlw_elem(writer, "location", loc);
/* Save the fuel. */
xmlw_elem(writer, "fuel", "%f", ship->fuel);
/* Save the outfits. */ /* Save the outfits. */
xmlw_startElem(writer, "outfits"); xmlw_startElem(writer, "outfits");
for(i = 0; i < ship->noutfits; i++) { 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) { static int player_parseShip(xmlNodePtr parent, int is_player) {
char* name, *model, *loc, *q, *id; char* name, *model, *loc, *q, *id;
int i, n; int i, n;
double fuel;
Pilot* ship; Pilot* ship;
xmlNodePtr node, cur; xmlNodePtr node, cur;
@ -1737,9 +1741,14 @@ static int player_parseShip(xmlNodePtr parent, int is_player) {
node = parent->xmlChildrenNode; node = parent->xmlChildrenNode;
fuel = 0;
do { do {
if(!is_player == 0) xmlr_str(node, "location", loc); if(!is_player == 0) xmlr_str(node, "location", loc);
/* Get fuel. */
xmlr_float(node, "fuel", ship->fuel);
if(xml_isNode(node, "outfits")) { if(xml_isNode(node, "outfits")) {
cur = node->xmlChildrenNode; cur = node->xmlChildrenNode;
do { do {