From: Christian Schmitt Date: Wed, 20 Jun 2012 10:54:41 +0000 (+0200) Subject: Taxiway signs: print out more meaningful error messages on wrong size X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=190e6b39580f6239133ea2bc5c665736cfae1baf;p=simgear.git Taxiway signs: print out more meaningful error messages on wrong size settings and fall back to the default value in such cases. --- diff --git a/simgear/scene/tgdb/apt_signs.cxx b/simgear/scene/tgdb/apt_signs.cxx index 3bd313aa..1bc15f37 100644 --- a/simgear/scene/tgdb/apt_signs.cxx +++ b/simgear/scene/tgdb/apt_signs.cxx @@ -373,36 +373,44 @@ void AirportSignBuilder::addSign(const SGGeod& pos, double heading, const std::s n = n.substr(0, 2); } if (n == "@Y") { - if (size < 4) { - sign_height = HT[size < 0 ? 3 : size]; - newmat = "YellowSign"; - newtype = 'Y'; - continue; + if (size > 3) { + size = -1; + SG_LOG(SG_TERRAIN, SG_ALERT, SIGN "Wrong size for " << name << ". Allowed values are 1 to 3"); } + sign_height = HT[size < 0 ? 3 : size]; + newmat = "YellowSign"; + newtype = 'Y'; + continue; } else if (n == "@R") { - if (size < 4) { - sign_height = HT[size < 0 ? 3 : size]; - newmat = "RedSign"; - newtype = 'R'; - continue; + if (size > 3) { + size = -1; + SG_LOG(SG_TERRAIN, SG_ALERT, SIGN "Wrong size for " << name << ". Allowed values are 1 to 3"); } + sign_height = HT[size < 0 ? 3 : size]; + newmat = "RedSign"; + newtype = 'R'; + continue; } else if (n == "@L") { - if (size < 4) { - sign_height = HT[size < 0 ? 3 : size]; - newmat = "FramedSign"; - newtype = 'L'; - continue; + if (size > 3) { + size = -1; + SG_LOG(SG_TERRAIN, SG_ALERT, SIGN "Wrong size for " << name << ". Allowed values are 1 to 3"); } + sign_height = HT[size < 0 ? 3 : size]; + newmat = "FramedSign"; + newtype = 'L'; + continue; } else if (n == "@B") { - if (size < 0 || size == 4 || size == 5) { - sign_height = HT[size < 0 ? 4 : size]; - newmat = "BlackSign"; - newtype = 'B'; - continue; + if ( (size != -1) && (size != 4) && (size != 5) ) { + size = -1; + SG_LOG(SG_TERRAIN, SG_ALERT, SIGN "Wrong size for " << name << ". Allowed values are 4 or 5"); } + sign_height = HT[size < 0 ? 4 : size]; + newmat = "BlackSign"; + newtype = 'B'; + continue; } }