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

Method LoadProfessionDescription

src/Managers/ProfessionManager.cpp:387–444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385}
386
387void CProfessionManager::LoadProfessionDescription()
388{
389 CMappedFile file;
390
391 if (file.Load(g_App.UOFilesPath("Professn.enu")))
392 {
393 char *ptr = (char *)file.Start;
394 char *end = (char *)((uintptr_t)file.Start + file.Size);
395
396 std::vector<astr_t> list;
397
398 while (ptr < end)
399 {
400 if (memcmp(ptr, "TEXT", 4) == 0)
401 {
402 ptr += 8;
403
404 while (ptr < end)
405 {
406 if (((*(ptr - 1)) == 0) && ((*ptr) == 0)) //end of names section
407 {
408 ptr++;
409
410 break;
411 }
412
413 list.push_back(ptr);
414 ptr += strlen(ptr) + 1;
415 }
416
417 ((CBaseProfession *)m_Items)->AddDescription(-2, "parent", ptr);
418 ptr += strlen(ptr) + 1;
419
420 for (int i = 0; i < (int)list.size(); i++)
421 {
422 if (!((CBaseProfession *)m_Items)->AddDescription((int)i - 1, list[i], ptr))
423 {
424 TRACE(Data, "failed to add description: %s", list[i].c_str());
425 }
426 ptr += strlen(ptr) + 1;
427 }
428
429 break;
430 }
431
432 ptr++;
433 }
434
435 list.clear();
436
437 file.Unload();
438 }
439 else
440 {
441 Warning(Data, "failed to load professn.enu");
442 g_GameWindow.ShowMessage("Failed to load professn.enu", "Failed to load");
443 }
444}

Callers

nothing calls this directly

Calls 9

UOFilesPathMethod · 0.80
AddDescriptionMethod · 0.80
c_strMethod · 0.80
ShowMessageMethod · 0.80
LoadMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45
UnloadMethod · 0.45

Tested by

no test coverage detected