X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FGUI%2Fgui_funcs.cxx;h=a839ae6f2052a4d6a4cba7ba2449fd5e9da8b257;hb=846fd2169832c8938f04386139de746a06e80d4b;hp=8eeb54e76e38fc10ada013ad26fd6511561f267d;hpb=1a372d9366550f5fa1deef379129528c9f5692da;p=flightgear.git diff --git a/src/GUI/gui_funcs.cxx b/src/GUI/gui_funcs.cxx index 8eeb54e76..a839ae6f2 100644 --- a/src/GUI/gui_funcs.cxx +++ b/src/GUI/gui_funcs.cxx @@ -149,7 +149,7 @@ void guiErrorMessage (const char *txt, const sg_throwable &throwable) string msg = txt; msg += '\n'; msg += throwable.getFormattedMessage(); - if (!std::strlen(throwable.getOrigin()) != 0) { + if (std::strlen(throwable.getOrigin()) != 0) { msg += "\n (reported by "; msg += throwable.getOrigin(); msg += ')'; @@ -437,7 +437,24 @@ namespace { using namespace flightgear; - class GUISnapShotOperation : + SGPath nextScreenshotPath(const std::string& screenshotDir) + { + char filename[32]; + static int count = 1; + while (count < 1000) { + snprintf(filename, 32, "fgfs-screen-%03d.png", count++); + + SGPath p(screenshotDir); + p.append(filename); + if (!p.exists()) { + return p; + } + } + + return SGPath(); + } + + class GUISnapShotOperation : public GraphicsContextOperation { public: @@ -489,19 +506,7 @@ namespace dir = globals->get_fg_home(); } - char filename[24]; - static int count = 1; - while (count < 1000) { - snprintf(filename, 24, "fgfs-screen-%03d.png", count++); - - SGPath p(dir); - p.append(filename); - if (!p.exists()) { - _path.set(p.str()); - break; - } - } - + _path = nextScreenshotPath(dir); _xsize = fgGetInt("/sim/startup/xsize"); _ysize = fgGetInt("/sim/startup/ysize");