Monopoly — Portage moderne
0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
GameQueueGate.cpp
Go to the documentation of this file.
1
#include "
GameQueueGate.hpp
"
2
3
namespace
monopoly::userinterface
4
{
5
void
GameQueueGate::reset
()
noexcept
6
{
7
count_ = 0;
8
lastActionTick_ = 0;
9
}
10
11
void
GameQueueGate::lock
(std::uint64_t tick)
noexcept
12
{
13
++count_;
14
lastActionTick_ = tick;
15
}
16
17
void
GameQueueGate::unlock
(std::uint64_t tick)
noexcept
18
{
19
--count_;
20
if
(count_ < 0) count_ = 0;
21
lastActionTick_ = tick;
22
}
23
24
bool
GameQueueGate::blocks
(std::uint64_t tick)
noexcept
25
{
26
if
(count_ <= 0)
return
false
;
27
if
(tick > lastActionTick_ &&
28
tick - lastActionTick_ > MaxLockTicks)
29
{
30
// The source clears the count then calls gameQueueUnLock(),
31
// whose clamp leaves the final count at zero.
32
count_ = 0;
33
lastActionTick_ = tick;
34
return
false
;
35
}
36
return
true
;
37
}
38
}
GameQueueGate.hpp
index
unsigned index
Definition
ModernIBarSkin.cpp:25
monopoly::userinterface::GameQueueGate::lock
void lock(std::uint64_t tick) noexcept
Definition
GameQueueGate.cpp:11
monopoly::userinterface::GameQueueGate::blocks
bool blocks(std::uint64_t tick) noexcept
Definition
GameQueueGate.cpp:24
monopoly::userinterface::GameQueueGate::reset
void reset() noexcept
Definition
GameQueueGate.cpp:5
monopoly::userinterface::GameQueueGate::unlock
void unlock(std::uint64_t tick) noexcept
Definition
GameQueueGate.cpp:17
monopoly::userinterface
Definition
GameQueueGate.cpp:4
GameQueueGate.cpp
Generated by
1.9.8