载入中...
搜索中...
未找到
Growth.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4#include "common/Module.h"
5#include "common/Result.h"
7#include "growth/Organism.h"
8#include "growth/Species.h"
9
10#include <cstdint>
11#include <string>
12#include <vector>
13
14namespace eve::growth {
15
20public:
22 Growth() = default;
23 ~Growth() override = default;
24
26 [[nodiscard]] Result<int> registerSpeciesFromJson(const std::string& json);
28 void clearSpecies();
29 [[nodiscard]] bool hasSpecies(const std::string& id) const;
30 [[nodiscard]] int speciesCount() const;
31
32 [[nodiscard]] Result<void> setDaysPerSeason(int days);
37 [[nodiscard]] Result<void> setSeasonLayoutFromJson(const std::string& json);
38 [[nodiscard]] Result<void> setSecondsPerSimDay(double seconds);
39 void setRngSeed(std::uint64_t seed);
40 [[nodiscard]] Result<void> advanceDays(double days);
41 [[nodiscard]] Result<void> stepSeconds(double seconds);
42
43 [[nodiscard]] std::int64_t dayIndex() const;
44 [[nodiscard]] std::int64_t year() const;
45 [[nodiscard]] std::string seasonName() const;
46
48 [[nodiscard]] Result<Organism*> spawn(const std::string& speciesId);
50 [[nodiscard]] Result<Organism*> plant(const std::string& speciesId);
52 [[nodiscard]] Result<Organism*> spawnAnimal(const std::string& speciesId);
53 [[nodiscard]] Result<void> tryBreed(Organism* carrier, Organism* partner);
55 [[nodiscard]] Result<void> tryReproduce(Organism* organism);
56
57 void clearEvents();
58 [[nodiscard]] int eventCount() const;
59 [[nodiscard]] std::string eventKind(int index) const;
60 [[nodiscard]] std::uint64_t eventOrganismId(int index) const;
61 [[nodiscard]] std::string eventSpeciesId(int index) const;
62 [[nodiscard]] std::string eventDetail(int index) const;
63
65 void resetWorld();
66};
67
68} // namespace eve::growth
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
Definition Export.h:106
std::int32_t plant
Move-only, checked operation results for the common layer.
uint32_t seed
Definition TreeMesh.cpp:276
uint32_t index
EVENGINE_API_FOUNDATION public API.
Definition Module.h:48
Move-only operation result carrying either a value or Status.
Definition Result.h:176
Farm growth module facade (eve.Growth): species registry + world step.
Definition Growth.h:19
~Growth() override=default
Growth short-root entity for any configured lifeform.
Definition Organism.h:29