From f4bf4355288da77852d10bd8426bb4ca8ea99ba6 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 29 Jul 2012 16:44:47 +0000 Subject: BiomeGen: cca 3% speedup git-svn-id: http://mc-server.googlecode.com/svn/trunk@706 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/BioGen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/BioGen.cpp b/source/BioGen.cpp index 8603a7452..73529abb6 100644 --- a/source/BioGen.cpp +++ b/source/BioGen.cpp @@ -223,7 +223,7 @@ EMCSBiome cBioGenVoronoi::VoronoiBiome(int a_BlockX, int a_BlockZ) // Note that Noise values need to be divided by 8 to gain a uniform modulo-2^n distribution // Get 5x5 neighboring cell seeds, compare distance to each. Return the biome in the minumim-distance cell - double MinDist = m_CellSize * m_CellSize; // There has to be a cell closer than this + int MinDist = m_CellSize * m_CellSize * 16; // There has to be a cell closer than this EMCSBiome res = biPlains; // Will be overriden for (int x = CellX - 2; x <= CellX + 2; x++) { @@ -235,7 +235,7 @@ EMCSBiome cBioGenVoronoi::VoronoiBiome(int a_BlockX, int a_BlockZ) int SeedX = BaseX + OffsetX; int SeedZ = z * m_CellSize + OffsetZ; - double Dist = sqrt((double)((SeedX - a_BlockX) * (SeedX - a_BlockX) + (SeedZ - a_BlockZ) * (SeedZ - a_BlockZ))); + int Dist = (SeedX - a_BlockX) * (SeedX - a_BlockX) + (SeedZ - a_BlockZ) * (SeedZ - a_BlockZ); if (Dist < MinDist) { MinDist = Dist; -- cgit v1.2.3