diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-18 21:32:31 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-18 21:32:31 +0200 |
commit | 32f28bf1fb61195f4f3709fccce09abc3b20a166 (patch) | |
tree | e431b9a6d71488892e9acc9bba6e7c20f432d4d4 /source/ClientHandle.h | |
parent | Added the API for spawning primed TNTs (diff) | |
download | cuberite-32f28bf1fb61195f4f3709fccce09abc3b20a166.tar cuberite-32f28bf1fb61195f4f3709fccce09abc3b20a166.tar.gz cuberite-32f28bf1fb61195f4f3709fccce09abc3b20a166.tar.bz2 cuberite-32f28bf1fb61195f4f3709fccce09abc3b20a166.tar.lz cuberite-32f28bf1fb61195f4f3709fccce09abc3b20a166.tar.xz cuberite-32f28bf1fb61195f4f3709fccce09abc3b20a166.tar.zst cuberite-32f28bf1fb61195f4f3709fccce09abc3b20a166.zip |
Diffstat (limited to 'source/ClientHandle.h')
-rw-r--r-- | source/ClientHandle.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/ClientHandle.h b/source/ClientHandle.h index 4568f1a58..cd0ca1ee6 100644 --- a/source/ClientHandle.h +++ b/source/ClientHandle.h @@ -56,7 +56,10 @@ public: #endif static const int MAX_VIEW_DISTANCE = 10; static const int MIN_VIEW_DISTANCE = 4; - + + /// How many ticks should be checked for a running average of explosions, for limiting purposes + static const int NUM_CHECK_EXPLOSIONS_TICKS = 20; + cClientHandle(const cSocket * a_Socket, int a_ViewDistance); virtual ~cClientHandle(); @@ -258,6 +261,17 @@ private: /// If set to true during csDownloadingWorld, the tick thread calls CheckIfWorldDownloaded() bool m_ShouldCheckDownloaded; + /// Stores the recent history of the number of explosions per tick + int m_NumExplosionsPerTick[NUM_CHECK_EXPLOSIONS_TICKS]; + + /// Points to the current tick in the m_NumExplosionsPerTick[] array + int m_CurrentExplosionTick; + + /// Running sum of m_NumExplosionsPerTick[] + int m_RunningSumExplosions; + + + /// Returns true if the rate block interactions is within a reasonable limit (bot protection) bool CheckBlockInteractionsRate(void); |