R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
GameruleKeys.hpp File Reference
#include <optional>
#include <string>
#include <unordered_map>
Include dependency graph for GameruleKeys.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  GameruleKeys
 

Enumerations

enum class  GameruleKey {
  PLAYER_SPEED , PLAYER_HEALTH , PLAYER_FIRE_RATE , PLAYER_DAMAGE ,
  PLAYER_SPAWN_X , PLAYER_SPAWN_Y , GAME_SPEED_MULTIPLIER
}
 Type-safe enum for gamerule identifiers. More...
 

Functions

const char * GameruleKeys::toString (GameruleKey key)
 Convert GameruleKey enum to string.
 
std::optional< GameruleKeyGameruleKeys::fromString (const std::string &str)
 Convert string to GameruleKey enum (optional, for deserialization)
 

Variables

static constexpr const char * GameruleKeys::PLAYER_SPEED = "player.speed"
 
static constexpr const char * GameruleKeys::PLAYER_HEALTH = "player.health"
 
static constexpr const char * GameruleKeys::PLAYER_FIRE_RATE = "player.fireRate"
 
static constexpr const char * GameruleKeys::PLAYER_DAMAGE = "player.damage"
 
static constexpr const char * GameruleKeys::PLAYER_SPAWN_X = "player.spawnX"
 
static constexpr const char * GameruleKeys::PLAYER_SPAWN_Y = "player.spawnY"
 

Enumeration Type Documentation

◆ GameruleKey

enum class GameruleKey
strong

Type-safe enum for gamerule identifiers.

Using an enum instead of raw strings prevents typos and makes the code more maintainable.

Enumerator
PLAYER_SPEED 
PLAYER_HEALTH 
PLAYER_FIRE_RATE 
PLAYER_DAMAGE 
PLAYER_SPAWN_X 
PLAYER_SPAWN_Y 
GAME_SPEED_MULTIPLIER 

Game speed multiplier (0.25 to 1.0, accessibility feature)

Definition at line 20 of file GameruleKeys.hpp.