Skip to main content

MatchState.ixx File

Match state enumeration and bitmask operations. More...

Included Headers

#include <cstdint>

Namespaces Index

namespacehelios
namespaceengine

Main engine module aggregating core infrastructure and game systems. More...

namespacemechanics

High-level gameplay systems and components for game logic. More...

namespacematch

Match state management for the helios engine. More...

namespacetypes

Core types for match state management. More...

Description

Match state enumeration and bitmask operations.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file MatchState.ixx
3 * @brief Match state enumeration and bitmask operations.
4 */
5module;
6
7#include <cstdint>
8
9export module helios.engine.mechanics.match.types.MatchState;
10
11
12
14
15 /**
16 * @brief Underlying type for MatchState bitmask values.
17 */
18 using MatchStateType = uint16_t;
19
20 constexpr size_t MatchStateTypeSize = 16;
21
22 /**
23 * @brief Enumeration of possible match states.
24 *
25 * States can be combined using bitwise operators for masking.
26 */
28
30
31 Warmup = 1 << 0,
32
33 Start = 1 << 1,
34
35 Countdown = 1 << 2,
36
37 Playing = 1 << 3,
38
39 PlayerDefeated = 1 << 4,
40
41 GameOver = 1 << 5
42
43 };
44
45 /**
46 * @brief Bitwise OR operator for combining match states.
47 */
48 [[nodiscard]] constexpr MatchState operator|(const MatchState lhs, const MatchState rhs) noexcept {
49 return static_cast<MatchState>(static_cast<MatchStateType>(lhs) | static_cast<MatchStateType>(rhs));
50 }
51
52 /**
53 * @brief Bitwise AND operator for masking match states.
54 */
55 [[nodiscard]] constexpr MatchState operator&(const MatchState lhs, const MatchState rhs) noexcept {
56 return static_cast<MatchState>(static_cast<MatchStateType>(lhs) & static_cast<MatchStateType>(rhs));
57 }
58
59 /**
60 * @brief Checks if a flag is set in a state mask.
61 *
62 * @param mask The state mask to check.
63 * @param flag The flag to check for.
64 * @return True if the flag is set in the mask.
65 */
66 [[nodiscard]] constexpr bool hasFlag(const MatchState mask, const MatchState flag) noexcept {
67 return (mask & flag) == flag;
68 }
69
70}
71

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.