Injected simulation calendar owned by GrowthWorld. 更多...
#include <GrowthCalendar.h>
Public 成员函数 | |
| GrowthCalendar () | |
| Result< void > | setSeasonLayout (std::vector< SeasonSlotDef > seasons) noexcept |
| Replaces the season layout (must be non-empty; each slot days > 0). @cost Cheap: copies a small season table. | |
| Result< void > | setSeasonLayoutFromJson (std::string_view json) |
Parses [{"id":"bloom","days":40},…] and applies setSeasonLayout. @cost Cheap JSON parse of a small array. | |
| Result< void > | setDaysPerSeason (int days) noexcept |
| Sets every slot's day count (keeps current ids). Positive only. | |
| int | daysPerSeason () const noexcept |
| Days of the first season slot (legacy helper). | |
| const std::vector< SeasonSlotDef > & | seasonLayout () const noexcept |
| int | seasonCount () const noexcept |
| std::int64_t | dayIndex () const noexcept |
| Absolute simulation day index (0-based). | |
| std::int64_t | year () const noexcept |
| 0-based year from dayIndex / yearLength. | |
| int | seasonIndex () const noexcept |
| Index into seasonLayout() for the current day. | |
| std::string | seasonId () const |
| Current season id string (never empty when layout is valid). | |
| Season | season () const noexcept |
| Legacy Season enum when layout is the default 4 Earth seasons; else maps by index%4. | |
| int | dayOfSeason () const noexcept |
| Day within the current season [0, slot.days). | |
| void | advanceWholeDays (std::int64_t days) noexcept |
| Advances the calendar by whole simulation days (truncated toward zero). | |
| void | reset () noexcept |
| Resets to day 0 (tests). | |
静态 Public 成员函数 | |
| static const char * | seasonName (Season season) noexcept |
| Stable English season name for the default Earth layout. | |
详细描述
Injected simulation calendar owned by GrowthWorld.
- 备注
- Advances only through GrowthWorld::advanceDays / step — never wall clock. Season count and names are configurable (alien year cycles welcome).
在文件 GrowthCalendar.h 第 30 行定义.
构造及析构函数说明
◆ GrowthCalendar()
| eve::growth::GrowthCalendar::GrowthCalendar | ( | ) |
在文件 GrowthCalendar.cpp 第 21 行定义.
成员函数说明
◆ advanceWholeDays()
|
noexcept |
Advances the calendar by whole simulation days (truncated toward zero).
在文件 GrowthCalendar.cpp 第 136 行定义.
◆ dayIndex()
|
inlinenoexcept |
Absolute simulation day index (0-based).
在文件 GrowthCalendar.h 第 56 行定义.
被这些函数引用 eve::growth::GrowthWorld::advanceDays() , 以及 eve::growth::Growth::dayIndex().
◆ dayOfSeason()
|
noexcept |
◆ daysPerSeason()
|
noexcept |
Days of the first season slot (legacy helper).
在文件 GrowthCalendar.cpp 第 91 行定义.
◆ reset()
|
noexcept |
Resets to day 0 (tests).
在文件 GrowthCalendar.cpp 第 141 行定义.
◆ season()
|
noexcept |
Legacy Season enum when layout is the default 4 Earth seasons; else maps by index%4.
- 弃用:
- Prefer seasonIndex()/seasonId() for custom calendars.
在文件 GrowthCalendar.cpp 第 122 行定义.
引用了 seasonIndex().
◆ seasonCount()
|
noexcept |
在文件 GrowthCalendar.cpp 第 96 行定义.
◆ seasonId()
| std::string eve::growth::GrowthCalendar::seasonId | ( | ) | const |
Current season id string (never empty when layout is valid).
在文件 GrowthCalendar.cpp 第 117 行定义.
引用了 seasonIndex().
被这些函数引用 eve::growth::Growth::seasonName().
◆ seasonIndex()
|
noexcept |
Index into seasonLayout() for the current day.
在文件 GrowthCalendar.cpp 第 107 行定义.
被这些函数引用 season() , 以及 seasonId().
◆ seasonLayout()
|
inlinenoexcept |
在文件 GrowthCalendar.h 第 52 行定义.
◆ seasonName()
|
staticnoexcept |
Stable English season name for the default Earth layout.
- 返回
- Non-owning pointer to a static string literal; never null. @ownership Caller does not own the pointer and must not free it. @lifetime Valid for the process lifetime (static storage). @nullable Never.
在文件 GrowthCalendar.cpp 第 143 行定义.
引用了 eve::growth::Autumn, eve::growth::Spring, eve::growth::Summer , 以及 eve::growth::Winter.
◆ setDaysPerSeason()
|
noexcept |
Sets every slot's day count (keeps current ids). Positive only.
- 备注
- With the default Earth layout this matches the old 4×N year.
在文件 GrowthCalendar.cpp 第 81 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, slot , 以及 eve::Result< T >::success().
◆ setSeasonLayout()
|
noexcept |
Replaces the season layout (must be non-empty; each slot days > 0). @cost Cheap: copies a small season table.
在文件 GrowthCalendar.cpp 第 23 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, slot , 以及 eve::Result< T >::success().
被这些函数引用 setSeasonLayoutFromJson().
◆ setSeasonLayoutFromJson()
| Result< void > eve::growth::GrowthCalendar::setSeasonLayoutFromJson | ( | std::string_view | json | ) |
Parses [{"id":"bloom","days":40},…] and applies setSeasonLayout. @cost Cheap JSON parse of a small array.
在文件 GrowthCalendar.cpp 第 39 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Value::fromJson(), eve::Value::getIf(), eve::InvalidArgument, number, object, root, setSeasonLayout() , 以及 slot.
◆ year()
|
noexcept |
0-based year from dayIndex / yearLength.
在文件 GrowthCalendar.cpp 第 105 行定义.
被这些函数引用 eve::growth::Growth::year().
该类的文档由以下文件生成:
- src/modules/growth/GrowthCalendar.h
- src/modules/growth/GrowthCalendar.cpp