载入中...
搜索中...
未找到
GrowthEvents.cpp
浏览该文件的文档.
2
3namespace eve::growth {
4
5void GrowthEventLog::push(GrowthEvent event) { events_.push_back(std::move(event)); }
6
7void GrowthEventLog::clear() { events_.clear(); }
8
9int GrowthEventLog::count() const { return static_cast<int>(events_.size()); }
10
12 if (index < 0 || index >= count()) return nullptr;
13 return &events_[static_cast<std::size_t>(index)];
14}
15
17 switch (kind) {
18 case GrowthEventKind::StageChanged: return "stage_changed";
19 case GrowthEventKind::Matured: return "matured";
20 case GrowthEventKind::Produced: return "produced";
21 case GrowthEventKind::Harvested: return "harvested";
22 case GrowthEventKind::Watered: return "watered";
23 case GrowthEventKind::Fed: return "fed";
24 case GrowthEventKind::Fertilized: return "fertilized";
25 case GrowthEventKind::Diseased: return "diseased";
26 case GrowthEventKind::Cured: return "cured";
27 case GrowthEventKind::Bred: return "bred";
28 case GrowthEventKind::Offspring: return "offspring";
29 case GrowthEventKind::Died: return "died";
30 }
31 return "unknown";
32}
33
34} // namespace eve::growth
std::string kind
uint32_t index
void push(GrowthEvent event)
const GrowthEvent * at(int index) const
Borrowed event at index, or nullptr when out of range. @ownership Borrowed from this log; caller must...
static const char * kindName(GrowthEventKind kind) noexcept
Stable English spelling for an event kind.
GrowthEventKind
Kind of a deterministic growth lifecycle event.
One queued lifecycle observation.