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:
parent
76b06f4707
commit
b9e866cfdd
3 changed files with 7 additions and 4 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue