| 330 | } |
| 331 | |
| 332 | void CSkillGroupManager::Save(const fs_path &path) |
| 333 | { |
| 334 | Wisp::CBinaryFileWriter writer; |
| 335 | |
| 336 | writer.Open(path); |
| 337 | |
| 338 | writer.WriteUInt8(0); //version |
| 339 | |
| 340 | Count = 0; |
| 341 | CSkillGroupObject *group = m_Groups; |
| 342 | while (group != nullptr) |
| 343 | { |
| 344 | Count++; |
| 345 | group = group->m_Next; |
| 346 | } |
| 347 | |
| 348 | writer.WriteUInt16LE(Count); //Count |
| 349 | |
| 350 | group = m_Groups; |
| 351 | |
| 352 | for (int i = 0; i < Count; i++) |
| 353 | { |
| 354 | auto str = group->Name; |
| 355 | size_t len = str.length() + 1; |
| 356 | |
| 357 | short size = (short)len + 2 + 2 + 2 + group->Count; |
| 358 | writer.WriteUInt16LE(size); //Block size |
| 359 | |
| 360 | writer.WriteUInt16LE((short)len); //Name length |
| 361 | writer.WriteString(str, 0u); //Name |
| 362 | |
| 363 | short count = group->Count; |
| 364 | |
| 365 | writer.WriteUInt16LE(count); //Skills count |
| 366 | |
| 367 | for (int j = 0; j < count; j++) |
| 368 | { |
| 369 | uint8_t skill = group->GetItem(j); |
| 370 | writer.WriteUInt8(skill); //Skill |
| 371 | } |
| 372 | |
| 373 | writer.WriteBuffer(); |
| 374 | |
| 375 | group = group->m_Next; |
| 376 | } |
| 377 | |
| 378 | writer.Close(); |
| 379 | } |
nothing calls this directly
no test coverage detected