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/* Dynamic list for crew member info */
18
19#pragma once
20
21#include <C4Id.h>
22#include "C4ObjectInfo.h"
23
24class C4ObjectInfoList
25{
26public:
27 C4ObjectInfoList();
28 ~C4ObjectInfoList();
29
30protected:
31 C4ObjectInfo *First;
32
33public:
34 int32_t iNumCreated; // number of new defs created during this round
35
36public:
37 void Default();
38 void Clear();
39 void Evaluate();
40 void DetachFromObjects();
41 int32_t Load(C4Group &hGroup, bool fLoadPortraits);
42 bool Add(C4ObjectInfo *pInfo);
43 bool Save(C4Group &hGroup, bool fSavegame, bool fStoreTiny, C4DefList *pDefs);
44 C4ObjectInfo *New(C4ID n_id, C4DefList *pDefs, const char *cpNames);
45 C4ObjectInfo *GetIdle(C4ID c_id, C4DefList &rDefs);
46 C4ObjectInfo *GetIdle(const char *szByName);
47 C4ObjectInfo *GetFirst() { return First; }
48 bool IsElement(C4ObjectInfo *pInfo);
49 void Strip(C4DefList &rDefs);
50
51public:
52 void MakeValidName(char *sName);
53 bool NameExists(const char *szName);
54
55protected:
56 C4ObjectInfo *GetLast();
57 C4ObjectInfo *GetPrevious(C4ObjectInfo *pInfo);
58};
59