| 675 | } |
| 676 | |
| 677 | void FlowHandler::AddSecret(int levelSecretIndex) |
| 678 | { |
| 679 | static constexpr unsigned int maxSecretIndex = CHAR_BIT * sizeof(unsigned int); |
| 680 | |
| 681 | if (levelSecretIndex >= maxSecretIndex) |
| 682 | { |
| 683 | TENLog("Current maximum amount of secrets per level is " + std::to_string(maxSecretIndex) + ".", LogLevel::Warning); |
| 684 | return; |
| 685 | } |
| 686 | |
| 687 | if (SaveGame::Statistics.SecretBits & (1 << levelSecretIndex)) |
| 688 | return; |
| 689 | |
| 690 | if (SaveGame::Statistics.Game.Secrets >= UINT_MAX) |
| 691 | { |
| 692 | TENLog("Maximum amount of level secrets is already reached!", LogLevel::Warning); |
| 693 | return; |
| 694 | } |
| 695 | |
| 696 | PlaySecretTrack(); |
| 697 | SaveGame::Statistics.SecretBits |= 1 << levelSecretIndex; |
| 698 | SaveGame::Statistics.Level.Secrets++; |
| 699 | SaveGame::Statistics.Game.Secrets++; |
| 700 | } |
| 701 | |
| 702 | sol::table FlowHandler::GetSaveHeaders(sol::this_state state) |
| 703 | { |
nothing calls this directly
no test coverage detected