MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / InsertGames

Method InsertGames

engine/Poseidon/UI/DisplayUI.cpp:1529–1690  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1527 CTreeItem* itemWorld = itemCampaign->AddChild();
1528
1529 itemWorld->text = Pars >> "CfgWorlds" >> name >> "description";
1530 itemWorld->data = name;
1531 bool wexp = stricmp(Glob.header.worldname, name) == 0;
1532 if (wexp && Glob.header.filename[0] == 0)
1533 {
1534 selected = itemWorld;
1535 }
1536 _finddata_t info;
1537 char buffer[256];
1538 snprintf(buffer, sizeof(buffer), "Missions\\*.%s", (const char*)name);
1539 intptr_t h = _findfirst(buffer, &info);
1540 if (h != -1)
1541 {
1542 do
1543 {
1544 if ((info.attrib & _A_SUBDIR) != 0 && info.name[0] != '.')
1545 {
1546 char name[256];
1547 snprintf(name, sizeof(name), "%s", (const char*)info.name);
1548 char* ext = strrchr(name, '.');
1549 if (ext)
1550 {
1551 *ext = 0;
1552 }
1553 CTreeItem* itemMission = itemWorld->AddChild();
1554 itemMission->text = name;
1555 itemMission->data = name;
1556 if (wexp && stricmp(Glob.header.filename, name) == 0)
1557 {
1558 selected = itemMission;
1559 }
1560 }
1561 } while (_findnext(h, &info) == 0);
1562 _findclose(h);
1563 }
1564 itemWorld->SortChildren();
1565 }
1566 }
1567
1568 _finddata_t info;
1569 intptr_t h = _findfirst("Campaigns\\*.*", &info);
1570 if (h != -1)
1571 {
1572 do
1573 {
1574 if ((info.attrib & _A_SUBDIR) != 0 && info.name[0] != '.')
1575 {
1576 RString campaign = info.name;
1577 CTreeItem* itemCampaign = root->AddChild();
1578 ParamFile cfg;
1579 cfg.Parse(GetCampaignDirectory(campaign) + RString("description.ext"));
1580 itemCampaign->text = cfg >> "Campaign" >> "name";
1581 itemCampaign->data = campaign;
1582 // int m = (Pars>>"CfgWorlds">>"worlds").GetSize();
1583 int m = (Pars >> "CfgWorldList").GetEntryCount();
1584 for (int j = 0; j < m; j++)
1585 {
1586 const ParamEntry& entry = (Pars >> "CfgWorldList").GetEntry(j);

Callers

nothing calls this directly

Calls 15

GetCtrlFunction · 0.85
LocalizeStringFunction · 0.85
GetWorldNameFunction · 0.85
_findfirstFunction · 0.85
_findnextFunction · 0.85
_findcloseFunction · 0.85
GetCampaignDirectoryFunction · 0.85
GetRootMethod · 0.80
AddChildMethod · 0.80
SortChildrenMethod · 0.80
SetSelectedMethod · 0.80
ExpandMethod · 0.80

Tested by

no test coverage detected