MCPcopy Create free account
hub / github.com/Cubitect/cubiomes-viewer / runStructs

Method runStructs

src/tabstructures.cpp:49–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49void AnalysisStructures::runStructs(Generator *g)
50{
51 QTreeWidgetItem *seeditem = new TreeIntItem();
52 seeditem->setText(0, QString::asprintf("%" PRId64, wi.seed));
53 seeditem->setData(0, Qt::UserRole+0, QVariant::fromValue(wi.seed));
54 seeditem->setData(0, Qt::UserRole+1, QVariant::fromValue((int)DIM_UNDEF));
55
56 std::vector<VarPos> st;
57 for (int sopt = D_DESERT; sopt < D_SPAWN; sopt++)
58 {
59 if (stop)
60 break;
61 if (!mapshow[sopt])
62 continue;
63
64 int stype = mapopt2stype(sopt);
65 st.clear();
66 StructureConfig sconf;
67 if (!getStructureConfig_override(stype, wi.mc, &sconf))
68 continue;
69
70 if (dim != DIM_UNDEF && dim != sconf.dim)
71 continue;
72
73 getStructs(&st, sconf, wi, sconf.dim, area.x1, area.z1, area.x2, area.z2);
74 if (st.empty())
75 continue;
76
77 QTreeWidgetItem* stitem = new QTreeWidgetItem(seeditem);
78 stitem->setText(C_SEED, "-");
79 stitem->setText(C_STRUCT, struct2str(stype));
80 stitem->setData(C_COUNT, Qt::DisplayRole, QVariant::fromValue(st.size()));
81 if (!collect)
82 continue;
83
84 for (size_t i = 0; i < st.size(); i++)
85 {
86 VarPos vp = st[i];
87 QTreeWidgetItem* item = new QTreeWidgetItem(stitem);
88 item->setText(C_SEED, "-");
89 item->setData(C_X, Qt::DisplayRole, QVariant::fromValue(vp.p.x));
90 item->setData(C_Z, Qt::DisplayRole, QVariant::fromValue(vp.p.z));
91 item->setData(0, Qt::UserRole+0, QVariant::fromValue(wi.seed));
92 item->setData(0, Qt::UserRole+1, QVariant::fromValue(sconf.dim));
93 item->setData(0, Qt::UserRole+2, QVariant::fromValue(vp.p));
94 QStringList sinfo = vp.detail();
95 if (!sinfo.empty())
96 item->setText(C_DETAIL, sinfo.join(":"));
97 }
98 }
99
100 if (!stop && mapshow[D_SPAWN] && (dim == DIM_UNDEF || dim == DIM_OVERWORLD))
101 {
102 applySeed(g, 0, wi.seed);
103 Pos pos = getSpawn(g);
104 if (pos.x >= area.x1 && pos.x <= area.x2 && pos.z >= area.z1 && pos.z <= area.z2)
105 {
106 QTreeWidgetItem* item = new QTreeWidgetItem(seeditem);

Callers

nothing calls this directly

Calls 5

mapopt2stypeFunction · 0.85
getStructsFunction · 0.85
clearMethod · 0.80
detailMethod · 0.80

Tested by

no test coverage detected