1
0
Fork 0

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.
This commit is contained in:
david 2002-03-03 22:48:40 +00:00
parent 76b06f4707
commit b9e866cfdd
3 changed files with 7 additions and 4 deletions

View file

@ -168,9 +168,10 @@ static bool
do_save (const SGPropertyNode * arg, SGCommandState ** state) do_save (const SGPropertyNode * arg, SGCommandState ** state)
{ {
const string &file = arg->getStringValue("file", "fgfs.sav"); const string &file = arg->getStringValue("file", "fgfs.sav");
bool write_all = arg->getBoolValue("write-all", false);
SG_LOG(SG_INPUT, SG_INFO, "Saving flight"); SG_LOG(SG_INPUT, SG_INFO, "Saving flight");
ofstream output(file.c_str()); ofstream output(file.c_str());
if (output.good() && fgSaveFlight(output)) { if (output.good() && fgSaveFlight(output, write_all)) {
output.close(); output.close();
SG_LOG(SG_INPUT, SG_INFO, "Saved flight to " << file); SG_LOG(SG_INPUT, SG_INFO, "Saved flight to " << file);
return true; return true;

View file

@ -864,10 +864,10 @@ fgUpdateProps ()
* Save the current state of the simulator to a stream. * Save the current state of the simulator to a stream.
*/ */
bool bool
fgSaveFlight (ostream &output) fgSaveFlight (ostream &output, bool write_all)
{ {
try { try {
writeProperties(output, globals->get_props()); writeProperties(output, globals->get_props(), write_all);
} catch (const sg_exception &e) { } catch (const sg_exception &e) {
guiErrorMessage("Error saving flight: ", e); guiErrorMessage("Error saving flight: ", e);
return false; return false;

View file

@ -43,9 +43,11 @@ extern void fgUpdateProps ();
* so that the current flight can be restored later. * so that the current flight can be restored later.
* *
* @param output The output stream to write the XML save file to. * @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. * @return true if the flight was saved successfully.
*/ */
extern bool fgSaveFlight (ostream &output); extern bool fgSaveFlight (ostream &output, bool write_all = false);
/** /**