mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 23:19:19 +02:00
build 210303. vehicle control hint system, virtual trainman toggle, configurable diesel engine rpm deceleration rate, vehicle repair enhancement, debug panel enhancements, customizable vehicle displays refresh rate, idling compressor sound, traction ac motor sound, braking sound enhancement, sky state enhancement, minor bug fixes
This commit is contained in:
20
utilities.h
20
utilities.h
@@ -11,11 +11,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <ctime>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
|
||||
/*rozne takie duperele do operacji na stringach w paszczalu, pewnie w delfi sa lepsze*/
|
||||
/*konwersja zmiennych na stringi, funkcje matematyczne, logiczne, lancuchowe, I/O etc*/
|
||||
@@ -217,7 +213,9 @@ std::string substr_path( std::string const &Filename );
|
||||
std::ptrdiff_t len_common_prefix( std::string const &Left, std::string const &Right );
|
||||
|
||||
// returns true if provided string ends with another provided string
|
||||
bool ends_with( std::string const &String, std::string const &Suffix );
|
||||
bool ends_with( std::string_view String, std::string_view Suffix );
|
||||
// returns true if provided string begins with another provided string
|
||||
bool starts_with( std::string_view String, std::string_view Suffix );
|
||||
|
||||
template <typename Type_>
|
||||
void SafeDelete( Type_ &Pointer ) {
|
||||
@@ -231,6 +229,18 @@ void SafeDeleteArray( Type_ &Pointer ) {
|
||||
Pointer = nullptr;
|
||||
}
|
||||
|
||||
template <typename Type_>
|
||||
Type_
|
||||
is_equal( Type_ const &Left, Type_ const &Right, Type_ const Epsilon = 1e-5 ) {
|
||||
|
||||
if( Epsilon != 0 ) {
|
||||
return glm::epsilonEqual( Left, Right, Epsilon );
|
||||
}
|
||||
else {
|
||||
return ( Left == Right );
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Type_>
|
||||
Type_
|
||||
clamp( Type_ const Value, Type_ const Min, Type_ const Max ) {
|
||||
|
||||
Reference in New Issue
Block a user