Fixed wrong fortress gen + updated build system

This commit is contained in:
Cubitect 2021-06-09 20:21:10 +02:00
parent 34f9da0db6
commit f0aecaaab4
11 changed files with 50 additions and 62 deletions

@ -1 +1 @@
Subproject commit 963d09c85ee4ee17b96d2c687d1d17bfd50df00e
Subproject commit 6fda1caff80f7e350e0f9bf8e770199d7ea9ccb2

View File

@ -6,33 +6,30 @@
# For a release with binary compatibility, cubiomes should be compiled for the
# default achitecture.
QT += core widgets
LIBS += -lm $$PWD/cubiomes/libcubiomes.a
QMAKE_CFLAGS = -fwrapv
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -std=gnu++11
CUPATH = $$PWD/cubiomes
QT += core widgets
LIBS += -lm $$CUPATH/libcubiomes.a
# comment out to use the profile compiler
#QMAKE_CC = clang
#QMAKE_CXX = clang++
QMAKE_CFLAGS = -fwrapv -DSTRUCT_CONFIG_OVERRIDE=1
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -std=gnu++11
QMAKE_CXXFLAGS_RELEASE *= -O3
win32: {
LIBS += -static -static-libgcc -static-libstdc++
}
# also compile cubiomes
QMAKE_PRE_LINK += $(MAKE) -C $$CUPATH -f $$CUPATH/makefile CFLAGS="-DSTRUCT_CONFIG_OVERRIDE=1" clean all
TARGET = cubiomes-viewer
#TEMPLATE = app
CONFIG += static
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
#DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
src/aboutdialog.cpp \
@ -54,11 +51,11 @@ SOURCES += \
src/main.cpp
HEADERS += \
cubiomes/finders.h \
cubiomes/generator.h \
cubiomes/javarnd.h \
cubiomes/layers.h \
cubiomes/util.h \
$$CUPATH/finders.h \
$$CUPATH/generator.h \
$$CUPATH/javarnd.h \
$$CUPATH/layers.h \
$$CUPATH/util.h \
src/aboutdialog.h \
src/collapsible.h \
src/configdialog.h \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 B

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 B

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 184 B

View File

@ -79,7 +79,7 @@ int FormConditions::getIndex(int idx) const
const QVector<Condition> condvec = getConditions();
int cnt[100] = {};
for (const Condition& c : condvec)
if (c.save > 0 || c.save < 100)
if (c.save > 0 && c.save < 100)
cnt[c.save]++;
else return 0;
if (idx <= 0)

View File

@ -25,6 +25,14 @@
#include <QDateTime>
#include <QStandardPaths>
extern "C"
int getStructureConfig_override(int stype, int mc, StructureConfig *sconf)
{
int ok = getStructureConfig(stype, mc, sconf);
// TODO: add and apply config settings
return ok;
}
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
@ -798,7 +806,7 @@ void MainWindow::on_buttonAnalysis_clicked()
st.clear();
int stype = mapopt2stype(sopt);
StructureConfig sconf;
if (!getConfig(stype, mc, &sconf))
if (!getStructureConfig_override(stype, mc, &sconf))
continue;
getStructs(&st, sconf, mc, seed, x1, z1, x2, z2);
if (st.empty())

View File

@ -41,16 +41,7 @@ QSplitter::handle:vertical {
</property>
<widget class="QFrame" name="controlFrame">
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>0</number>
</property>
<item>
@ -178,16 +169,7 @@ QSplitter::handle:vertical {
<string>Search</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
@ -215,8 +197,8 @@ QSplitter::handle:vertical {
<rect>
<x>0</x>
<y>0</y>
<width>1227</width>
<height>697</height>
<width>1228</width>
<height>699</height>
</rect>
</property>
<property name="sizePolicy">
@ -509,16 +491,7 @@ QSplitter::handle:vertical {
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
@ -557,6 +530,12 @@ QToolButton:checked {
<property name="allowedAreas">
<set>Qt::AllToolBarAreas</set>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="floatable">
<bool>true</bool>
</property>
@ -573,7 +552,7 @@ QToolButton:checked {
<x>0</x>
<y>0</y>
<width>1280</width>
<height>22</height>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="menuMap">

View File

@ -136,7 +136,7 @@ void Quad::run()
int z0 = tj*blocks, z1 = (tj+1)*blocks;
std::vector<VarPos>* st = new std::vector<VarPos>();
StructureConfig sconf;
if (getConfig(structureType, mc, &sconf))
if (getStructureConfig_override(structureType, mc, &sconf))
getStructs(st, sconf, mc, seed, x0, z0, x1, z1);
spos = st;
}

View File

@ -86,7 +86,9 @@ void QuadListDialog::refresh()
LayerStack g;
setupGenerator(&g, mc);
StructureConfig sconf = mc >= MC_1_13 ? SWAMP_HUT_CONFIG : SWAMP_HUT_CONFIG_112;
StructureConfig sconf;
getStructureConfig_override(Swamp_Hut, mc, &sconf);
const int maxq = 1000;
Pos *qlist = new Pos[maxq];
int r = 3e7 / 512;
@ -147,10 +149,12 @@ void QuadListDialog::refresh()
if (mc >= MC_1_8)
{
sconf = MONUMENT_CONFIG;
getStructureConfig_override(Monument, mc, &sconf);
// TODO: check salt delta
int64_t salt_delta = sconf.salt - MONUMENT_CONFIG.salt;
qcnt = scanForQuads(
sconf, 160, seed & MASK48,
g_qm_90, sizeof(g_qm_90) / sizeof(int64_t), 48, 0,
g_qm_90, sizeof(g_qm_90) / sizeof(int64_t), 48, salt_delta,
-r, -r, 2*r, 2*r, qlist, maxq);
if (qcnt >= maxq)

View File

@ -79,7 +79,7 @@ int testCond(StructPos *spos, int64_t seed, const Condition *cond, int mc, Layer
if (finfo.stype > 0)
{
if (!getConfig(finfo.stype, mc, &sconf))
if (!getStructureConfig_override(finfo.stype, mc, &sconf))
return 0;
}