OpenClonk
C4NameList.h
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) 2009-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 static list of strings and integer values, i.e. for material amounts */
19 
20 #ifndef INC_C4NameList
21 #define INC_C4NameList
22 
23 const int C4MaxNameList = 10;
24 
25 #include "config/C4Constants.h"
26 #include "lib/C4InputValidation.h"
27 
29 {
30 public:
31  char Name[C4MaxNameList][C4MaxName + 1] = { { 0 } };
32  int32_t Count[C4MaxNameList] = { 0 };
33 public:
34  void Clear();
35  bool Add(const char *szName, int32_t iCount=0);
36  bool Set(const char *szName, int32_t iCount);
37 public:
38  bool IsEmpty();
39  bool operator==(const C4NameList& rhs)
40  { return !std::memcmp((const uint8_t*)this,(const uint8_t*)&rhs,sizeof(C4NameList)); }
41  void CompileFunc(StdCompiler *pComp, bool fValues = true);
42 };
43 
44 #endif
const unsigned int C4MaxName
const int C4MaxNameList
Definition: C4NameList.h:23
void Clear()
Definition: C4NameList.cpp:23
char Name[C4MaxNameList][C4MaxName+1]
Definition: C4NameList.h:31
bool IsEmpty()
Definition: C4NameList.cpp:64
void CompileFunc(StdCompiler *pComp, bool fValues=true)
Definition: C4NameList.cpp:72
bool Add(const char *szName, int32_t iCount=0)
Definition: C4NameList.cpp:50
int32_t Count[C4MaxNameList]
Definition: C4NameList.h:32
bool operator==(const C4NameList &rhs)
Definition: C4NameList.h:39
bool Set(const char *szName, int32_t iCount)
Definition: C4NameList.cpp:28