MCPcopy Create free account
hub / github.com/ZDoom/Raze / ReadAllFields

Method ReadAllFields

source/common/objects/dobjtype.cpp:134–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132//==========================================================================
133
134bool PClass::ReadAllFields(FSerializer &ar, void *addr) const
135{
136 bool readsomething = false;
137 bool foundsomething = false;
138 const char *key;
139 key = ar.GetKey();
140 if (strcmp(key, "classtype"))
141 {
142 // this does not represent a DObject
143 Printf(TEXTCOLOR_RED "trying to read user variables but got a non-object (first key is '%s')\n", key);
144 ar.mErrors++;
145 return false;
146 }
147 while ((key = ar.GetKey()))
148 {
149 if (strncmp(key, "class:", 6))
150 {
151 // We have read all user variable blocks.
152 break;
153 }
154 foundsomething = true;
155 PClass *type = PClass::FindClass(key + 6);
156 if (type != nullptr)
157 {
158 // Only read it if the type is related to this one.
159 if (IsDescendantOf(type))
160 {
161 if (ar.BeginObject(nullptr))
162 {
163 readsomething |= type->VMType->Symbols.ReadFields(ar, addr, type->TypeName.GetChars());
164 ar.EndObject();
165 }
166 }
167 else
168 {
169 DPrintf(DMSG_ERROR, "Unknown superclass %s of class %s\n",
170 type->TypeName.GetChars(), TypeName.GetChars());
171 }
172 }
173 else
174 {
175 DPrintf(DMSG_ERROR, "Unknown superclass %s of class %s\n",
176 key+6, TypeName.GetChars());
177 }
178 }
179 return readsomething || !foundsomething;
180}
181
182//==========================================================================
183//

Callers 1

SerializeUserVarsMethod · 0.80

Calls 7

PrintfFunction · 0.85
DPrintfFunction · 0.85
GetKeyMethod · 0.80
ReadFieldsMethod · 0.80
BeginObjectMethod · 0.45
GetCharsMethod · 0.45
EndObjectMethod · 0.45

Tested by

no test coverage detected