mirror of
https://github.com/edubart/otclient.git
synced 2025-10-19 14:03:26 +02:00
new script engine, and things maybe be bugged for a while
This commit is contained in:
16
src/framework/util/algorithms.h
Normal file
16
src/framework/util/algorithms.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef ALGORITHMS_H
|
||||
#define ALGORITHMS_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
inline std::string getPathDirectory(const std::string& sourcePath)
|
||||
{
|
||||
std::string dir;
|
||||
std::size_t pos = sourcePath.find_last_of('/');
|
||||
if(pos != std::string::npos)
|
||||
dir = sourcePath.substr(0, pos);
|
||||
return dir;
|
||||
}
|
||||
|
||||
#endif // ALGORITHMS_H
|
@@ -19,11 +19,11 @@ void log(LogLevel level, const std::string& message, std::string prettyFunction
|
||||
#define logError(...) log(LogError, make_string(__VA_ARGS__))
|
||||
#define logFatal(...) log(LogFatal, make_string(__VA_ARGS__))
|
||||
|
||||
#define trace() log(LogDebug, "", __PRETTY_FUNCTION__)
|
||||
#define traceDebug(...) log(LogDebug, make_string(__VA_ARGS__), __PRETTY_FUNCTION__)
|
||||
#define traceInfo(...) log(LogInfo, make_string(__VA_ARGS__), __PRETTY_FUNCTION__)
|
||||
#define traceWarning(...) log(LogWarning, make_string(__VA_ARGS__), __PRETTY_FUNCTION__)
|
||||
#define traceError(...) log(LogError, make_string(__VA_ARGS__), __PRETTY_FUNCTION__)
|
||||
#define logTrace() log(LogDebug, "", __PRETTY_FUNCTION__)
|
||||
#define logTraceDebug(...) log(LogDebug, make_string(__VA_ARGS__), __PRETTY_FUNCTION__)
|
||||
#define logTraceInfo(...) log(LogInfo, make_string(__VA_ARGS__), __PRETTY_FUNCTION__)
|
||||
#define logTraceWarning(...) log(LogWarning, make_string(__VA_ARGS__), __PRETTY_FUNCTION__)
|
||||
#define logTraceError(...) log(LogError, make_string(__VA_ARGS__), __PRETTY_FUNCTION__)
|
||||
|
||||
// dump utility
|
||||
struct Dump {
|
||||
|
@@ -42,7 +42,7 @@ public:
|
||||
inline bool operator==(const TPoint<T>& other) const { return other.x==x && other.y==y; }
|
||||
inline bool operator!=(const TPoint<T>& other) const { return other.x!=x || other.y!=y; }
|
||||
|
||||
inline float length() const { return sqrtf((float)(x*x + y*y)); }
|
||||
inline float length() const { return sqrt((float)(x*x + y*y)); }
|
||||
inline T manhattanLength() const { return std::abs(x) + std::abs(y); }
|
||||
|
||||
inline float distanceFrom(const TPoint<T>& other) const {
|
||||
|
Reference in New Issue
Block a user