载入中...
搜索中...
未找到
ActionInputBuffer.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
6#include "common/Result.h"
7#include "common/SubjectRef.h"
8#include "common/Time.h"
9
10#include <cstdint>
11#include <deque>
12#include <map>
13#include <string>
14#include <vector>
15
16namespace eve::action::input {
17
25
33public:
35 ActionInputBuffer(std::uint32_t capacity, std::uint32_t lifetimeTicks);
36
38 [[nodiscard]] Result<void> push(BufferedInput input);
40 [[nodiscard]] Result<void> expire(SimulationTick now);
45 [[nodiscard]] Result<BufferedInput> consume(SubjectRef subject, const std::vector<std::string>& allows);
47 [[nodiscard]] Result<BufferedInput> peek(SubjectRef subject, const std::vector<std::string>& allows) const;
49 void clear(SubjectRef subject);
51 void clearAll() noexcept { entries_.clear(); }
53 [[nodiscard]] std::size_t size() const noexcept { return entries_.size(); }
54
55private:
56 std::uint32_t capacity_ = 1;
57 std::uint32_t lifetimeTicks_ = 1;
58 std::deque<BufferedInput> entries_;
59};
60
61} // namespace eve::action::input
int subject
Definition AnimSmr.cpp:163
EvpackChunkInput input
Definition Evpack.cpp:170
#define EVENGINE_API_BACKENDS
Definition Export.h:108
std::uint32_t capacity
Move-only, checked operation results for the common layer.
Stable reference to a runtime gameplay subject.
Common time values and an injectable deterministic simulation clock.
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Strong, domain-neutral reference to a runtime subject.
Definition SubjectRef.h:26
Owner-thread FIFO/priority buffer of semantic combat inputs.
void clearAll() noexcept
Clear the entire buffer.
std::size_t size() const noexcept
Number of buffered commands.
static constexpr StrongUint64 zero() noexcept
Returns the zero value for this strong type.
One buffered semantic command tagged with the tick it was pressed.