From 4458f7ce7377a5fb718164911703cefcd946ccd0 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sat, 8 Jan 2011 21:38:26 +0100 Subject: [PATCH] Enable AI traffic for offline users and issue #248 - #248: new enable/disable-ai-traffic command-line option - AI traffic: don't wait for METAR when real-wx-fetch disabled, to enable AI traffic when running offline --- src/Main/options.cxx | 8 +++++--- src/Traffic/TrafficMgr.cxx | 3 ++- src/Traffic/TrafficMgr.hxx | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Main/options.cxx b/src/Main/options.cxx index b5b28a0ec..1931bb341 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -1334,6 +1334,8 @@ struct OptionDesc { {"metar", true, OPTION_STRING, "/environment/metar/data", false, "", 0 }, {"disable-ai-models", false, OPTION_BOOL, "/sim/ai/enabled", false, "", 0 }, {"enable-ai-models", false, OPTION_BOOL, "/sim/ai/enabled", true, "", 0 }, + {"disable-ai-traffic", false, OPTION_BOOL, "/sim/traffic-manager/enabled", false, "", 0 }, + {"enable-ai-traffic", false, OPTION_BOOL, "/sim/traffic-manager/enabled", true, "", 0 }, {"disable-freeze", false, OPTION_BOOL, "/sim/freeze/master", false, "", 0 }, {"enable-freeze", false, OPTION_BOOL, "/sim/freeze/master", true, "", 0 }, {"disable-fuel-freeze", false, OPTION_BOOL, "/sim/freeze/fuel", false, "", 0 }, @@ -1419,7 +1421,7 @@ struct OptionDesc { {"enable-skyblend", false, OPTION_BOOL, "/sim/rendering/skyblend", true, "", 0 }, {"disable-textures", false, OPTION_BOOL, "/sim/rendering/textures", false, "", 0 }, {"enable-textures", false, OPTION_BOOL, "/sim/rendering/textures", true, "", 0 }, - {"texture-filtering", false, OPTION_INT, "/sim/rendering/filtering", 1, "", 0 }, + {"texture-filtering", false, OPTION_INT, "/sim/rendering/filtering", 1, "", 0 }, {"disable-wireframe", false, OPTION_BOOL, "/sim/rendering/wireframe", false, "", 0 }, {"enable-wireframe", false, OPTION_BOOL, "/sim/rendering/wireframe", true, "", 0 }, {"geometry", true, OPTION_FUNC, "", false, "", fgOptGeometry }, @@ -1489,8 +1491,8 @@ struct OptionDesc { {"ai-scenario", true, OPTION_FUNC, "", false, "", fgOptScenario }, {"parking-id", true, OPTION_FUNC, "", false, "", fgOptParking }, {"version", false, OPTION_FUNC, "", false, "", fgOptVersion }, - {"enable-fpe", false, OPTION_FUNC, "", false, "", fgOptFpe}, - {"fgviewer", false, OPTION_FUNC, "", false, "", fgOptFgviewer}, + {"enable-fpe", false, OPTION_FUNC, "", false, "", fgOptFpe}, + {"fgviewer", false, OPTION_FUNC, "", false, "", fgOptFgviewer}, {0} }; diff --git a/src/Traffic/TrafficMgr.cxx b/src/Traffic/TrafficMgr.cxx index 765c870fd..4abbc1a20 100644 --- a/src/Traffic/TrafficMgr.cxx +++ b/src/Traffic/TrafficMgr.cxx @@ -79,6 +79,7 @@ FGTrafficManager::FGTrafficManager() : inited(false), enabled("/sim/traffic-manager/enabled"), aiEnabled("/sim/ai/enabled"), + realWxEnabled("/environment/realwx/enabled"), metarValid("/environment/metar/valid") { //score = 0; @@ -232,7 +233,7 @@ void FGTrafficManager::init() void FGTrafficManager::update(double /*dt */ ) { - if (!enabled || !aiEnabled || !metarValid) { + if (!enabled || !aiEnabled || (realWxEnabled && !metarValid)) { return; } diff --git a/src/Traffic/TrafficMgr.hxx b/src/Traffic/TrafficMgr.hxx index a9bb9a305..ab1e19880 100644 --- a/src/Traffic/TrafficMgr.hxx +++ b/src/Traffic/TrafficMgr.hxx @@ -99,7 +99,7 @@ private: void readTimeTableFromFile(SGPath infilename); void Tokenize(const string& str, vector& tokens, const string& delimiters = " "); - simgear::PropertyObject enabled, aiEnabled, metarValid; + simgear::PropertyObject enabled, aiEnabled, realWxEnabled, metarValid; public: FGTrafficManager(); ~FGTrafficManager();