Zappy Server
C++ game server: world, rules, scheduler, network
Loading...
Searching...
No Matches
Resources Class Reference

Represents the resources available in the game, including food and various minerals. More...

#include <Resources.hpp>

+ Collaboration diagram for Resources:

Public Member Functions

bool isEmpty () const
 
int & operator[] (size_t index)
 
const int & operator[] (size_t index) const
 
int & operator[] (ResourceType type)
 
const int & operator[] (ResourceType type) const
 

Static Public Member Functions

static std::string get_name (int index)
 
static std::optional< ResourceTypefromName (std::string_view name)
 
static std::string get_name (ResourceType type)
 
static float density (ResourceType type)
 

Public Attributes

int food = 0
 
int linemate = 0
 
int deraumere = 0
 
int sibur = 0
 
int mendiane = 0
 
int phiras = 0
 
int thystame = 0
 

Static Public Attributes

static constexpr int TYPE_COUNT = static_cast<int>(ResourceType::COUNT)
 

Detailed Description

Represents the resources available in the game, including food and various minerals.

Definition at line 17 of file Resources.hpp.

Member Function Documentation

◆ density()

static float Resources::density ( ResourceType  type)
inlinestatic

Definition at line 117 of file Resources.hpp.

References DERAUMERE, FOOD, LINEMATE, MENDIANE, PHIRAS, SIBUR, and THYSTAME.

Referenced by World::spawnResources().

+ Here is the caller graph for this function:

◆ fromName()

static std::optional< ResourceType > Resources::fromName ( std::string_view  name)
inlinestatic

Definition at line 55 of file Resources.hpp.

References DERAUMERE, FOOD, LINEMATE, MENDIANE, PHIRAS, SIBUR, and THYSTAME.

Referenced by AiParser::parse().

+ Here is the caller graph for this function:

◆ get_name() [1/2]

static std::string Resources::get_name ( int  index)
inlinestatic

Definition at line 33 of file Resources.hpp.

Referenced by _tileContent(), LogObserver::onResourceDropped(), and LogObserver::onResourceTaken().

+ Here is the caller graph for this function:

◆ get_name() [2/2]

static std::string Resources::get_name ( ResourceType  type)
inlinestatic

Definition at line 67 of file Resources.hpp.

References get_name().

Referenced by get_name().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isEmpty()

bool Resources::isEmpty ( ) const
inline

Definition at line 27 of file Resources.hpp.

References deraumere, food, linemate, mendiane, phiras, sibur, and thystame.

◆ operator[]() [1/4]

int & Resources::operator[] ( ResourceType  type)
inline

Definition at line 113 of file Resources.hpp.

◆ operator[]() [2/4]

const int & Resources::operator[] ( ResourceType  type) const
inline

Definition at line 115 of file Resources.hpp.

◆ operator[]() [3/4]

int & Resources::operator[] ( size_t  index)
inline

Definition at line 69 of file Resources.hpp.

References deraumere, food, linemate, mendiane, phiras, sibur, and thystame.

◆ operator[]() [4/4]

const int & Resources::operator[] ( size_t  index) const
inline

Definition at line 91 of file Resources.hpp.

References deraumere, food, linemate, mendiane, phiras, sibur, and thystame.

Member Data Documentation

◆ deraumere

int Resources::deraumere = 0

◆ food

◆ linemate

int Resources::linemate = 0

◆ mendiane

int Resources::mendiane = 0

◆ phiras

int Resources::phiras = 0

◆ sibur

int Resources::sibur = 0

◆ thystame

int Resources::thystame = 0

◆ TYPE_COUNT

constexpr int Resources::TYPE_COUNT = static_cast<int>(ResourceType::COUNT)
staticconstexpr

Definition at line 138 of file Resources.hpp.

Referenced by _tileContent(), and World::spawnResources().


The documentation for this class was generated from the following file: