Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
MovementTypedefs.h
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#ifndef SKYFIRESERVER_TYPEDEFS_H
7#define SKYFIRESERVER_TYPEDEFS_H
8
9#include "Common.h"
10
11namespace G3D
12{
13 class Vector2;
14 class Vector3;
15 class Vector4;
16}
17
18namespace Movement
19{
20 using G3D::Vector2;
21 using G3D::Vector3;
22 using G3D::Vector4;
23
24 inline uint32 SecToMS(float sec)
25 {
26 return static_cast<uint32>(sec * 1000.f);
27 }
28
29 inline float MSToSec(uint32 ms)
30 {
31 return ms / 1000.f;
32 }
33
34 float computeFallTime(float path_length, bool isSafeFall);
35 float computeFallElevation(float t_passed, bool isSafeFall, float start_velocity = 0.0f);
36 /*
37 #ifndef static_assert
38 #define CONCAT(x, y) CONCAT1 (x, y)
39 #define CONCAT1(x, y) x##y
40 #define static_assert(expr, msg) typedef char CONCAT(static_assert_failed_at_line_, __LINE__) [(expr) ? 1 : -1]
41 #endif
42 */
43 template<class T, T limit>
44 class counter
45 {
46 public:
47 counter() { init(); }
48
49 void Increase()
50 {
51 if (m_counter == limit)
53 else
54 ++m_counter;
55 }
57 T NewId() { Increase(); return m_counter; }
58 T getCurrent() const { return m_counter; }
59
60 private:
61 void init() { m_counter = 0; }
62 T m_counter;
63 };
64
66
67 extern double gravity;
69 extern std::string MovementFlags_ToString(uint32 flags);
70 extern std::string MovementFlagsExtra_ToString(uint32 flags);
71}
72
73#endif // SKYFIRESERVER_TYPEDEFS_H
std::uint32_t uint32
Definition Define.h:77
double gravity
float computeFallTime(float path_length, bool isSafeFall)
uint32 SecToMS(float sec)
UInt32Counter splineIdGen
std::string MovementFlags_ToString(uint32 flags)
float computeFallElevation(float t_passed, bool isSafeFall, float start_velocity=0.0f)
std::string MovementFlagsExtra_ToString(uint32 flags)
counter< uint32, 0xFFFFFFFF > UInt32Counter
float MSToSec(uint32 ms)