summaryrefslogtreecommitdiffstats
path: root/Tools/QtBiomeVisualiser
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2024-11-02 22:27:47 +0100
committerAlexander Harkness <me@bearbin.net>2024-11-02 22:27:47 +0100
commitcb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a (patch)
treef647b20e1823f1846af88e832cf82a4a02e96e69 /Tools/QtBiomeVisualiser
parentImprove clang-format config file, remove automatically enforced code style from contrib guide. (diff)
downloadcuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar
cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.gz
cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.bz2
cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.lz
cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.xz
cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.zst
cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.zip
Diffstat (limited to 'Tools/QtBiomeVisualiser')
-rw-r--r--Tools/QtBiomeVisualiser/BiomeView.cpp341
-rw-r--r--Tools/QtBiomeVisualiser/BiomeView.h16
-rw-r--r--Tools/QtBiomeVisualiser/ChunkSource.cpp18
-rw-r--r--Tools/QtBiomeVisualiser/ChunkSource.h25
-rw-r--r--Tools/QtBiomeVisualiser/GeneratorSetup.cpp16
-rw-r--r--Tools/QtBiomeVisualiser/GeneratorSetup.h17
-rw-r--r--Tools/QtBiomeVisualiser/Globals.h267
-rw-r--r--Tools/QtBiomeVisualiser/MainWindow.cpp45
-rw-r--r--Tools/QtBiomeVisualiser/MainWindow.h15
-rw-r--r--Tools/QtBiomeVisualiser/QtBiomeVisualiser.cpp6
-rw-r--r--Tools/QtBiomeVisualiser/QtChunk.cpp4
-rw-r--r--Tools/QtBiomeVisualiser/QtChunk.h9
-rw-r--r--Tools/QtBiomeVisualiser/Region.cpp18
-rw-r--r--Tools/QtBiomeVisualiser/Region.h8
-rw-r--r--Tools/QtBiomeVisualiser/RegionCache.cpp4
-rw-r--r--Tools/QtBiomeVisualiser/RegionCache.h16
-rw-r--r--Tools/QtBiomeVisualiser/RegionLoader.cpp9
-rw-r--r--Tools/QtBiomeVisualiser/RegionLoader.h17
18 files changed, 488 insertions, 363 deletions
diff --git a/Tools/QtBiomeVisualiser/BiomeView.cpp b/Tools/QtBiomeVisualiser/BiomeView.cpp
index 472d1b5ad..8dd79d619 100644
--- a/Tools/QtBiomeVisualiser/BiomeView.cpp
+++ b/Tools/QtBiomeVisualiser/BiomeView.cpp
@@ -22,73 +22,255 @@ static struct
{
EMCSBiome m_Biome;
uchar m_Color[3];
-} biomeColors[] =
-{
- { biOcean, { 0x00, 0x00, 0x70 }, },
- { biPlains, { 0x8d, 0xb3, 0x60 }, },
- { biDesert, { 0xfa, 0x94, 0x18 }, },
- { biExtremeHills, { 0x60, 0x60, 0x60 }, },
- { biForest, { 0x05, 0x66, 0x21 }, },
- { biTaiga, { 0x0b, 0x66, 0x59 }, },
- { biSwampland, { 0x2f, 0xff, 0xda }, },
- { biRiver, { 0x30, 0x30, 0xaf }, },
- { biHell, { 0x7f, 0x00, 0x00 }, },
- { biSky, { 0x00, 0x7f, 0xff }, },
- { biFrozenOcean, { 0xa0, 0xa0, 0xdf }, },
- { biFrozenRiver, { 0xa0, 0xa0, 0xff }, },
- { biIcePlains, { 0xff, 0xff, 0xff }, },
- { biIceMountains, { 0xa0, 0xa0, 0xa0 }, },
- { biMushroomIsland, { 0xff, 0x00, 0xff }, },
- { biMushroomShore, { 0xa0, 0x00, 0xff }, },
- { biBeach, { 0xfa, 0xde, 0x55 }, },
- { biDesertHills, { 0xd2, 0x5f, 0x12 }, },
- { biForestHills, { 0x22, 0x55, 0x1c }, },
- { biTaigaHills, { 0x16, 0x39, 0x33 }, },
- { biExtremeHillsEdge, { 0x7f, 0x8f, 0x7f }, },
- { biJungle, { 0x53, 0x7b, 0x09 }, },
- { biJungleHills, { 0x2c, 0x42, 0x05 }, },
-
- { biJungleEdge, { 0x62, 0x8b, 0x17 }, },
- { biDeepOcean, { 0x00, 0x00, 0x30 }, },
- { biStoneBeach, { 0xa2, 0xa2, 0x84 }, },
- { biColdBeach, { 0xfa, 0xf0, 0xc0 }, },
- { biBirchForest, { 0x30, 0x74, 0x44 }, },
- { biBirchForestHills, { 0x1f, 0x5f, 0x32 }, },
- { biRoofedForest, { 0x40, 0x51, 0x1a }, },
- { biColdTaiga, { 0x31, 0x55, 0x4a }, },
- { biColdTaigaHills, { 0x59, 0x7d, 0x72 }, },
- { biMegaTaiga, { 0x59, 0x66, 0x51 }, },
- { biMegaTaigaHills, { 0x59, 0x66, 0x59 }, },
- { biExtremeHillsPlus, { 0x50, 0x70, 0x50 }, },
- { biSavanna, { 0xbd, 0xb2, 0x5f }, },
- { biSavannaPlateau, { 0xa7, 0x9d, 0x64 }, },
- { biMesa, { 0xd9, 0x45, 0x15 }, },
- { biMesaPlateauF, { 0xb0, 0x97, 0x65 }, },
- { biMesaPlateau, { 0xca, 0x8c, 0x65 }, },
+} biomeColors[] = {
+ {
+ biOcean,
+ {0x00, 0x00, 0x70},
+ },
+ {
+ biPlains,
+ {0x8d, 0xb3, 0x60},
+ },
+ {
+ biDesert,
+ {0xfa, 0x94, 0x18},
+ },
+ {
+ biExtremeHills,
+ {0x60, 0x60, 0x60},
+ },
+ {
+ biForest,
+ {0x05, 0x66, 0x21},
+ },
+ {
+ biTaiga,
+ {0x0b, 0x66, 0x59},
+ },
+ {
+ biSwampland,
+ {0x2f, 0xff, 0xda},
+ },
+ {
+ biRiver,
+ {0x30, 0x30, 0xaf},
+ },
+ {
+ biHell,
+ {0x7f, 0x00, 0x00},
+ },
+ {
+ biSky,
+ {0x00, 0x7f, 0xff},
+ },
+ {
+ biFrozenOcean,
+ {0xa0, 0xa0, 0xdf},
+ },
+ {
+ biFrozenRiver,
+ {0xa0, 0xa0, 0xff},
+ },
+ {
+ biIcePlains,
+ {0xff, 0xff, 0xff},
+ },
+ {
+ biIceMountains,
+ {0xa0, 0xa0, 0xa0},
+ },
+ {
+ biMushroomIsland,
+ {0xff, 0x00, 0xff},
+ },
+ {
+ biMushroomShore,
+ {0xa0, 0x00, 0xff},
+ },
+ {
+ biBeach,
+ {0xfa, 0xde, 0x55},
+ },
+ {
+ biDesertHills,
+ {0xd2, 0x5f, 0x12},
+ },
+ {
+ biForestHills,
+ {0x22, 0x55, 0x1c},
+ },
+ {
+ biTaigaHills,
+ {0x16, 0x39, 0x33},
+ },
+ {
+ biExtremeHillsEdge,
+ {0x7f, 0x8f, 0x7f},
+ },
+ {
+ biJungle,
+ {0x53, 0x7b, 0x09},
+ },
+ {
+ biJungleHills,
+ {0x2c, 0x42, 0x05},
+ },
+
+ {
+ biJungleEdge,
+ {0x62, 0x8b, 0x17},
+ },
+ {
+ biDeepOcean,
+ {0x00, 0x00, 0x30},
+ },
+ {
+ biStoneBeach,
+ {0xa2, 0xa2, 0x84},
+ },
+ {
+ biColdBeach,
+ {0xfa, 0xf0, 0xc0},
+ },
+ {
+ biBirchForest,
+ {0x30, 0x74, 0x44},
+ },
+ {
+ biBirchForestHills,
+ {0x1f, 0x5f, 0x32},
+ },
+ {
+ biRoofedForest,
+ {0x40, 0x51, 0x1a},
+ },
+ {
+ biColdTaiga,
+ {0x31, 0x55, 0x4a},
+ },
+ {
+ biColdTaigaHills,
+ {0x59, 0x7d, 0x72},
+ },
+ {
+ biMegaTaiga,
+ {0x59, 0x66, 0x51},
+ },
+ {
+ biMegaTaigaHills,
+ {0x59, 0x66, 0x59},
+ },
+ {
+ biExtremeHillsPlus,
+ {0x50, 0x70, 0x50},
+ },
+ {
+ biSavanna,
+ {0xbd, 0xb2, 0x5f},
+ },
+ {
+ biSavannaPlateau,
+ {0xa7, 0x9d, 0x64},
+ },
+ {
+ biMesa,
+ {0xd9, 0x45, 0x15},
+ },
+ {
+ biMesaPlateauF,
+ {0xb0, 0x97, 0x65},
+ },
+ {
+ biMesaPlateau,
+ {0xca, 0x8c, 0x65},
+ },
// M variants:
- { biSunflowerPlains, { 0xb5, 0xdb, 0x88 }, },
- { biDesertM, { 0xff, 0xbc, 0x40 }, },
- { biExtremeHillsM, { 0x88, 0x88, 0x88 }, },
- { biFlowerForest, { 0x2d, 0x8e, 0x49 }, },
- { biTaigaM, { 0x33, 0x8e, 0x81 }, },
- { biSwamplandM, { 0x07, 0xf9, 0xb2 }, },
- { biIcePlainsSpikes, { 0xb4, 0xdc, 0xdc }, },
- { biJungleM, { 0x7b, 0xa3, 0x31 }, },
- { biJungleEdgeM, { 0x62, 0x8b, 0x17 }, },
- { biBirchForestM, { 0x58, 0x9c, 0x6c }, },
- { biBirchForestHillsM, { 0x47, 0x87, 0x5a }, },
- { biRoofedForestM, { 0x68, 0x79, 0x42 }, },
- { biColdTaigaM, { 0x24, 0x3f, 0x36 }, },
- { biMegaSpruceTaiga, { 0x45, 0x4f, 0x3e }, },
- { biMegaSpruceTaigaHills, { 0x45, 0x4f, 0x4e }, },
- { biExtremeHillsPlusM, { 0x78, 0x98, 0x78 }, },
- { biSavannaM, { 0xe5, 0xda, 0x87 }, },
- { biSavannaPlateauM, { 0xa7, 0x9d, 0x74 }, },
- { biMesaBryce, { 0xff, 0x6d, 0x3d }, },
- { biMesaPlateauFM, { 0xd8, 0xbf, 0x8d }, },
- { biMesaPlateauM, { 0xf2, 0xb4, 0x8d }, },
-} ;
+ {
+ biSunflowerPlains,
+ {0xb5, 0xdb, 0x88},
+ },
+ {
+ biDesertM,
+ {0xff, 0xbc, 0x40},
+ },
+ {
+ biExtremeHillsM,
+ {0x88, 0x88, 0x88},
+ },
+ {
+ biFlowerForest,
+ {0x2d, 0x8e, 0x49},
+ },
+ {
+ biTaigaM,
+ {0x33, 0x8e, 0x81},
+ },
+ {
+ biSwamplandM,
+ {0x07, 0xf9, 0xb2},
+ },
+ {
+ biIcePlainsSpikes,
+ {0xb4, 0xdc, 0xdc},
+ },
+ {
+ biJungleM,
+ {0x7b, 0xa3, 0x31},
+ },
+ {
+ biJungleEdgeM,
+ {0x62, 0x8b, 0x17},
+ },
+ {
+ biBirchForestM,
+ {0x58, 0x9c, 0x6c},
+ },
+ {
+ biBirchForestHillsM,
+ {0x47, 0x87, 0x5a},
+ },
+ {
+ biRoofedForestM,
+ {0x68, 0x79, 0x42},
+ },
+ {
+ biColdTaigaM,
+ {0x24, 0x3f, 0x36},
+ },
+ {
+ biMegaSpruceTaiga,
+ {0x45, 0x4f, 0x3e},
+ },
+ {
+ biMegaSpruceTaigaHills,
+ {0x45, 0x4f, 0x4e},
+ },
+ {
+ biExtremeHillsPlusM,
+ {0x78, 0x98, 0x78},
+ },
+ {
+ biSavannaM,
+ {0xe5, 0xda, 0x87},
+ },
+ {
+ biSavannaPlateauM,
+ {0xa7, 0x9d, 0x74},
+ },
+ {
+ biMesaBryce,
+ {0xff, 0x6d, 0x3d},
+ },
+ {
+ biMesaPlateauFM,
+ {0xd8, 0xbf, 0x8d},
+ },
+ {
+ biMesaPlateauM,
+ {0xf2, 0xb4, 0x8d},
+ },
+};
@@ -96,7 +278,7 @@ static struct
static class BiomeColorsInitializer
{
-public:
+ public:
BiomeColorsInitializer(void)
{
// Reset all colors to gray:
@@ -125,12 +307,7 @@ public:
// BiomeView:
BiomeView::BiomeView(QWidget * parent) :
- super(parent),
- m_X(0),
- m_Z(0),
- m_Zoom(1),
- m_IsMouseDragging(false),
- m_MouseWheelDelta(0)
+ super(parent), m_X(0), m_Z(0), m_Zoom(1), m_IsMouseDragging(false), m_MouseWheelDelta(0)
{
// Create the image used for undefined chunks:
int offset = 0;
@@ -227,7 +404,7 @@ void BiomeView::redraw()
int centerchunkx = floor(m_X / 16);
int centerchunkz = floor(m_Z / 16);
// and the center of the screen
- int centerx = m_Image.width() / 2;
+ int centerx = m_Image.width() / 2;
int centery = m_Image.height() / 2;
// and align for panning
centerx -= (m_X - centerchunkx * 16) * m_Zoom;
@@ -236,7 +413,7 @@ void BiomeView::redraw()
int startx = centerchunkx - centerx / chunksize - 1;
int startz = centerchunkz - centery / chunksize - 1;
// and the dimensions of the screen in blocks
- int blockswide = m_Image.width() / chunksize + 3;
+ int blockswide = m_Image.width() / chunksize + 3;
int blockstall = m_Image.height() / chunksize + 3;
for (int z = startz; z < startz + blockstall; z++)
@@ -302,7 +479,7 @@ void BiomeView::drawChunk(int a_ChunkX, int a_ChunkZ)
int centerchunkx = floor(m_X / 16);
int centerchunkz = floor(m_Z / 16);
// and the center chunk screen coordinates
- int centerx = m_Image.width() / 2;
+ int centerx = m_Image.width() / 2;
int centery = m_Image.height() / 2;
// which need to be shifted to account for panning inside that chunk
centerx -= (m_X - centerchunkx * 16) * m_Zoom;
@@ -360,23 +537,23 @@ void BiomeView::drawChunk(int a_ChunkX, int a_ChunkZ)
// Scale-blit the image:
for (int z = skipy; z < blockheight; z++, imgoffset += imgstride)
{
- size_t srcoffset = static_cast<size_t>(std::floor((double)z / m_Zoom)) * 16;
+ size_t srcoffset = static_cast<size_t>(std::floor((double) z / m_Zoom)) * 16;
int imgxoffset = imgoffset;
for (int x = skipx; x < blockwidth; x++)
{
- short biome = src[srcoffset + static_cast<size_t>(std::floor((double)x / m_Zoom))];
+ short biome = src[srcoffset + static_cast<size_t>(std::floor((double) x / m_Zoom))];
const uchar * color;
if (biome < 0)
{
- static const uchar emptyBiome1[] = { 0x44, 0x44, 0x44, 0xff };
- static const uchar emptyBiome2[] = { 0x88, 0x88, 0x88, 0xff };
+ static const uchar emptyBiome1[] = {0x44, 0x44, 0x44, 0xff};
+ static const uchar emptyBiome2[] = {0x88, 0x88, 0x88, 0xff};
color = ((x & 8) ^ (z & 8)) ? emptyBiome1 : emptyBiome2;
}
else
{
if (biome * 4 >= ARRAYCOUNT(biomeToColor))
{
- static const uchar errorImage[] = { 0xff, 0x00, 0x00, 0xff };
+ static const uchar errorImage[] = {0xff, 0x00, 0x00, 0xff};
color = errorImage;
}
else
@@ -384,7 +561,7 @@ void BiomeView::drawChunk(int a_ChunkX, int a_ChunkZ)
color = biomeToColor + biome * 4;
}
}
- bits[imgxoffset] = color[0];
+ bits[imgxoffset] = color[0];
bits[imgxoffset + 1] = color[1];
bits[imgxoffset + 2] = color[2];
bits[imgxoffset + 3] = color[3];
@@ -456,7 +633,7 @@ void BiomeView::mouseMoveEvent(QMouseEvent * a_Event)
}
// Update the status bar info text:
- int blockX = floor((a_Event->x() - width() / 2) / m_Zoom + m_X);
+ int blockX = floor((a_Event->x() - width() / 2) / m_Zoom + m_X);
int blockZ = floor((a_Event->y() - height() / 2) / m_Zoom + m_Z);
int regionX, regionZ;
Region::blockToRegion(blockX, blockZ, regionX, regionZ);
diff --git a/Tools/QtBiomeVisualiser/BiomeView.h b/Tools/QtBiomeVisualiser/BiomeView.h
index cd9c7ead9..4d8b3d528 100644
--- a/Tools/QtBiomeVisualiser/BiomeView.h
+++ b/Tools/QtBiomeVisualiser/BiomeView.h
@@ -9,13 +9,12 @@
-class BiomeView :
- public QWidget
+class BiomeView : public QWidget
{
typedef QWidget super;
Q_OBJECT
-public:
+ public:
explicit BiomeView(QWidget * parent = NULL);
QSize minimumSizeHint() const;
@@ -31,7 +30,7 @@ public:
/** Sets the zoom level to the specified value and redraws the view. */
void setZoomLevel(double a_ZoomLevel);
-signals:
+ signals:
/** Signalled when the user uses the wheel to scroll upwards. */
void wheelUp();
@@ -47,7 +46,7 @@ signals:
/** Emitted when the user moves the mouse, to reflect the current block under the cursor. */
void hoverChanged(int a_BlockX, int a_BlockZ, int a_Biome);
-public slots:
+ public slots:
/** Redraw the entire widget area. */
void redraw();
@@ -57,7 +56,7 @@ public slots:
/** Reloads the current chunk source and redraws the entire workspace. */
void reload();
-protected:
+ protected:
double m_X, m_Z;
double m_Zoom;
@@ -110,8 +109,3 @@ protected:
/** Called when the user presses a key. */
virtual void keyPressEvent(QKeyEvent * a_Event) override;
};
-
-
-
-
-
diff --git a/Tools/QtBiomeVisualiser/ChunkSource.cpp b/Tools/QtBiomeVisualiser/ChunkSource.cpp
index ea3346f04..6b622b2bc 100644
--- a/Tools/QtBiomeVisualiser/ChunkSource.cpp
+++ b/Tools/QtBiomeVisualiser/ChunkSource.cpp
@@ -14,8 +14,7 @@
// BioGenSource:
BioGenSource::BioGenSource(cIniFilePtr a_IniFile) :
- m_IniFile(a_IniFile),
- m_Mtx(QMutex::Recursive)
+ m_IniFile(a_IniFile), m_Mtx(QMutex::Recursive)
{
reload();
}
@@ -98,7 +97,7 @@ void BioGenSource::releaseBiomeGen(cBiomeGenPtr && a_BiomeGen, int a_Tag)
class AnvilSource::AnvilFile
{
-public:
+ public:
/** Coordinates of the region file. */
int m_RegionX, m_RegionZ;
@@ -109,9 +108,7 @@ public:
/** Creates a new instance with the specified region coords. Reads the file header. */
AnvilFile(int a_RegionX, int a_RegionZ, const AString & a_WorldPath) :
- m_RegionX(a_RegionX),
- m_RegionZ(a_RegionZ),
- m_IsValid(false)
+ m_RegionX(a_RegionX), m_RegionZ(a_RegionZ), m_IsValid(false)
{
readFile(Printf("%s/r.%d.%d.mca", a_WorldPath.c_str(), a_RegionX, a_RegionZ));
}
@@ -162,7 +159,7 @@ public:
return m_FileData.substr(chunkOffset * 4096 + 5, chunkSize);
}
-protected:
+ protected:
AString m_FileData;
UInt32 m_Header[2048];
@@ -241,7 +238,7 @@ void AnvilSource::getChunkBiomes(int a_ChunkX, int a_ChunkZ, Chunk & a_DestChunk
const char * beBiomes = nbt.GetData(mcsBiomes);
for (size_t i = 0; i < ARRAYCOUNT(biomeMap); i++)
{
- biomeMap[i] = (EMCSBiome)GetBEInt(beBiomes + 4 * i);
+ biomeMap[i] = (EMCSBiome) GetBEInt(beBiomes + 4 * i);
}
a_DestChunk.setBiomes(biomeMap);
return;
@@ -320,8 +317,3 @@ AnvilSource::AnvilFilePtr AnvilSource::getAnvilFile(int a_ChunkX, int a_ChunkZ)
m_Files.push_front(file);
return file;
}
-
-
-
-
-
diff --git a/Tools/QtBiomeVisualiser/ChunkSource.h b/Tools/QtBiomeVisualiser/ChunkSource.h
index 62f9b5626..62e3f87b9 100644
--- a/Tools/QtBiomeVisualiser/ChunkSource.h
+++ b/Tools/QtBiomeVisualiser/ChunkSource.h
@@ -21,14 +21,15 @@ typedef std::shared_ptr<cIniFile> cIniFilePtr;
/** Abstract interface for getting biome data for chunks. */
class ChunkSource
{
-public:
+ public:
virtual ~ChunkSource() {}
/** Fills the a_DestChunk with the biomes for the specified coords.
It is expected to be thread-safe and re-entrant. Usually QThread::idealThreadCount() threads are used. */
virtual void getChunkBiomes(int a_ChunkX, int a_ChunkZ, Chunk & a_DestChunk) = 0;
- /** Forces a fresh reload of the source. Useful mainly for the generator, whose underlying definition file may have been changed. */
+ /** Forces a fresh reload of the source. Useful mainly for the generator, whose underlying definition file may have
+ * been changed. */
virtual void reload() = 0;
};
@@ -36,11 +37,9 @@ public:
-
-class BioGenSource :
- public ChunkSource
+class BioGenSource : public ChunkSource
{
-public:
+ public:
/** Constructs a new BioGenSource based on the biome generator that is defined in the specified world.ini file. */
BioGenSource(cIniFilePtr a_IniFile);
@@ -48,7 +47,7 @@ public:
virtual void getChunkBiomes(int a_ChunkX, int a_ChunkZ, Chunk & a_DestChunk) override;
virtual void reload(void) override;
-protected:
+ protected:
/** The world.ini contents from which the generator is created and re-created on reload(). */
cIniFilePtr m_IniFile;
@@ -82,10 +81,9 @@ protected:
-class AnvilSource :
- public ChunkSource
+class AnvilSource : public ChunkSource
{
-public:
+ public:
/** Constructs a new AnvilSource based on the world path. */
AnvilSource(QString a_WorldRegionFolder);
@@ -93,7 +91,7 @@ public:
virtual void getChunkBiomes(int a_ChunkX, int a_ChunkZ, Chunk & a_DestChunk) override;
virtual void reload() override;
-protected:
+ protected:
class AnvilFile;
typedef std::shared_ptr<AnvilFile> AnvilFilePtr;
@@ -119,9 +117,4 @@ protected:
/** Returns the file object that contains the specified chunk.
The file is taken from the cache if available there, otherwise it is created anew. */
AnvilFilePtr getAnvilFile(int a_ChunkX, int a_ChunkZ);
-
};
-
-
-
-
diff --git a/Tools/QtBiomeVisualiser/GeneratorSetup.cpp b/Tools/QtBiomeVisualiser/GeneratorSetup.cpp
index 54b7ef36e..bdee0bb50 100644
--- a/Tools/QtBiomeVisualiser/GeneratorSetup.cpp
+++ b/Tools/QtBiomeVisualiser/GeneratorSetup.cpp
@@ -9,8 +9,7 @@
-static const QString s_GeneratorNames[] =
-{
+static const QString s_GeneratorNames[] = {
QString("Checkerboard"),
QString("Constant"),
QString("DistortedVoronoi"),
@@ -26,8 +25,7 @@ static const QString s_GeneratorNames[] =
GeneratorSetup::GeneratorSetup(const AString & a_IniFileName, QWidget * a_Parent) :
- super(a_Parent),
- m_IniFile(new cIniFile())
+ super(a_Parent), m_IniFile(new cIniFile())
{
// The seed and generator name is in a separate form layout at the top, always present:
m_eSeed = new QLineEdit();
@@ -67,7 +65,7 @@ GeneratorSetup::GeneratorSetup(const AString & a_IniFileName, QWidget * a_Parent
// Connect the change events only after the data has been loaded:
connect(m_cbGenerator, SIGNAL(currentIndexChanged(QString)), this, SLOT(generatorChanged(QString)));
- connect(m_eSeed, SIGNAL(textChanged(QString)), this, SLOT(editChanged(QString)));
+ connect(m_eSeed, SIGNAL(textChanged(QString)), this, SLOT(editChanged(QString)));
}
@@ -109,7 +107,7 @@ void GeneratorSetup::generatorChanged(const QString & a_NewName)
void GeneratorSetup::editChanged(const QString & a_NewValue)
{
QString sectionName = sender()->property("INI.SectionName").toString();
- QString itemName = sender()->property("INI.ItemName").toString();
+ QString itemName = sender()->property("INI.ItemName").toString();
m_IniFile->SetValue(sectionName.toStdString(), itemName.toStdString(), a_NewValue.toStdString());
emit generatorUpdated();
}
@@ -139,7 +137,7 @@ void GeneratorSetup::updateFromIni()
int numItems = m_IniFile->GetNumValues(keyID);
for (int i = 0; i < numItems; i++)
{
- AString itemName = m_IniFile->GetValueName(keyID, i);
+ AString itemName = m_IniFile->GetValueName(keyID, i);
if ((itemName == "Generator") || (itemName == "BiomeGen"))
{
// These special cases are not to be added
@@ -162,7 +160,3 @@ void GeneratorSetup::updateFromIni()
m_FormLayout->addRow(new QLabel(QString::fromStdString(itemName)), edit);
} // for i - INI values[]
}
-
-
-
-
diff --git a/Tools/QtBiomeVisualiser/GeneratorSetup.h b/Tools/QtBiomeVisualiser/GeneratorSetup.h
index e72d3abbc..168ee3758 100644
--- a/Tools/QtBiomeVisualiser/GeneratorSetup.h
+++ b/Tools/QtBiomeVisualiser/GeneratorSetup.h
@@ -17,34 +17,33 @@ typedef std::shared_ptr<cIniFile> cIniFilePtr;
-class GeneratorSetup :
- public QWidget
+class GeneratorSetup : public QWidget
{
typedef QWidget super;
Q_OBJECT
-public:
+ public:
/** Creates the widget and loads the contents of the INI file, if not empty. */
explicit GeneratorSetup(const std::string & a_IniFileName, QWidget * parent = nullptr);
/** Returns the cIniFile instance that is being edited by this widget. */
cIniFilePtr getIniFile() { return m_IniFile; }
-signals:
+ signals:
/** Emitted when the generator parameters have changed. */
void generatorUpdated();
-public slots:
+ public slots:
/** Called when the user selects a different generator from the top combobox.
Re-creates m_IniFile and updates the form layout. */
void generatorChanged(const QString & a_NewName);
-protected slots:
+ protected slots:
/** Called when any of the edit widgets are changed. */
void editChanged(const QString & a_NewValue);
-protected:
+ protected:
QComboBox * m_cbGenerator;
QLineEdit * m_eSeed;
QVBoxLayout * m_MainLayout;
@@ -58,7 +57,3 @@ protected:
/** Updates the form layout with the values from m_IniFile. */
void updateFromIni();
};
-
-
-
-
diff --git a/Tools/QtBiomeVisualiser/Globals.h b/Tools/QtBiomeVisualiser/Globals.h
index fe037c2ad..52182c3b6 100644
--- a/Tools/QtBiomeVisualiser/Globals.h
+++ b/Tools/QtBiomeVisualiser/Globals.h
@@ -6,44 +6,45 @@
// Compiler-dependent stuff:
#if defined(_MSC_VER)
- // MSVC produces warning C4481 on the override keyword usage, so disable the warning altogether
- #pragma warning(disable:4481)
+// MSVC produces warning C4481 on the override keyword usage, so disable the warning altogether
+#pragma warning(disable : 4481)
- // Disable some warnings that we don't care about:
- #pragma warning(disable:4100) // Unreferenced formal parameter
+// Disable some warnings that we don't care about:
+#pragma warning(disable : 4100) // Unreferenced formal parameter
- // Useful warnings from warning level 4:
- #pragma warning(3 : 4127) // Conditional expression is constant
- #pragma warning(3 : 4189) // Local variable is initialized but not referenced
- #pragma warning(3 : 4245) // Conversion from 'type1' to 'type2', signed / unsigned mismatch
- #pragma warning(3 : 4310) // Cast truncates constant value
- #pragma warning(3 : 4389) // Signed / unsigned mismatch
- #pragma warning(3 : 4505) // Unreferenced local function has been removed
- #pragma warning(3 : 4701) // Potentially unitialized local variable used
- #pragma warning(3 : 4702) // Unreachable code
- #pragma warning(3 : 4706) // Assignment within conditional expression
+// Useful warnings from warning level 4:
+#pragma warning(3 : 4127) // Conditional expression is constant
+#pragma warning(3 : 4189) // Local variable is initialized but not referenced
+#pragma warning(3 : 4245) // Conversion from 'type1' to 'type2', signed / unsigned mismatch
+#pragma warning(3 : 4310) // Cast truncates constant value
+#pragma warning(3 : 4389) // Signed / unsigned mismatch
+#pragma warning(3 : 4505) // Unreferenced local function has been removed
+#pragma warning(3 : 4701) // Potentially unitialized local variable used
+#pragma warning(3 : 4702) // Unreachable code
+#pragma warning(3 : 4706) // Assignment within conditional expression
- // Disabling this warning, because we know what we're doing when we're doing this:
- #pragma warning(disable: 4355) // 'this' used in initializer list
+// Disabling this warning, because we know what we're doing when we're doing this:
+#pragma warning(disable : 4355) // 'this' used in initializer list
- // Disabled because it's useless:
- #pragma warning(disable: 4512) // 'class': assignment operator could not be generated - reported for each class that has a reference-type member
+// Disabled because it's useless:
+#pragma warning(disable : 4512 \
+) // 'class': assignment operator could not be generated - reported for each class that has a reference-type member
- // 2014_01_06 xoft: Disabled this warning because MSVC is stupid and reports it in obviously wrong places
- // #pragma warning(3 : 4244) // Conversion from 'type1' to 'type2', possible loss of data
+// 2014_01_06 xoft: Disabled this warning because MSVC is stupid and reports it in obviously wrong places
+// #pragma warning(3 : 4244) // Conversion from 'type1' to 'type2', possible loss of data
- #define FORMATSTRING(formatIndex, va_argsIndex)
+#define FORMATSTRING(formatIndex, va_argsIndex)
#elif defined(__GNUC__)
- // TODO: Can GCC explicitly mark classes as abstract (no instances can be created)?
- #define abstract
+// TODO: Can GCC explicitly mark classes as abstract (no instances can be created)?
+#define abstract
- #define FORMATSTRING(formatIndex, va_argsIndex) __attribute__((format (printf, formatIndex, va_argsIndex)))
+#define FORMATSTRING(formatIndex, va_argsIndex) __attribute__((format(printf, formatIndex, va_argsIndex)))
#else
- #error "You are using an unsupported compiler, you might need to #define some stuff here for your compiler"
+#error "You are using an unsupported compiler, you might need to #define some stuff here for your compiler"
#endif
@@ -53,22 +54,20 @@
// Integral types with predefined sizes:
typedef long long Int64;
-typedef int Int32;
-typedef short Int16;
+typedef int Int32;
+typedef short Int16;
typedef unsigned long long UInt64;
-typedef unsigned int UInt32;
-typedef unsigned short UInt16;
+typedef unsigned int UInt32;
+typedef unsigned short UInt16;
typedef unsigned char Byte;
// If you get an error about specialization check the size of integral types
-template <typename T, size_t Size, bool x = sizeof(T) == Size>
-class SizeChecker;
+template <typename T, size_t Size, bool x = sizeof(T) == Size> class SizeChecker;
-template <typename T, size_t Size>
-class SizeChecker<T, Size, true>
+template <typename T, size_t Size> class SizeChecker<T, Size, true>
{
T v;
};
@@ -84,19 +83,19 @@ template class SizeChecker<UInt16, 2>;
// A macro to disallow the copy constructor and operator = functions
// This should be used in the private: declarations for any class that shouldn't allow copying itself
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
- TypeName(const TypeName &); \
- void operator =(const TypeName &)
+ TypeName(const TypeName &); \
+ void operator=(const TypeName &)
// A macro that is used to mark unused local variables, to avoid pedantic warnings in gcc / clang / MSVC
// Note that in MSVC it requires the full type of X to be known
-#define UNUSED_VAR(X) (void)(X)
+#define UNUSED_VAR(X) (void) (X)
// A macro that is used to mark unused function parameters, to avoid pedantic warnings in gcc
// Written so that the full type of param needn't be known
#ifdef _MSC_VER
- #define UNUSED(X)
+#define UNUSED(X)
#else
- #define UNUSED UNUSED_VAR
+#define UNUSED UNUSED_VAR
#endif
@@ -104,38 +103,40 @@ template class SizeChecker<UInt16, 2>;
// OS-dependent stuff:
#ifdef _WIN32
- #define WIN32_LEAN_AND_MEAN
- #define _WIN32_WINNT _WIN32_WINNT_WS03 // We want to target Windows XP with Service Pack 2 & Windows Server 2003 with Service Pack 1 and higher
-
- #include <Windows.h>
- #include <winsock2.h>
- #include <Ws2tcpip.h> // IPv6 stuff
-
- // Windows SDK defines min and max macros, messing up with our std::min and std::max usage
- #undef min
- #undef max
-
- // Windows SDK defines GetFreeSpace as a constant, probably a Win16 API remnant
- #ifdef GetFreeSpace
- #undef GetFreeSpace
- #endif // GetFreeSpace
+#define WIN32_LEAN_AND_MEAN
+#define _WIN32_WINNT \
+ _WIN32_WINNT_WS03 // We want to target Windows XP with Service Pack 2 & Windows Server 2003 with Service Pack 1 and
+ // higher
+
+#include <Windows.h>
+#include <winsock2.h>
+#include <Ws2tcpip.h> // IPv6 stuff
+
+// Windows SDK defines min and max macros, messing up with our std::min and std::max usage
+#undef min
+#undef max
+
+// Windows SDK defines GetFreeSpace as a constant, probably a Win16 API remnant
+#ifdef GetFreeSpace
+#undef GetFreeSpace
+#endif // GetFreeSpace
#else
- #include <sys/types.h>
- #include <sys/time.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
- #include <netdb.h>
- #include <time.h>
- #include <dirent.h>
- #include <errno.h>
- #include <iostream>
- #include <cstdio>
- #include <cstring>
- #include <pthread.h>
- #include <semaphore.h>
- #include <errno.h>
- #include <fcntl.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <time.h>
+#include <dirent.h>
+#include <errno.h>
+#include <iostream>
+#include <cstdio>
+#include <cstring>
+#include <pthread.h>
+#include <semaphore.h>
+#include <errno.h>
+#include <fcntl.h>
#endif
@@ -168,15 +169,15 @@ template class SizeChecker<UInt16, 2>;
#ifndef TEST_GLOBALS
- // Common headers (part 1, without macros):
- #include "src/StringUtils.h"
- #include "src/OSSupport/CriticalSection.h"
- #include "src/OSSupport/Semaphore.h"
- #include "src/OSSupport/Event.h"
- #include "src/OSSupport/File.h"
- #include "src/Logger.h"
+// Common headers (part 1, without macros):
+#include "src/StringUtils.h"
+#include "src/OSSupport/CriticalSection.h"
+#include "src/OSSupport/Semaphore.h"
+#include "src/OSSupport/Event.h"
+#include "src/OSSupport/File.h"
+#include "src/Logger.h"
#else
- // Logging functions
+// Logging functions
void inline LOGERROR(const char * a_Format, ...) FORMATSTRING(1, 2);
void inline LOGERROR(const char * a_Format, ...)
@@ -199,55 +200,86 @@ void inline LOGERROR(const char * a_Format, ...)
/** Allows arithmetic expressions like "32 KiB" (but consider using parenthesis
around it, "(32 KiB)") */
-#define KiB * 1024
-#define MiB * 1024 * 1024
+#define KiB *1024
+#define MiB *1024 * 1024
/** Faster than (int)floorf((float)x / (float)div) */
-#define FAST_FLOOR_DIV( x, div) (((x) - (((x) < 0) ? ((div) - 1) : 0)) / (div))
+#define FAST_FLOOR_DIV(x, div) (((x) - (((x) < 0) ? ((div) - 1) : 0)) / (div))
// Own version of assert() that writes failed assertions to the log for review
#ifdef TEST_GLOBALS
- class cAssertFailure
- {
- };
-
- #ifdef _WIN32
- #if (defined(_MSC_VER) && defined(_DEBUG))
- #define DBG_BREAK _CrtDbgBreak()
- #else
- #define DBG_BREAK
- #endif
- #define REPORT_ERROR(FMT, ...) \
- { \
- AString msg = Printf(FMT, __VA_ARGS__); \
- puts(msg.c_str()); \
- fflush(stdout); \
- OutputDebugStringA(msg.c_str()); \
- DBG_BREAK; \
- }
- #else
- #define REPORT_ERROR(FMT, ...) \
- { \
- AString msg = Printf(FMT, __VA_ARGS__); \
- puts(msg.c_str()); \
- fflush(stdout); \
- }
- #endif
- #define ASSERT(x) do { if (!(x)) { throw cAssertFailure();} } while (0)
- #define testassert(x) do { if (!(x)) { REPORT_ERROR("Test failure: %s, file %s, line %d\n", #x, __FILE__, __LINE__); exit(1); } } while (0)
- #define CheckAsserts(x) do { try {x} catch (cAssertFailure) { break; } REPORT_ERROR("Test failure: assert didn't fire for %s, file %s, line %d\n", #x, __FILE__, __LINE__); exit(1); } while (0)
+class cAssertFailure
+{
+};
+#ifdef _WIN32
+#if (defined(_MSC_VER) && defined(_DEBUG))
+#define DBG_BREAK _CrtDbgBreak()
#else
- #ifdef _DEBUG
- #define ASSERT( x) ( !!(x) || ( LOGERROR("Assertion failed: %s, file %s, line %i", #x, __FILE__, __LINE__), assert(0), 0))
- #else
- #define ASSERT(x) ((void)(x))
- #endif
+#define DBG_BREAK
+#endif
+#define REPORT_ERROR(FMT, ...) \
+ { \
+ AString msg = Printf(FMT, __VA_ARGS__); \
+ puts(msg.c_str()); \
+ fflush(stdout); \
+ OutputDebugStringA(msg.c_str()); \
+ DBG_BREAK; \
+ }
+#else
+#define REPORT_ERROR(FMT, ...) \
+ { \
+ AString msg = Printf(FMT, __VA_ARGS__); \
+ puts(msg.c_str()); \
+ fflush(stdout); \
+ }
+#endif
+#define ASSERT(x) \
+ do \
+ { \
+ if (!(x)) \
+ { \
+ throw cAssertFailure(); \
+ } \
+ } \
+ while (0)
+#define testassert(x) \
+ do \
+ { \
+ if (!(x)) \
+ { \
+ REPORT_ERROR("Test failure: %s, file %s, line %d\n", #x, __FILE__, __LINE__); \
+ exit(1); \
+ } \
+ } \
+ while (0)
+#define CheckAsserts(x) \
+ do \
+ { \
+ try \
+ { \
+ x \
+ } \
+ catch (cAssertFailure) \
+ { \
+ break; \
+ } \
+ REPORT_ERROR("Test failure: assert didn't fire for %s, file %s, line %d\n", #x, __FILE__, __LINE__); \
+ exit(1); \
+ } \
+ while (0)
+
+#else
+#ifdef _DEBUG
+#define ASSERT(x) (!!(x) || (LOGERROR("Assertion failed: %s, file %s, line %i", #x, __FILE__, __LINE__), assert(0), 0))
+#else
+#define ASSERT(x) ((void) (x))
+#endif
#endif
// Pretty much the same as ASSERT() but stays in Release builds
-#define VERIFY( x) ( !!(x) || ( LOGERROR("Verification failed: %s, file %s, line %i", #x, __FILE__, __LINE__), exit(1), 0))
+#define VERIFY(x) (!!(x) || (LOGERROR("Verification failed: %s, file %s, line %i", #x, __FILE__, __LINE__), exit(1), 0))
// C++11 has std::shared_ptr in <memory>, included earlier
#define SharedPtr std::shared_ptr
@@ -256,8 +288,7 @@ around it, "(32 KiB)") */
/** Clamp X to the specified range. */
-template <typename T>
-T Clamp(T a_Value, T a_Min, T a_Max)
+template <typename T> T Clamp(T a_Value, T a_Min, T a_Max)
{
return (a_Value < a_Min) ? a_Min : ((a_Value > a_Max) ? a_Max : a_Value);
}
@@ -267,7 +298,7 @@ T Clamp(T a_Value, T a_Min, T a_Max)
#ifndef TOLUA_TEMPLATE_BIND
- #define TOLUA_TEMPLATE_BIND(x)
+#define TOLUA_TEMPLATE_BIND(x)
#endif
diff --git a/Tools/QtBiomeVisualiser/MainWindow.cpp b/Tools/QtBiomeVisualiser/MainWindow.cpp
index 8d5b768d8..6aa1b84a9 100644
--- a/Tools/QtBiomeVisualiser/MainWindow.cpp
+++ b/Tools/QtBiomeVisualiser/MainWindow.cpp
@@ -20,9 +20,17 @@
-const double MainWindow::m_ViewZooms[] =
-{
- 0.0625, 0.125, 0.25, 0.5, 1, 2, 4, 8, 16, 24,
+const double MainWindow::m_ViewZooms[] = {
+ 0.0625,
+ 0.125,
+ 0.25,
+ 0.5,
+ 1,
+ 2,
+ 4,
+ 8,
+ 16,
+ 24,
};
@@ -30,18 +38,15 @@ const double MainWindow::m_ViewZooms[] =
MainWindow::MainWindow(QWidget * parent) :
- QMainWindow(parent),
- m_GeneratorSetup(nullptr),
- m_LineSeparator(nullptr),
- m_CurrentZoomLevel(2)
+ QMainWindow(parent), m_GeneratorSetup(nullptr), m_LineSeparator(nullptr), m_CurrentZoomLevel(2)
{
initMinecraftPath();
m_BiomeView = new BiomeView();
connect(m_BiomeView, SIGNAL(increaseZoom()), this, SLOT(increaseZoom()));
connect(m_BiomeView, SIGNAL(decreaseZoom()), this, SLOT(decreaseZoom()));
- connect(m_BiomeView, SIGNAL(wheelUp()), this, SLOT(increaseZoom()));
- connect(m_BiomeView, SIGNAL(wheelDown()), this, SLOT(decreaseZoom()));
+ connect(m_BiomeView, SIGNAL(wheelUp()), this, SLOT(increaseZoom()));
+ connect(m_BiomeView, SIGNAL(wheelDown()), this, SLOT(decreaseZoom()));
m_BiomeView->setZoomLevel(m_ViewZooms[m_CurrentZoomLevel]);
m_StatusBar = new QStatusBar();
@@ -225,7 +230,7 @@ void MainWindow::hoverChanged(int a_BlockX, int a_BlockZ, int a_Biome)
{
m_StatusBlockX->setText(tr("X: %1").arg(a_BlockX));
m_StatusBlockZ->setText(tr("Z: %1").arg(a_BlockZ));
- m_StatusBiome->setText (tr("B: %1 (%2)").arg(BiomeToString(a_Biome).c_str()).arg(a_Biome));
+ m_StatusBiome->setText(tr("B: %1 (%2)").arg(BiomeToString(a_Biome).c_str()).arg(a_Biome));
}
@@ -234,14 +239,14 @@ void MainWindow::hoverChanged(int a_BlockX, int a_BlockZ, int a_Biome)
void MainWindow::initMinecraftPath()
{
- #ifdef Q_OS_MAC
- m_MinecraftPath = QDir::homePath() + QDir::toNativeSeparators("/Library/Application Support/minecraft");
- #elif defined Q_OS_WIN32
- QSettings ini(QSettings::IniFormat, QSettings::UserScope, ".minecraft", "minecraft1");
- m_MinecraftPath = QFileInfo(ini.fileName()).absolutePath();
- #else
- m_MinecraftPath = QDir::homePath() + QDir::toNativeSeparators("/.minecraft");
- #endif
+#ifdef Q_OS_MAC
+ m_MinecraftPath = QDir::homePath() + QDir::toNativeSeparators("/Library/Application Support/minecraft");
+#elif defined Q_OS_WIN32
+ QSettings ini(QSettings::IniFormat, QSettings::UserScope, ".minecraft", "minecraft1");
+ m_MinecraftPath = QFileInfo(ini.fileName()).absolutePath();
+#else
+ m_MinecraftPath = QDir::homePath() + QDir::toNativeSeparators("/.minecraft");
+#endif
}
@@ -434,7 +439,3 @@ void MainWindow::closeGeneratorSetup()
m_GeneratorSetup = nullptr;
m_LineSeparator = nullptr;
}
-
-
-
-
diff --git a/Tools/QtBiomeVisualiser/MainWindow.h b/Tools/QtBiomeVisualiser/MainWindow.h
index 27faae7a8..230e3ba38 100644
--- a/Tools/QtBiomeVisualiser/MainWindow.h
+++ b/Tools/QtBiomeVisualiser/MainWindow.h
@@ -18,16 +18,15 @@ class GeneratorSetup;
-class MainWindow :
- public QMainWindow
+class MainWindow : public QMainWindow
{
Q_OBJECT
-public:
+ public:
MainWindow(QWidget * parent = nullptr);
~MainWindow();
-private slots:
+ private slots:
/** Creates a generator definition from scratch, lets user modify generator params in realtime. */
void newGenerator();
@@ -55,7 +54,7 @@ private slots:
/** Updates the statusbar for the specified info about the current block under the cursor. */
void hoverChanged(int a_BlockX, int a_BlockZ, int a_Biome);
-protected:
+ protected:
/** The zoom levels */
static const double m_ViewZooms[10];
@@ -119,9 +118,3 @@ protected:
/** Closes and destroys the generator setup pane, if there is one. */
void closeGeneratorSetup();
};
-
-
-
-
-
-
diff --git a/Tools/QtBiomeVisualiser/QtBiomeVisualiser.cpp b/Tools/QtBiomeVisualiser/QtBiomeVisualiser.cpp
index f41cdcfb2..4f7fe73ff 100644
--- a/Tools/QtBiomeVisualiser/QtBiomeVisualiser.cpp
+++ b/Tools/QtBiomeVisualiser/QtBiomeVisualiser.cpp
@@ -6,7 +6,7 @@
-int main(int argc, char *argv[])
+int main(int argc, char * argv[])
{
QApplication a(argc, argv);
MainWindow w;
@@ -14,7 +14,3 @@ int main(int argc, char *argv[])
return a.exec();
}
-
-
-
-
diff --git a/Tools/QtBiomeVisualiser/QtChunk.cpp b/Tools/QtBiomeVisualiser/QtChunk.cpp
index f201ef220..c458452ab 100644
--- a/Tools/QtBiomeVisualiser/QtChunk.cpp
+++ b/Tools/QtBiomeVisualiser/QtChunk.cpp
@@ -35,7 +35,3 @@ EMCSBiome Chunk::getBiome(int a_RelX, int a_RelZ)
}
return static_cast<EMCSBiome>(m_Biomes[a_RelX + 16 * a_RelZ]);
}
-
-
-
-
diff --git a/Tools/QtBiomeVisualiser/QtChunk.h b/Tools/QtBiomeVisualiser/QtChunk.h
index d806d18bb..b43ab748f 100644
--- a/Tools/QtBiomeVisualiser/QtChunk.h
+++ b/Tools/QtBiomeVisualiser/QtChunk.h
@@ -8,7 +8,7 @@
class Chunk
{
-public:
+ public:
/** The type used for storing image data for a chunk. */
typedef uchar Image[16 * 16 * 4];
@@ -28,7 +28,7 @@ public:
/** Returns the raw biome data for this chunk. */
const short * getBiomes(void) const { return m_Biomes; }
-protected:
+ protected:
/** Flag that specifies if the chunk data is valid - loaded or generated. */
bool m_IsValid;
@@ -38,8 +38,3 @@ protected:
};
typedef std::shared_ptr<Chunk> ChunkPtr;
-
-
-
-
-
diff --git a/Tools/QtBiomeVisualiser/Region.cpp b/Tools/QtBiomeVisualiser/Region.cpp
index d8a0a2f76..b8fdc00db 100644
--- a/Tools/QtBiomeVisualiser/Region.cpp
+++ b/Tools/QtBiomeVisualiser/Region.cpp
@@ -6,9 +6,7 @@
-Region::Region()
-{
-}
+Region::Region() {}
@@ -16,12 +14,12 @@ Region::Region()
Chunk & Region::getRelChunk(int a_RelChunkX, int a_RelChunkZ)
{
- ASSERT(a_RelChunkX >= 0);
- ASSERT(a_RelChunkZ >= 0);
- ASSERT(a_RelChunkX < 32);
- ASSERT(a_RelChunkZ < 32);
+ ASSERT(a_RelChunkX >= 0);
+ ASSERT(a_RelChunkZ >= 0);
+ ASSERT(a_RelChunkX < 32);
+ ASSERT(a_RelChunkZ < 32);
- return m_Chunks[a_RelChunkX + a_RelChunkZ * 32];
+ return m_Chunks[a_RelChunkX + a_RelChunkZ * 32];
}
@@ -66,7 +64,3 @@ void Region::chunkToRegion(int a_ChunkX, int a_ChunkZ, int & a_RegionX, int & a_
a_RegionX = static_cast<int>(std::floor(static_cast<float>(a_ChunkX) / 32));
a_RegionZ = static_cast<int>(std::floor(static_cast<float>(a_ChunkZ) / 32));
}
-
-
-
-
diff --git a/Tools/QtBiomeVisualiser/Region.h b/Tools/QtBiomeVisualiser/Region.h
index 863c0ac02..1b3713aa7 100644
--- a/Tools/QtBiomeVisualiser/Region.h
+++ b/Tools/QtBiomeVisualiser/Region.h
@@ -8,7 +8,7 @@
class Region
{
-public:
+ public:
Region();
/** Retrieves the chunk with the specified relative coords. */
@@ -29,7 +29,7 @@ public:
/** Converts chunk coordinates into region coordinates. */
static void chunkToRegion(int a_ChunkX, int a_ChunkZ, int & a_RegionX, int & a_RegionZ);
-protected:
+ protected:
friend class RegionLoader;
@@ -40,7 +40,3 @@ protected:
be displayed. */
bool m_IsValid;
};
-
-
-
-
diff --git a/Tools/QtBiomeVisualiser/RegionCache.cpp b/Tools/QtBiomeVisualiser/RegionCache.cpp
index e46fd222a..f779bd42f 100644
--- a/Tools/QtBiomeVisualiser/RegionCache.cpp
+++ b/Tools/QtBiomeVisualiser/RegionCache.cpp
@@ -132,7 +132,3 @@ void RegionCache::queueRegionRender(int a_RegionX, int a_RegionZ, RegionPtr & a_
QThreadPool::globalInstance()->start(loader);
}
-
-
-
-
diff --git a/Tools/QtBiomeVisualiser/RegionCache.h b/Tools/QtBiomeVisualiser/RegionCache.h
index c343e4ba9..fb76b93f0 100644
--- a/Tools/QtBiomeVisualiser/RegionCache.h
+++ b/Tools/QtBiomeVisualiser/RegionCache.h
@@ -20,13 +20,12 @@ class ChunkSource;
/** Caches regions' chunk data for reuse */
-class RegionCache :
- public QObject
+class RegionCache : public QObject
{
typedef QObject super;
Q_OBJECT
-public:
+ public:
explicit RegionCache(QObject * parent = NULL);
/** Retrieves the specified region from the cache.
@@ -43,13 +42,13 @@ public:
/** Reloads the current chunk source. */
void reload();
-signals:
+ signals:
void regionAvailable(int a_RegionX, int a_RegionZ);
-protected slots:
+ protected slots:
void gotRegion(int a_RegionX, int a_RegionZ);
-protected:
+ protected:
/** The cache of the chunks */
QCache<quint32, RegionPtr> m_Cache;
@@ -66,8 +65,3 @@ protected:
/** Queues the specified region for rendering by m_RegionSource. */
void queueRegionRender(int a_RegionX, int a_RegionZ, RegionPtr & a_Region);
};
-
-
-
-
-
diff --git a/Tools/QtBiomeVisualiser/RegionLoader.cpp b/Tools/QtBiomeVisualiser/RegionLoader.cpp
index 2a318098b..6cd00487f 100644
--- a/Tools/QtBiomeVisualiser/RegionLoader.cpp
+++ b/Tools/QtBiomeVisualiser/RegionLoader.cpp
@@ -14,10 +14,7 @@ volatile bool RegionLoader::m_IsShuttingDown = false;
RegionLoader::RegionLoader(int a_RegionX, int a_RegionZ, RegionPtr a_Region, ChunkSourcePtr a_ChunkSource) :
- m_RegionX(a_RegionX),
- m_RegionZ(a_RegionZ),
- m_Region(a_Region),
- m_ChunkSource(a_ChunkSource)
+ m_RegionX(a_RegionX), m_RegionZ(a_RegionZ), m_Region(a_Region), m_ChunkSource(a_ChunkSource)
{
}
@@ -43,7 +40,3 @@ void RegionLoader::run()
emit loaded(m_RegionX, m_RegionZ);
}
-
-
-
-
diff --git a/Tools/QtBiomeVisualiser/RegionLoader.h b/Tools/QtBiomeVisualiser/RegionLoader.h
index 6bbb4aa60..935fbdcd9 100644
--- a/Tools/QtBiomeVisualiser/RegionLoader.h
+++ b/Tools/QtBiomeVisualiser/RegionLoader.h
@@ -18,26 +18,25 @@ typedef std::shared_ptr<ChunkSource> ChunkSourcePtr;
-class RegionLoader :
- public QObject,
- public QRunnable
+class RegionLoader : public QObject,
+ public QRunnable
{
Q_OBJECT
-public:
+ public:
RegionLoader(int a_RegionX, int a_RegionZ, RegionPtr a_Region, ChunkSourcePtr a_ChunkSource);
virtual ~RegionLoader() {}
/** Signals to all loaders that the app is shutting down and the loading should be aborted. */
static void shutdown() { m_IsShuttingDown = true; }
-signals:
+ signals:
void loaded(int a_RegionX, int a_RegionZ);
-protected:
+ protected:
virtual void run() override;
-private:
+ private:
/** Coords of the region to be loaded. */
int m_RegionX, m_RegionZ;
@@ -50,7 +49,3 @@ private:
/** Flag that is set upon app exit to terminate the queued loaders faster. */
static volatile bool m_IsShuttingDown;
};
-
-
-
-