| 132 | //========================================================================== |
| 133 | |
| 134 | bool 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 | // |
no test coverage detected