Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
PresetMgr.h
1/* Renegade Scripts.dll
2 Copyright 2013 Tiberian Technologies
3
4 This file is part of the Renegade scripts.dll
5 The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 2, or (at your option) any later
8 version. See the file COPYING for more details.
9 In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
10 Only the source code to the module(s) containing the licenced code has to be released.
11*/
12#ifndef TT_INCLUDE_PRESETMGR_H
13#define TT_INCLUDE_PRESETMGR_H
14#include "Persist.h"
15#include "engine_string.h"
16#include "engine_vector.h"
17#include "SaveLoadSubSystemClass.h"
18#include "engine_io.h"
19class DefinitionClass;
20class NodeClass;
21class PresetClass;
22class PresetMgrClass : public SaveLoadSubSystemClass
23{
24public:
25 PresetClass *_PresetListHead;
26 bool PresetsDirty;
27 bool ImmedCheckin;
28 virtual ~PresetMgrClass();
29 virtual uint32 Chunk_ID() const;
30 virtual bool Contains_Data() const;
31 virtual bool Save(ChunkSaveClass& oSave);
32 virtual bool Load(ChunkLoadClass& oLoad);
33 virtual const char *Name() const;
34 static PresetClass *Find_Preset(uint32 id);
35 static void Destroy_Presets();
36 static void Add_Preset(PresetClass *preset);
37 static PresetClass *Find_First_Preset(uint32 ClassID, int MatchType, bool FollowTwiddlers);
38 static PresetClass *Find_Next_Preset(PresetClass *preset,uint32 ClassID, int MatchType, bool FollowTwiddlers);
39 static bool Match_Class_ID(uint32 classid, int MatchType, bool FollowTwiddlers, PresetClass *preset);
40};
41class PresetClass : public PersistClass
42{
43 PresetClass *m_NextPreset;
44 PresetClass *m_PrevPreset;
45 PresetClass *parent;
46 DefinitionClass *definition;
47 DynamicVectorClass<StringClass> dependencies;
48 StringClass Comments;
49 bool IsTemp;
50 bool IsGood;
51 uint32 ParentID;
52 uint32 m_DefinitionID;
53 DynamicVectorClass<NodeClass *> Nodes;
54 DynamicVectorClass<uint32> ChildIDs;
55public:
56 PresetClass();
57 virtual ~PresetClass();
58 virtual void On_Post_Load(void);
59 virtual const PersistFactoryClass & Get_Factory(void) const;
60 virtual bool Save(ChunkSaveClass &csave);
61 virtual bool Load(ChunkLoadClass &cload);
62 void Remove_ID(uint32 id);
63 void Add_ID_To_List(uint32 id);
64 PresetClass *Next()
65 {
66 return m_NextPreset;
67 }
68 PresetClass *Prev()
69 {
70 return m_PrevPreset;
71 }
72 void Set_Next(PresetClass *preset)
73 {
74 m_NextPreset = preset;
75 }
76 void Set_Prev(PresetClass *preset)
77 {
78 m_PrevPreset = preset;
79 }
80 bool Is_Good()
81 {
82 return IsGood;
83 }
84 PresetClass *Get_Child(int index)
85 {
86 if (index >= 0 && index < ChildIDs.Count())
87 {
88 return PresetMgrClass::Find_Preset(ChildIDs[index]);
89 }
90 return 0;
91 }
92 int Get_Child_Count()
93 {
94 return ChildIDs.Count();
95 }
96 DefinitionClass *Get_Definition()
97 {
98 return definition;
99 }
100 PresetClass *Get_Parent()
101 {
102 return parent;
103 }
104 uint32 Get_Definition_ID()
105 {
106 return m_DefinitionID;
107 }
108 void Set_Definition_ID(uint32 id)
109 {
110 m_DefinitionID = id;
111 }
112 bool Is_Temp()
113 {
114 return IsTemp;
115 }
116};
117
118#if (DDBEDIT) || (TDBEDIT) || (W3DVIEWER)
119extern PresetMgrClass _ThePresetMgr;
120#else
121extern REF_DECL(PresetMgrClass, _ThePresetMgr);
122#endif
123#endif