OpenClonk
C4DefList.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 /* Object definition */
19 
20 #ifndef INC_C4DefList
21 #define INC_C4DefList
22 
24 
26 {
27 public:
28  C4DefList();
29  ~C4DefList() override;
30 public:
32  typedef std::map<C4ID, C4Def*> Table;
34 protected:
36  // Localized names of definition parent groups that do not contain a definition themselves
37  // Loaded for editor definition list
38  std::map<StdCopyStrBuf, StdCopyStrBuf> localized_group_folder_names;
39 public:
40  void Default();
41  void Clear();
42  int32_t Load(C4Group &hGroup,
43  DWORD dwLoadWhat, const char *szLanguage,
44  C4SoundSystem *pSoundSystem = nullptr,
45  bool fOverload = false,
46  bool fSearchMessage = false, int32_t iMinProgress=0, int32_t iMaxProgress=0, bool fLoadSysGroups = true);
47  int32_t Load(const char *szFilename,
48  DWORD dwLoadWhat, const char *szLanguage,
49  C4SoundSystem *pSoundSystem = nullptr,
50  bool fOverload = false, int32_t iMinProgress=0, int32_t iMaxProgress=0);
51  C4Def *ID2Def(C4ID id);
52  C4Def *GetDef(int32_t Index);
53  std::vector<C4Def*> GetAllDefs(C4String *filter_property=nullptr) const;
54  C4Def *GetByPath(const char *szPath);
55  C4Def *GetByName(const StdStrBuf &);
56  int32_t GetDefCount();
57  int32_t GetIndex(C4ID id);
58  int32_t RemoveTemporary();
59  int32_t CheckEngineVersion(int32_t ver1, int32_t ver2);
60  int32_t CheckRequireDef();
61  void Draw(C4ID id, C4Facet &cgo, bool fSelected, int32_t iColor);
62  void Remove(C4Def *def);
63  bool Remove(C4ID id);
64  bool Reload(C4Def *pDef, DWORD dwLoadWhat, const char *szLanguage, C4SoundSystem *pSoundSystem = nullptr);
65  bool Add(C4Def *ndef, bool fOverload);
66  void BuildTable();
67  void ResetIncludeDependencies(); // resets all pointers into foreign definitions caused by include chains
68  void CallEveryDefinition();
69  void SortByPriority();
70  void Synchronize();
73  const char *GetLocalizedGroupFolderName(const char *folder_path) const;
74 
75  // callback from font renderer: get ID image
76  bool DrawFontImage(const char* szImageTag, C4Facet& rTarget, C4DrawTransform* pTransform) override;
77  float GetFontImageAspect(const char* szImageTag) override;
78 private:
79  std::unique_ptr<StdMeshSkeletonLoader> SkeletonLoader;
80 };
81 
82 extern C4DefList Definitions;
83 
84 inline C4Def *C4Id2Def(C4ID id)
85 {
87 }
88 
89 #endif
90 
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:84
C4DefList Definitions
Definition: C4Globals.cpp:49
uint32_t DWORD
Definition: C4Def.h:99
int32_t Load(C4Group &hGroup, DWORD dwLoadWhat, const char *szLanguage, C4SoundSystem *pSoundSystem=nullptr, bool fOverload=false, bool fSearchMessage=false, int32_t iMinProgress=0, int32_t iMaxProgress=0, bool fLoadSysGroups=true)
Definition: C4DefList.cpp:71
std::map< StdCopyStrBuf, StdCopyStrBuf > localized_group_folder_names
Definition: C4DefList.h:38
std::map< C4ID, C4Def * > Table
Definition: C4DefList.h:32
void Default()
Definition: C4DefList.cpp:413
int32_t GetDefCount()
int32_t GetIndex(C4ID id)
Definition: C4DefList.cpp:275
void Clear()
const char * GetLocalizedGroupFolderName(const char *folder_path) const
Definition: C4DefList.cpp:531
bool LoadFailure
Definition: C4DefList.h:31
C4Def * FirstDef
Definition: C4DefList.h:35
void SortByPriority()
Definition: stub-handle.cpp:76
float GetFontImageAspect(const char *szImageTag) override
Definition: stub-handle.cpp:80
void Synchronize()
Definition: C4DefList.cpp:458
Table table
Definition: C4DefList.h:33
C4Def * GetDef(int32_t Index)
C4Def * GetByPath(const char *szPath)
Definition: C4DefList.cpp:323
int32_t RemoveTemporary()
Definition: C4DefList.cpp:343
void BuildTable()
Definition: C4DefList.cpp:514
bool Add(C4Def *ndef, bool fOverload)
StdMeshSkeletonLoader & GetSkeletonLoader()
Definition: C4DefList.cpp:526
void ResetIncludeDependencies()
Definition: stub-handle.cpp:78
int32_t CheckRequireDef()
Definition: C4DefList.cpp:384
bool DrawFontImage(const char *szImageTag, C4Facet &rTarget, C4DrawTransform *pTransform) override
Definition: stub-handle.cpp:79
std::vector< C4Def * > GetAllDefs(C4String *filter_property=nullptr) const
Definition: C4DefList.cpp:304
int32_t CheckEngineVersion(int32_t ver1, int32_t ver2)
Definition: C4DefList.cpp:365
void Remove(C4Def *def)
Definition: C4DefList.cpp:220
void CallEveryDefinition()
Definition: stub-handle.cpp:77
~C4DefList() override
void Draw(C4ID id, C4Facet &cgo, bool fSelected, int32_t iColor)
Definition: C4DefList.cpp:407
bool Reload(C4Def *pDef, DWORD dwLoadWhat, const char *szLanguage, C4SoundSystem *pSoundSystem=nullptr)
Definition: C4DefList.cpp:420
void AppendAndIncludeSkeletons()
Definition: C4DefList.cpp:521
C4Def * GetByName(const StdStrBuf &)
C4Def * ID2Def(C4ID id)
Definition: C4Id.h:26