From bf1fb0aa3dbd5b6b793d920c4e301e4782fe0f0f Mon Sep 17 00:00:00 2001 From: mgueydan Date: Sun, 8 Sep 2013 00:11:38 +0200 Subject: Adding an Empty shell that would launch mob spawner - not called yet --- source/Chunk.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'source/Chunk.cpp') diff --git a/source/Chunk.cpp b/source/Chunk.cpp index 59a65a537..35e44363e 100644 --- a/source/Chunk.cpp +++ b/source/Chunk.cpp @@ -31,6 +31,7 @@ #include "Blocks/BlockHandler.h" #include "Simulator/FluidSimulator.h" #include "MobCensus.h" +#include "MobSpawner.h" #include @@ -468,6 +469,42 @@ void cChunk::CollectMobCensus(cMobCensus& toFill) +void cChunk::getThreeRandomNumber(int& a_X, int& a_Y, int& a_Z,int a_MaxX, int a_MaxY, int a_MaxZ) +{ + assert(a_MaxX * a_MaxY * a_MaxZ * 8 < 0x00ffffff); + int Random = m_World->GetTickRandomNumber(0x00ffffff); + a_X = Random % (a_MaxX * 2); + a_Y = (Random / (a_MaxX * 2)) % (a_MaxY * 2); + a_Z = ((Random / (a_MaxX * 2)) / (a_MaxY * 2)) % (a_MaxZ * 2); + a_X /= 2; + a_Y /= 2; + a_Z /= 2; +} + + + + + +void cChunk::getRandomBlock(int& a_X, int& a_Y, int& a_Z) +{ + // MG TODO : check if this kind of optimization (only one random call) is still needed + // MG TODO : if so propagate it + + getThreeRandomNumber(a_X, a_Y, a_Z, Width, Height-2, Width); + a_Y++; +} + + + + + +void cChunk::SpawnMobs(cMobSpawner& a_MobSpawner) +{ +} + + + + void cChunk::Tick(float a_Dt) { -- cgit v1.2.3