1/*
2 * LegacyClonk
3 *
4 * Copyright (c) 1998-2000, Matthes Bender (RedWolf Design)
5 * Copyright (c) 2017-2019, The LegacyClonk Team and contributors
6 *
7 * Distributed under the terms of the ISC license; see accompanying file
8 * "COPYING" for details.
9 *
10 * "Clonk" is a registered trademark of Matthes Bender, used with permission.
11 * See accompanying file "TRADEMARK" for details.
12 *
13 * To redistribute this file separately, substitute the full license texts
14 * for the above references.
15 */
16
17/* A static list of strings and integer values, i.e. for material amounts */
18
19#include <C4NameList.h>
20
21#include "StdAdaptors.h"
22#include "StdCompiler.h"
23
24C4NameList::C4NameList()
25{
26 Clear();
27}
28
29void C4NameList::Clear()
30{
31 std::memset(s: this, c: 0, n: sizeof(C4NameList));
32}
33
34void C4NameList::CompileFunc(StdCompiler *pComp, bool fValues)
35{
36 bool fCompiler = pComp->isCompiler();
37 for (int32_t cnt = 0; cnt < C4MaxNameList; cnt++)
38 if (fCompiler || Name[cnt][0])
39 {
40 if (cnt) pComp->Separator(eSep: StdCompiler::SEP_SEP2);
41 // Name
42 pComp->Value(rStruct: mkDefaultAdapt(rValue: mkStringAdapt(szString: Name[cnt], iMaxLength: C4MaxName, eRawType: StdCompiler::RCT_Idtf), rDefault: ""));
43 // Value
44 if (fValues)
45 {
46 pComp->Separator(eSep: StdCompiler::SEP_SET);
47 pComp->Value(rStruct: mkDefaultAdapt(rValue&: Count[cnt], rDefault: 0));
48 }
49 }
50}
51