16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-19 03:09:18 +02:00

build 181128. coupler sounds enhancement, minor ai logic tweaks, minor bug fixes

This commit is contained in:
tmj-fstate
2018-11-28 23:29:35 +01:00
parent 1d6f75322b
commit 3fbf5bf894
17 changed files with 199 additions and 63 deletions

View File

@@ -411,6 +411,18 @@ substr_path( std::string const &Filename ) {
"" );
}
// returns length of common prefix between two provided strings
std::ptrdiff_t
len_common_prefix( std::string const &Left, std::string const &Right ) {
auto const *left { Left.data() };
auto const *right { Right.data() };
// compare up to the length of the shorter string
return ( Right.size() <= Left.size() ?
std::distance( right, std::mismatch( right, right + Right.size(), left ).first ) :
std::distance( left, std::mismatch( left, left + Left.size(), right ).first ) );
}
// helper, restores content of a 3d vector from provided input stream
// TODO: review and clean up the helper routines, there's likely some redundant ones
glm::dvec3 LoadPoint( cParser &Input ) {