OpenClonk
C4MaterialList Class Reference

#include <C4MaterialList.h>

Public Member Functions

 C4MaterialList ()
 
 ~C4MaterialList ()
 
void Default ()
 
void Clear ()
 
void Reset ()
 
int32_t Get (int32_t iMaterial)
 
void Add (int32_t iMaterial, int32_t iAmount)
 
void Set (int32_t iMaterial, int32_t iAmount)
 

Public Attributes

int32_t Amount [C4MaxMaterial]
 

Detailed Description

Definition at line 25 of file C4MaterialList.h.

Constructor & Destructor Documentation

◆ C4MaterialList()

C4MaterialList::C4MaterialList ( )

Definition at line 23 of file C4MaterialList.cpp.

References Default().

24 {
25  Default();
26 }
Here is the call graph for this function:

◆ ~C4MaterialList()

C4MaterialList::~C4MaterialList ( )

Definition at line 28 of file C4MaterialList.cpp.

References Clear().

29 {
30  Clear();
31 }
Here is the call graph for this function:

Member Function Documentation

◆ Add()

void C4MaterialList::Add ( int32_t  iMaterial,
int32_t  iAmount 
)

Definition at line 55 of file C4MaterialList.cpp.

References Amount, and C4MaxMaterial.

56 {
57  if (!Inside<int32_t>(iMaterial,0,C4MaxMaterial)) return;
58  Amount[iMaterial]+=iAmount;
59 }
int32_t Amount[C4MaxMaterial]
const int32_t C4MaxMaterial
Definition: C4Landscape.h:25

◆ Clear()

void C4MaterialList::Clear ( )

Definition at line 38 of file C4MaterialList.cpp.

Referenced by ~C4MaterialList().

39 {
40 
41 }
Here is the caller graph for this function:

◆ Default()

void C4MaterialList::Default ( )

Definition at line 33 of file C4MaterialList.cpp.

References Reset().

Referenced by C4MaterialList().

34 {
35  Reset();
36 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Get()

int32_t C4MaterialList::Get ( int32_t  iMaterial)

Definition at line 61 of file C4MaterialList.cpp.

References Amount, and C4MaxMaterial.

62 {
63  if (!Inside<int32_t>(iMaterial,0,C4MaxMaterial)) return 0;
64  return Amount[iMaterial];
65 }
int32_t Amount[C4MaxMaterial]
const int32_t C4MaxMaterial
Definition: C4Landscape.h:25

◆ Reset()

void C4MaterialList::Reset ( )

Definition at line 43 of file C4MaterialList.cpp.

References Amount.

Referenced by Default().

44 {
45  for (int & cnt : Amount)
46  cnt=0;
47 }
int32_t Amount[C4MaxMaterial]
Here is the caller graph for this function:

◆ Set()

void C4MaterialList::Set ( int32_t  iMaterial,
int32_t  iAmount 
)

Definition at line 49 of file C4MaterialList.cpp.

References Amount, and C4MaxMaterial.

50 {
51  if (!Inside<int32_t>(iMaterial,0,C4MaxMaterial)) return;
52  Amount[iMaterial]=iAmount;
53 }
int32_t Amount[C4MaxMaterial]
const int32_t C4MaxMaterial
Definition: C4Landscape.h:25

Member Data Documentation

◆ Amount

int32_t C4MaterialList::Amount[C4MaxMaterial]

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