diff options
Diffstat (limited to 'Tools/BiomeVisualiser')
-rw-r--r-- | Tools/BiomeVisualiser/BiomeCache.cpp | 5 | ||||
-rw-r--r-- | Tools/BiomeVisualiser/BiomeViewWnd.cpp | 21 | ||||
-rw-r--r-- | Tools/BiomeVisualiser/BiomeViewWnd.h | 19 |
3 files changed, 40 insertions, 5 deletions
diff --git a/Tools/BiomeVisualiser/BiomeCache.cpp b/Tools/BiomeVisualiser/BiomeCache.cpp index b3c308422..7d9301d8f 100644 --- a/Tools/BiomeVisualiser/BiomeCache.cpp +++ b/Tools/BiomeVisualiser/BiomeCache.cpp @@ -258,6 +258,11 @@ void cBiomeCache::FilterOutItems(cItems & a_Items, int a_MinChunkX, int a_MaxChu void cBiomeCache::thrProcessQueueItem(void) { + if (m_Source == NULL) + { + return; + } + cItem * Item = NULL; { cCSLock Lock(m_CS); diff --git a/Tools/BiomeVisualiser/BiomeViewWnd.cpp b/Tools/BiomeVisualiser/BiomeViewWnd.cpp index 0658e3810..5c1240bc7 100644 --- a/Tools/BiomeVisualiser/BiomeViewWnd.cpp +++ b/Tools/BiomeVisualiser/BiomeViewWnd.cpp @@ -34,6 +34,8 @@ bool cBiomeViewWnd::Create(HWND a_ParentWnd, LPCTSTR a_Title) { ASSERT(m_Wnd == NULL); + InitBiomeView(); + // Create a regular STATIC window, then override its window procedure with our own. No need for obnoxious RegisterWindowClass() stuff. m_Wnd = CreateWindow("STATIC", a_Title, WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 400, 300, a_ParentWnd, NULL, GetModuleHandle(NULL), NULL); if (m_Wnd == NULL) @@ -43,11 +45,6 @@ bool cBiomeViewWnd::Create(HWND a_ParentWnd, LPCTSTR a_Title) } SetWindowLongPtr(m_Wnd, GWLP_WNDPROC, m_Thunk); - cIniFile IniFile; - cBiomeGen * BioGen = new cBioGenMultiStepMap(2); - BioGen->InitializeBiomeGen(IniFile); - m_Renderer.SetSource(new cGeneratorBiomeSource(BioGen)); - return true; } @@ -55,6 +52,20 @@ bool cBiomeViewWnd::Create(HWND a_ParentWnd, LPCTSTR a_Title) +void cBiomeViewWnd::InitBiomeView(void) +{ + cIniFile IniFile; + IniFile.ReadFile("world.ini"); + int Seed = IniFile.GetValueSetI("Generator", "Seed", 0); + bool CacheOffByDefault = false; + m_BiomeGen = cBiomeGen::CreateBiomeGen(IniFile, Seed, CacheOffByDefault); + m_Renderer.SetSource(new cGeneratorBiomeSource(m_BiomeGen)); + IniFile.WriteFile("world.ini"); +} + + + + LRESULT cBiomeViewWnd::WndProc(HWND a_Wnd, UINT a_Msg, WPARAM wParam, LPARAM lParam) { diff --git a/Tools/BiomeVisualiser/BiomeViewWnd.h b/Tools/BiomeVisualiser/BiomeViewWnd.h index 88e808ab3..e3f70c7e6 100644 --- a/Tools/BiomeVisualiser/BiomeViewWnd.h +++ b/Tools/BiomeVisualiser/BiomeViewWnd.h @@ -3,6 +3,12 @@ // Declares the cBiomeViewWnd class representing the window that displays biomes + + + + +#pragma once + #include "WndProcThunk.h" #include "BiomeRenderer.h" #include "BiomeCache.h" @@ -12,6 +18,13 @@ +// fwd: +class cBiomeGen; + + + + + class cBiomeViewWnd { public: @@ -26,9 +39,15 @@ protected: cBiomeRenderer m_Renderer; cPixmap m_Pixmap; + /// The generator that is to be visualised + cBiomeGen * m_BiomeGen; + bool m_IsLButtonDown; POINT m_MouseDown; + + void InitBiomeView(void); + LRESULT WndProc(HWND a_Wnd, UINT a_Msg, WPARAM wParam, LPARAM lParam); // Message handlers: |