16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 02:29:17 +02:00

reformat: remove redundant 'inline' specifier

This commit is contained in:
jerrrrycho
2026-07-04 05:58:21 +02:00
parent b4b6686320
commit 6e4d000ddb
85 changed files with 877 additions and 988 deletions

View File

@@ -109,11 +109,11 @@ class float4
z = c;
w = d;
};
float inline LengthSquared() const
float LengthSquared() const
{
return x * x + y * y + z * z + w * w;
};
float inline Length() const
float Length() const
{
return sqrt(x * x + y * y + z * z + w * w);
};
@@ -246,8 +246,8 @@ public:
e[i + 2] = f; // zamiana Y i Z
}
};
inline float4x4 &Rotation(float const angle, float3 const &axis);
inline bool IdentityIs()
inline float4x4 &Rotation(float angle, float3 const &axis);
bool IdentityIs()
{ // sprawdzenie jednostkowości
for (int i = 0; i < 16; ++i)
if (e[i] != (i % 5 ? 0.0 : 1.0)) // jedynki tylko na 0, 5, 10 i 15
@@ -255,7 +255,7 @@ public:
return true;
}
void Quaternion(float4 *q);
inline float3 *TranslationGet()
float3 *TranslationGet()
{
return (float3 *)(e + 12);
}

View File

@@ -359,13 +359,13 @@ struct global_settings {
bool ConfigParseNetwork(cParser& Parser, const std::string& token);
bool ConfigParseHardware(cParser& Parser, const std::string& token);
bool ConfigParseDebug(cParser& Parser, const std::string& token);
bool ConfigParse_gfx( cParser &parser, std::string_view const Token );
bool ConfigParse_gfx( cParser &parser, std::string_view Token );
// sends basic content of the class in legacy (text) format to provided stream
void
export_as_text( std::ostream &Output ) const;
template <typename Type_>
void
export_as_text( std::ostream &Output, std::string const Key, Type_ const &Value ) const;
export_as_text( std::ostream &Output, std::string Key, Type_ const &Value ) const;
};
template <typename Type_>
@@ -377,11 +377,11 @@ global_settings::export_as_text( std::ostream &Output, std::string const Key, Ty
template <>
void
global_settings::export_as_text( std::ostream &Output, std::string const Key, std::string const &Value ) const;
global_settings::export_as_text( std::ostream &Output, std::string Key, std::string const &Value ) const;
template <>
void
global_settings::export_as_text( std::ostream &Output, std::string const Key, bool const &Value ) const;
global_settings::export_as_text( std::ostream &Output, std::string Key, bool const &Value ) const;
extern global_settings& GetGlobalSettings();

View File

@@ -24,11 +24,11 @@ enum class logtype : unsigned int {
powergrid = 1 << 10,
};
void LogService();
void WriteLog( const char *str, logtype const Type = logtype::generic, bool isError = false );
void WriteLog( const char *str, logtype Type = logtype::generic, bool isError = false );
void Error( const std::string &asMessage, bool box = false );
void Error( const char* &asMessage, bool box = false );
void ErrorLog( const std::string &str, logtype const Type = logtype::generic );
void WriteLog( const std::string &str, logtype const Type = logtype::generic );
void ErrorLog( const std::string &str, logtype Type = logtype::generic );
void WriteLog( const std::string &str, logtype Type = logtype::generic );
void CommLog( const char *str );
void CommLog( const std::string &str );

View File

@@ -25,9 +25,9 @@ struct dictionary_source {
dictionary_source() = default;
dictionary_source( std::string const &Input );
// methods
inline void insert( std::string const &Key, double const Value ) { floats.emplace_back( Key, Value ); }
inline void insert( std::string const &Key, int const Value ) { integers.emplace_back( Key, Value ); }
inline void insert( std::string const &Key, bool const Value ) { bools.emplace_back( Key, Value ); }
inline void insert( std::string const &Key, std::string const Value ) { strings.emplace_back( Key, Value ); }
inline void insert( std::string const &Key, std::vector<glm::vec2> const Value ) { vec2_lists.emplace_back( Key, Value ); }
void insert( std::string const &Key, double const Value ) { floats.emplace_back( Key, Value ); }
void insert( std::string const &Key, int const Value ) { integers.emplace_back( Key, Value ); }
void insert( std::string const &Key, bool const Value ) { bools.emplace_back( Key, Value ); }
void insert( std::string const &Key, std::string const Value ) { strings.emplace_back( Key, Value ); }
void insert( std::string const &Key, std::vector<glm::vec2> const Value ) { vec2_lists.emplace_back( Key, Value ); }
};

View File

@@ -12,7 +12,7 @@ inline glm::dmat4 BasisChange(glm::dvec3 v, glm::dvec3 n)
return BasisChange(u, v, n);
}
template <typename T> inline glm::vec<3, T> RotateY(const glm::vec<3, T> &v, T angle)
template <typename T> glm::vec<3, T> RotateY(const glm::vec<3, T> &v, T angle)
{
T s = std::sin(angle);
T c = std::cos(angle);

View File

@@ -24,7 +24,7 @@ http://mozilla.org/MPL/2.0/.
namespace
{
inline std::array<bool, 256> makeBreakTable(const char *brk)
std::array<bool, 256> makeBreakTable(const char *brk)
{
std::array<bool, 256> arr{};
for (const unsigned char c : std::string_view(brk ? brk : ""))
@@ -34,7 +34,7 @@ inline std::array<bool, 256> makeBreakTable(const char *brk)
return arr;
}
inline char toLowerChar(char c)
char toLowerChar(char c)
{
// Only fold ASCII letters. Bytes >= 0x80 belong to multibyte UTF-8
// sequences and must be passed through untouched, otherwise a non-"C"
@@ -45,7 +45,7 @@ inline char toLowerChar(char c)
return c;
}
inline bool startsWithBOM(const std::string &s)
bool startsWithBOM(const std::string &s)
{
return s.size() >= 3
&& static_cast<unsigned char>(s[0]) == 0xEF

View File

@@ -28,7 +28,7 @@ class cParser //: public std::stringstream
buffer_TEXT
};
// constructors:
cParser(std::string const &Stream, buffertype const Type = buffer_TEXT, std::string Path = "", bool const Loadtraction = true, std::vector<std::string> Parameters = std::vector<std::string>(), bool allowRandom = false );
cParser(std::string const &Stream, buffertype Type = buffer_TEXT, std::string Path = "", bool Loadtraction = true, std::vector<std::string> Parameters = std::vector<std::string>(), bool allowRandom = false );
// destructor:
virtual ~cParser();
// methods:
@@ -42,29 +42,24 @@ class cParser //: public std::stringstream
Output_ output;
*this >> output;
return output; };
inline
void
void
ignoreToken() {
std::string out;
readToken(out); };
inline
bool
bool
expectToken( std::string const &Value ) {
std::string out;
readToken(out);
return out == Value; };
inline
bool
bool
eof() {
return mStream->eof(); };
inline
bool
bool
ok() {
return !mStream->fail(); };
cParser &
autoclear( bool const Autoclear );
inline
bool
autoclear( bool Autoclear );
bool
autoclear() const {
return m_autoclear; }
bool
@@ -74,8 +69,7 @@ class cParser //: public std::stringstream
void substituteParameters(std::string &token, bool ToLower);
void skipIncludeBlock();
// returns next incoming token, if any, without removing it from the set
inline
std::string
std::string
peek() const {
return false == tokens.empty() ? tokens.front() : ""; }
// inject string as internal include
@@ -104,7 +98,7 @@ class cParser //: public std::stringstream
// methods:
void readToken(std::string& out, bool ToLower = true, const char *Break = "\n\r\t ;");
static std::vector<std::string> readParameters( cParser &Input );
std::string readQuotes( char const Quote = '\"' );
std::string readQuotes( char Quote = '\"' );
void skipComment( std::string const &Endmark );
bool findQuotes( std::string &String );
bool trimComments( std::string &String );
@@ -131,7 +125,7 @@ class cParser //: public std::stringstream
template <>
glm::vec3
cParser::getToken( bool const ToLower, const char *Break );
cParser::getToken( bool ToLower, const char *Break );
template<typename Type_>
@@ -157,4 +151,4 @@ cParser::operator>>( bool &Right );
template<>
bool
cParser::getToken<bool>( bool const ToLower, const char *Break );
cParser::getToken<bool>( bool ToLower, const char *Break );

View File

@@ -109,8 +109,8 @@ inline bool TestFlagAny(int const Flag, int const Value)
{
return (Flag & Value) != 0;
}
bool SetFlag(int &Flag, int const Value);
bool ClearFlag(int &Flag, int const Value);
bool SetFlag(int &Flag, int Value);
bool ClearFlag(int &Flag, int Value);
bool FuzzyLogic(double Test, double Threshold, double Probability);
/*jesli Test>Threshold to losowanie*/
@@ -124,11 +124,11 @@ std::pair<std::string, int> split_string_and_number(std::string const &Key);
std::string to_string(int Value, int width);
std::string to_string(double Value, int precision);
std::string to_string(double Value, int precision, int width);
std::string to_hex_str(int const Value, int const width = 4);
std::string to_minutes_str(float const Minutes, bool const Leadingzero, int const Width);
std::string to_hex_str(int Value, int width = 4);
std::string to_minutes_str(float Minutes, bool Leadingzero, int Width);
template <std::same_as<bool> T> // Without this line this function can be used with other types implicit casted to boolean which may create hard to debug bugs.
inline std::string to_string(T Value)
std::string to_string(T Value)
{
return Value == true ? "true" : "false";
}
@@ -151,7 +151,7 @@ std::string ToUpper(std::string const &text);
// replaces polish letters with basic ascii
void win1250_to_ascii(std::string &Input);
// TODO: unify with win1250_to_ascii()
std::string Bezogonkow(std::string Input, bool const Underscorestospaces = false);
std::string Bezogonkow(std::string Input, bool Underscorestospaces = false);
std::string win1250_to_utf8(const std::string &input);
@@ -224,17 +224,17 @@ std::string substr_path(std::string const &Filename);
std::ptrdiff_t len_common_prefix(std::string_view a, std::string_view b);
// returns true if provided string contains another provided string
bool contains(std::string_view const String, std::string_view Substring);
bool contains(std::string_view const String, char Character);
bool contains(std::string_view String, std::string_view Substring);
bool contains(std::string_view String, char Character);
// TODO: Ideally unique_ptr should be used instead of this (not safe) inline functions
template <typename T> inline void SafeDelete(T* &Pointer)
template <typename T> void SafeDelete(T* &Pointer)
{
delete Pointer;
Pointer = nullptr;
}
template <typename T> inline void SafeDeleteArray(T *&Pointer)
template <typename T> void SafeDeleteArray(T *&Pointer)
{
delete[] Pointer;
Pointer = nullptr;

View File

@@ -13,7 +13,7 @@ public:
static UID random() {
static thread_local std::mt19937_64 gen(std::random_device{}());
thread_local std::mt19937_64 gen(std::random_device{}());
UID u;
const uint64_t a = gen();
const uint64_t b = gen();