Skip to content

Commit

Permalink
Fix/SayIntentions: Load Displayname with Space from config, fixes #274
Browse files Browse the repository at this point in the history
  • Loading branch information
TwinFan committed Nov 17, 2024
1 parent b124bbf commit a329c54
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Include/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ constexpr int SERR_LEN = 100; // size of buffer for IO error t
#define ERR_CFG_FILE_VER "Config file '%s' first line: Unsupported format or version: '%s'"
#define ERR_CFG_FILE_VER_UNEXP "Config file '%s' first line: Unexpected version %s, expected %s...trying to continue"
#define ERR_CFG_FILE_IGNORE "Ignoring unkown entry '%s' from config file '%s'"
#define ERR_CFG_FILE_WORDS "Expected two words (key, value) in config file '%s', line '%s': ignored"
#define ERR_CFG_FILE_WORDS "Expected two words (key, value) separated by a space in config file '%s', line '%s': ignored"
#define ERR_CFG_FILE_READ "Could not read from '%s': %s"
#define ERR_CFG_LINE_READ "Could not read from file '%s', line %d: %s"
#define ERR_CFG_FILE_TOOMANY "Too many warnings"
Expand Down
13 changes: 6 additions & 7 deletions Src/DataRefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2124,18 +2124,18 @@ bool DataRefs::LoadConfigFile()
// break out of loop if reading the start of another section indicated by [ ]
if (lnBuf.front() == '[' && lnBuf.back() == ']') break;

// otherwise should be 2 tokens
ln = str_tokenize(lnBuf, " ");
if (ln.size() != 2) {
// otherwise should be 2 tokens, separated by the (first) space character
const std::string::size_type posSpc = lnBuf.find(' ');
if (posSpc == std::string::npos) {
// wrong number of words in that line
LOG_MSG(logWARN,ERR_CFG_FILE_WORDS, sFileName.c_str(), lnBuf.c_str());
errCnt++;
continue;
}

const std::string sDataRef = lnBuf.substr(0, posSpc);
std::string sVal = posSpc+1 < lnBuf.length() ? lnBuf.substr(posSpc+1) : "";

// did read a name and a value?
const std::string& sDataRef = ln[0];
std::string& sVal = ln[1];
if (!sDataRef.empty() && !sVal.empty()) {
// verify that we know that name
dataRefDefinitionT* i = std::find_if(std::begin(DATA_REFS_LT),
Expand Down Expand Up @@ -2217,7 +2217,6 @@ bool DataRefs::LoadConfigFile()
errCnt++;
}
}

}

// *** [FlarmAcTypes] ***
Expand Down
8 changes: 4 additions & 4 deletions docs/readme.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ <h3>v4.1.0</h3>
<li>
Added <a href="https://tracker.sayintentions.ai/">SayIntentions</a>
channel, so you can watch your SI buddies while flying in X-Plane.
(<a href="https://twinfan.gitbook.io/livetraffic/setup/installation/sayintentions">see here for configuration</a>)
<a href="https://twinfan.gitbook.io/livetraffic/setup/installation/sayintentions">See here for configuration</a>.
<li>
Fixed <a href="https://forums.x-plane.org/index.php?/forums/topic/318624-aircraft-landing-short/">an error</a>
that prevent LiveTraffic from getting current local weather information,
which can lead to inaccuracte altitude correction, hence planes
flying at wrong altitude and landing short or far.
that prevented LiveTraffic from getting current local weather information,
which led to inaccuracte altitude correction, hence planes
flying at wrong altitude and landing short or far.
</li>
<li>
Fixed <a href="https://forums.x-plane.org/index.php?/forums/topic/319620-real-traffic-returns-several-errors-starting-at-ensb/">an error</a>
Expand Down

0 comments on commit a329c54

Please sign in to comment.