| 385 | } |
| 386 | |
| 387 | void 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 | } |
nothing calls this directly
no test coverage detected