Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
definition.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/***********************************************************************************************
20 *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
21 ***********************************************************************************************
22 * *
23 * Project Name : WWSaveLoad *
24 * *
25 * $Archive:: /Commando/Code/wwsaveload/definition.h $*
26 * *
27 * Author:: Patrick Smith *
28 * *
29 * $Modtime:: 8/24/01 4:57p $*
30 * *
31 * $Revision:: 20 $*
32 * *
33 *---------------------------------------------------------------------------------------------*
34 * Functions: *
35 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
36
37#if defined(_MSC_VER)
38#pragma once
39#endif
40
41#ifndef __DEFINITION_H
42#define __DEFINITION_H
43
44#include "always.h"
45// SKB Remove because of G conflicts with CLASSID_??
46#include "definitionclassids.h"
47#include "definitionmgr.h"
48#include "editable.h"
49#include "wwstring.h"
50
51// Forward declarations
52class ChunkSaveClass;
53class ChunkLoadClass;
54
55
57//
58// DefinitionClass
59//
62{
63public:
64
66 // Editable interface requirements
69
71 // Public constructors/destructors
73 DefinitionClass (void);
74 virtual ~DefinitionClass (void);
75
77 // Public methods
79
80 // Type identification
81 virtual uint32 Get_Class_ID (void) const = 0;
82 virtual uint32 Get_ID (void) const;
83 virtual void Set_ID (uint32 id);
84 virtual PersistClass * Create (void) const = 0;
85
86 // Display name methods
87 virtual const char * Get_Name (void) const;
88 virtual void Set_Name (const char *new_name);
89
90 // Validation methods
91 virtual bool Is_Valid_Config (StringClass &message);
92
93 // From PersistClass
94 virtual bool Save (ChunkSaveClass &csave);
95 virtual bool Load (ChunkLoadClass &cload);
96
97 // User data support
98 uint32 Get_User_Data (void) const { return m_GenericUserData; }
99 void Set_User_Data (uint32 data) { m_GenericUserData = data; }
100
101 // Save support
102 bool Is_Save_Enabled (void) const { return m_SaveEnabled; }
103 void Enable_Save (bool onoff) { m_SaveEnabled = onoff; }
104
105protected:
106
108 // Protected member data
111
112private:
113
115 // Private methods
117 bool Save_Variables (ChunkSaveClass &csave);
118 bool Load_Variables (ChunkLoadClass &cload);
119
121 // Private member data
123 StringClass m_Name;
124 uint32 m_ID;
125 uint32 m_GenericUserData;
126 bool m_SaveEnabled;
127
129 // Friends
131 friend class DefinitionMgrClass;
132};
133
134
136// DefinitionClass
138inline
140 : m_ID (0),
141 m_SaveEnabled (true),
143{
144 return ;
145}
146
148// DefinitionClass
150inline
155
157// Get_Name
159inline const char *
161{
162 return m_Name;
163}
164
166// Set_Name
168inline void
169DefinitionClass::Set_Name (const char *new_name)
170{
171 m_Name = new_name;
172 return ;
173}
174
176// Get_ID
178inline uint32
180{
181 return m_ID;
182}
183
185// Is_Valid_Config
187inline bool
189{
190 return true;
191}
192
193
194#endif //__DEFINITION_H
unsigned long uint32
Definition bittype.h:46
@ true
Definition bool.h:59
virtual bool Is_Valid_Config(StringClass &message)
Definition definition.h:188
virtual void Set_ID(uint32 id)
virtual uint32 Get_ID(void) const
Definition definition.h:179
friend class DefinitionMgrClass
Definition definition.h:131
uint32 Get_User_Data(void) const
Definition definition.h:98
void Set_User_Data(uint32 data)
Definition definition.h:99
virtual PersistClass * Create(void) const =0
virtual const char * Get_Name(void) const
Definition definition.h:160
virtual void Set_Name(const char *new_name)
Definition definition.h:169
void Enable_Save(bool onoff)
Definition definition.h:103
DefinitionClass(void)
Definition definition.h:139
virtual ~DefinitionClass(void)
Definition definition.h:151
virtual bool Save(ChunkSaveClass &csave)
virtual bool Load(ChunkLoadClass &cload)
DECLARE_EDITABLE(DefinitionClass, EditableClass)
virtual uint32 Get_Class_ID(void) const =0
bool Is_Save_Enabled(void) const
Definition definition.h:102
else return(RetVal)