summaryrefslogtreecommitdiffstats
path: root/Tools/QtBiomeVisualiser/ChunkSource.h
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-19 14:31:18 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-19 14:31:18 +0200
commit4398156b2e56ccfcb41f750906501ecf446be045 (patch)
treedc1c070c6c7490619d8b05e30ace2c959f085bb2 /Tools/QtBiomeVisualiser/ChunkSource.h
parentDerp (diff)
parentQtBiomeVisualiser: More gcc fixes. (diff)
downloadcuberite-4398156b2e56ccfcb41f750906501ecf446be045.tar
cuberite-4398156b2e56ccfcb41f750906501ecf446be045.tar.gz
cuberite-4398156b2e56ccfcb41f750906501ecf446be045.tar.bz2
cuberite-4398156b2e56ccfcb41f750906501ecf446be045.tar.lz
cuberite-4398156b2e56ccfcb41f750906501ecf446be045.tar.xz
cuberite-4398156b2e56ccfcb41f750906501ecf446be045.tar.zst
cuberite-4398156b2e56ccfcb41f750906501ecf446be045.zip
Diffstat (limited to 'Tools/QtBiomeVisualiser/ChunkSource.h')
-rw-r--r--Tools/QtBiomeVisualiser/ChunkSource.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/Tools/QtBiomeVisualiser/ChunkSource.h b/Tools/QtBiomeVisualiser/ChunkSource.h
index d6eb2e3cb..868e4a144 100644
--- a/Tools/QtBiomeVisualiser/ChunkSource.h
+++ b/Tools/QtBiomeVisualiser/ChunkSource.h
@@ -1,4 +1,6 @@
#pragma once
+#include <QString>
+#include <QMutex>
#include "Chunk.h"
@@ -7,6 +9,8 @@
// fwd:
class cBiomeGen;
+typedef std::shared_ptr<cBiomeGen> cBiomeGenPtr;
+class cIniFile;
@@ -21,6 +25,9 @@ public:
/** 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, ChunkPtr a_DestChunk) = 0;
+
+ /** Forces a fresh reload of the source. Useful mainly for the generator, whose underlying definition file may have been changed. */
+ virtual void reload() = 0;
};
@@ -32,14 +39,21 @@ class BioGenSource :
public ChunkSource
{
public:
- /** Constructs a new BioGenSource based on the biome generator given.
- Takes ownership of a_BiomeGen */
- BioGenSource(cBiomeGen * a_BiomeGen);
+ /** Constructs a new BioGenSource based on the biome generator that is defined in the specified world.ini file. */
+ BioGenSource(QString a_WorldIniPath);
+ // ChunkSource overrides:
virtual void getChunkBiomes(int a_ChunkX, int a_ChunkZ, ChunkPtr a_DestChunk) override;
+ virtual void reload(void) override;
protected:
- std::shared_ptr<cBiomeGen> m_BiomeGen;
+ /** Path to the world.ini file from which the m_WorldIni is regenerated on reload requests. */
+ QString m_WorldIniPath;
+
+ /** The generator used for generating biomes. */
+ std::unique_ptr<cBiomeGen> m_BiomeGen;
+
+ /** Guards m_BiomeGen against multithreaded access. */
QMutex m_Mtx;
};
@@ -52,7 +66,9 @@ class AnvilSource :
public:
// TODO
+ // ChunkSource overrides:
virtual void getChunkBiomes(int a_ChunkX, int a_ChunkZ, ChunkPtr a_DestChunk) override;
+ virtual void reload() override {}
};