MCPcopy Create free account
hub / github.com/crossuo/crossuo / Save

Method Save

src/Managers/SkillGroupManager.cpp:332–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330}
331
332void 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}

Callers

nothing calls this directly

Calls 8

WriteUInt8Method · 0.80
WriteUInt16LEMethod · 0.80
lengthMethod · 0.80
GetItemMethod · 0.80
WriteBufferMethod · 0.80
OpenMethod · 0.45
WriteStringMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected