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

Method SaveLocalConfig

src/CrossUO.cpp:1414–1482  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1412}
1413
1414void CGame::SaveLocalConfig(int serial)
1415{
1416 if (!g_ConfigLoaded)
1417 {
1418 return;
1419 }
1420 auto path = g_App.FilePath("desktop");
1421 if (!fs_path_exists(path))
1422 {
1423 Info(Client, "%s Does not exist, creating.", fs_path_ascii(path));
1424 fs_path_create(path);
1425 }
1426
1427 path = fs_path_join(path, g_MainScreen.m_Account->GetTextA());
1428 if (!fs_path_exists(path))
1429 {
1430 Info(Client, "%s Does not exist, creating.", fs_path_ascii(path));
1431 fs_path_create(path);
1432 }
1433 CServer *server = g_ServerList.GetSelectedServer();
1434 if (server != nullptr)
1435 {
1436 path = fs_path_join(path, FixServerName(server->Name));
1437 }
1438 if (!fs_path_exists(path))
1439 {
1440 Info(Client, "%s Does not exist, creating.", fs_path_ascii(path));
1441 fs_path_create(path);
1442 }
1443 char serbuf[64] = { 0 };
1444 sprintf_s(serbuf, "0x%08X", g_PlayerSerial);
1445 fs_path root = path;
1446 path = fs_path_join(path, serbuf);
1447 if (!fs_path_exists(path))
1448 {
1449 Info(Client, "%s Does not exist, creating.", fs_path_ascii(path));
1450 fs_path_create(path);
1451 }
1452 else
1453 {
1454 Info(Client, "SaveLocalConfig using path: %s", fs_path_ascii(path));
1455 }
1456
1457 Info(Client, "managers:saving");
1458 g_ConfigManager.Save(fs_path_join(path, "options.cfg"));
1459 g_SkillGroupManager.Save(fs_path_join(path, "skills.xuo"));
1460 g_MacroManager.Save(fs_path_join(path, "macros.xuo"));
1461 g_GumpManager.Save(fs_path_join(path, "gumps.xuo"));
1462 g_CustomHousesManager.Save(fs_path_join(path, "customhouses.xuo"));
1463
1464 if (g_Player != nullptr)
1465 {
1466 Info(Client, "player exists");
1467 Info(Client, "name len: %zd", g_Player->GetName().length());
1468 path = fs_path_join(root, astr_t(serbuf) + "_" + g_Player->GetName() + ".xuo");
1469 if (!fs_path_exists(path))
1470 {
1471 Info(Client, "file saving");

Callers 2

PACKET_HANDLERFunction · 0.80
ProcessMethod · 0.80

Calls 12

fs_path_existsFunction · 0.85
fs_path_asciiFunction · 0.85
fs_path_createFunction · 0.85
fs_path_joinFunction · 0.85
fs_openFunction · 0.85
fs_closeFunction · 0.85
FilePathMethod · 0.80
GetSelectedServerMethod · 0.80
lengthMethod · 0.80
GetTextAMethod · 0.45
SaveMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected