OpenClonk
C4MaterialList.cpp
Go to the documentation of this file.
1
/*
2
* OpenClonk, http://www.openclonk.org
3
*
4
* Copyright (c) 1998-2000, Matthes Bender
5
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
6
* Copyright (c) 2013-2016, The OpenClonk Team and contributors
7
*
8
* Distributed under the terms of the ISC license; see accompanying file
9
* "COPYING" for details.
10
*
11
* "Clonk" is a registered trademark of Matthes Bender, used with permission.
12
* See accompanying file "TRADEMARK" for details.
13
*
14
* To redistribute this file separately, substitute the full license texts
15
* for the above references.
16
*/
17
18
/* A primitive list to store one amount value per mapped material */
19
20
#include "
C4Include.h
"
21
#include "
landscape/C4MaterialList.h
"
22
23
C4MaterialList::C4MaterialList
()
24
{
25
Default
();
26
}
27
28
C4MaterialList::~C4MaterialList
()
29
{
30
Clear
();
31
}
32
33
void
C4MaterialList::Default
()
34
{
35
Reset
();
36
}
37
38
void
C4MaterialList::Clear
()
39
{
40
41
}
42
43
void
C4MaterialList::Reset
()
44
{
45
for
(
int
& cnt :
Amount
)
46
cnt=0;
47
}
48
49
void
C4MaterialList::Set
(int32_t iMaterial, int32_t iAmount)
50
{
51
if
(!Inside<int32_t>(iMaterial,0,
C4MaxMaterial
))
return
;
52
Amount
[iMaterial]=iAmount;
53
}
54
55
void
C4MaterialList::Add
(int32_t iMaterial, int32_t iAmount)
56
{
57
if
(!Inside<int32_t>(iMaterial,0,
C4MaxMaterial
))
return
;
58
Amount
[iMaterial]+=iAmount;
59
}
60
61
int32_t
C4MaterialList::Get
(int32_t iMaterial)
62
{
63
if
(!Inside<int32_t>(iMaterial,0,
C4MaxMaterial
))
return
0;
64
return
Amount
[iMaterial];
65
}
C4Include.h
C4MaxMaterial
const int32_t C4MaxMaterial
Definition:
C4Landscape.h:25
C4MaterialList.h
C4MaterialList::Reset
void Reset()
Definition:
C4MaterialList.cpp:43
C4MaterialList::C4MaterialList
C4MaterialList()
Definition:
C4MaterialList.cpp:23
C4MaterialList::~C4MaterialList
~C4MaterialList()
Definition:
C4MaterialList.cpp:28
C4MaterialList::Amount
int32_t Amount[C4MaxMaterial]
Definition:
C4MaterialList.h:31
C4MaterialList::Get
int32_t Get(int32_t iMaterial)
Definition:
C4MaterialList.cpp:61
C4MaterialList::Set
void Set(int32_t iMaterial, int32_t iAmount)
Definition:
C4MaterialList.cpp:49
C4MaterialList::Clear
void Clear()
Definition:
C4MaterialList.cpp:38
C4MaterialList::Default
void Default()
Definition:
C4MaterialList.cpp:33
C4MaterialList::Add
void Add(int32_t iMaterial, int32_t iAmount)
Definition:
C4MaterialList.cpp:55
openclonk
src
landscape
C4MaterialList.cpp
Generated on Thu Apr 25 2024 04:33:15 for OpenClonk by
1.9.1