Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
definition.cpp
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.cpp $*
26 * *
27 * Author:: Patrick Smith *
28 * *
29 * $Modtime:: 8/24/01 4:35p $*
30 * *
31 * $Revision:: 10 $*
32 * *
33 *---------------------------------------------------------------------------------------------*
34 * Functions: *
35 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
36
37#include "definition.h"
38#include "chunkio.h"
39
41// Constants
43enum
44{
45 CHUNKID_VARIABLES = 0x00000100,
46};
47
48enum
49{
53};
54
55
57//
58// Save
59//
61bool
63{
64 bool retval = true;
65
67 retval &= Save_Variables (csave);
68 csave.End_Chunk ();
69
70 return retval;
71}
72
73
75//
76// Load
77//
79bool
81{
82 bool retval = true;
83
84 while (cload.Open_Chunk ()) {
85 switch (cload.Cur_Chunk_ID ()) {
86
88 Load_Variables (cload);
89 break;
90 }
91
92 cload.Close_Chunk ();
93 }
94
95 return retval;
96}
97
98
100//
101// Save_Variables
102//
104bool
105DefinitionClass::Save_Variables (ChunkSaveClass &csave)
106{
107 bool retval = true;
108
109 WRITE_MICRO_CHUNK (csave, VARID_INSTANCEID, m_ID);
110 WRITE_MICRO_CHUNK_WWSTRING (csave, VARID_NAME, m_Name);
111 return retval;
112}
113
114
116//
117// Load_Variables
118//
120bool
121DefinitionClass::Load_Variables (ChunkLoadClass &cload)
122{
123 bool retval = true;
124
125 //
126 // Loop through all the microchunks that define the variables
127 //
128 while (cload.Open_Micro_Chunk ()) {
129 switch (cload.Cur_Micro_Chunk_ID ()) {
130
133 }
134
135 cload.Close_Micro_Chunk ();
136 }
137
138 return retval;
139}
140
141
143//
144// Set_ID
145//
147void
149{
150 m_ID = id;
151
152 //
153 // If we are registered with the definition manager, then we need to
154 // re-link ourselves back into the list
155 //
156 if (m_DefinitionMgrLink != -1) {
159 }
160
161 return ;
162}
163
unsigned long uint32
Definition bittype.h:46
#define WRITE_MICRO_CHUNK_WWSTRING(csave, id, var)
Definition chunkio.h:309
#define WRITE_MICRO_CHUNK(csave, id, var)
Definition chunkio.h:293
#define READ_MICRO_CHUNK(cload, id, var)
Definition chunkio.h:334
#define READ_MICRO_CHUNK_WWSTRING(cload, id, var)
Definition chunkio.h:351
@ CHUNKID_VARIABLES
bool Close_Micro_Chunk()
Definition chunkio.cpp:585
bool Close_Chunk()
Definition chunkio.cpp:448
uint32 Cur_Chunk_ID()
Definition chunkio.cpp:484
uint32 Cur_Micro_Chunk_ID()
Definition chunkio.cpp:622
bool Open_Chunk()
Definition chunkio.cpp:412
bool Open_Micro_Chunk()
Definition chunkio.cpp:557
bool Begin_Chunk(uint32 id)
Definition chunkio.cpp:108
bool End_Chunk()
Definition chunkio.cpp:148
virtual void Set_ID(uint32 id)
virtual bool Save(ChunkSaveClass &csave)
virtual bool Load(ChunkLoadClass &cload)
static void Unregister_Definition(DefinitionClass *definition)
static void Register_Definition(DefinitionClass *definition)
@ XXX_VARID_PARENTID
@ VARID_INSTANCEID
@ VARID_NAME
else return(RetVal)