From: david Date: Sun, 3 Mar 2002 22:48:40 +0000 (+0000) Subject: Added write-all parameter to save command. If set to true, the X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b9e866cfdd765cc742a6c9b3e35c8a9c1ca08dfc;p=flightgear.git Added write-all parameter to save command. If set to true, the command will save *all* properties, rather than just those marked as archivable. This feature was requested by Tony Peden to make it easier to write documentation on the properties, but it should also be useful for debugging. There is currently no default binding for the command with the write-all parameter set to true. --- diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index 36554cb23..76b0441fd 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -168,9 +168,10 @@ static bool do_save (const SGPropertyNode * arg, SGCommandState ** state) { const string &file = arg->getStringValue("file", "fgfs.sav"); + bool write_all = arg->getBoolValue("write-all", false); SG_LOG(SG_INPUT, SG_INFO, "Saving flight"); ofstream output(file.c_str()); - if (output.good() && fgSaveFlight(output)) { + if (output.good() && fgSaveFlight(output, write_all)) { output.close(); SG_LOG(SG_INPUT, SG_INFO, "Saved flight to " << file); return true; diff --git a/src/Main/fg_props.cxx b/src/Main/fg_props.cxx index b7966352e..a65196ca9 100644 --- a/src/Main/fg_props.cxx +++ b/src/Main/fg_props.cxx @@ -864,10 +864,10 @@ fgUpdateProps () * Save the current state of the simulator to a stream. */ bool -fgSaveFlight (ostream &output) +fgSaveFlight (ostream &output, bool write_all) { try { - writeProperties(output, globals->get_props()); + writeProperties(output, globals->get_props(), write_all); } catch (const sg_exception &e) { guiErrorMessage("Error saving flight: ", e); return false; diff --git a/src/Main/fg_props.hxx b/src/Main/fg_props.hxx index 9d9072497..a21c438c5 100644 --- a/src/Main/fg_props.hxx +++ b/src/Main/fg_props.hxx @@ -43,9 +43,11 @@ extern void fgUpdateProps (); * so that the current flight can be restored later. * * @param output The output stream to write the XML save file to. + * @param write_all If true, write all properties rather than + * just the ones flagged as archivable. * @return true if the flight was saved successfully. */ -extern bool fgSaveFlight (ostream &output); +extern bool fgSaveFlight (ostream &output, bool write_all = false); /**