diff options
author | Mattes D <github@xoft.cz> | 2014-08-22 15:18:39 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-08-22 15:18:39 +0200 |
commit | e034b64a5b4aab6f285ba732923cea70dca44d2d (patch) | |
tree | 9705effad70cbd41078d7893feda0a0236515581 /src/Blocks/BlockOre.h | |
parent | cMojangAPI updates cRankManager's playernames. (diff) | |
parent | Fixed a warning in FastRandom. (diff) | |
download | cuberite-e034b64a5b4aab6f285ba732923cea70dca44d2d.tar cuberite-e034b64a5b4aab6f285ba732923cea70dca44d2d.tar.gz cuberite-e034b64a5b4aab6f285ba732923cea70dca44d2d.tar.bz2 cuberite-e034b64a5b4aab6f285ba732923cea70dca44d2d.tar.lz cuberite-e034b64a5b4aab6f285ba732923cea70dca44d2d.tar.xz cuberite-e034b64a5b4aab6f285ba732923cea70dca44d2d.tar.zst cuberite-e034b64a5b4aab6f285ba732923cea70dca44d2d.zip |
Diffstat (limited to 'src/Blocks/BlockOre.h')
-rw-r--r-- | src/Blocks/BlockOre.h | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/src/Blocks/BlockOre.h b/src/Blocks/BlockOre.h index 9684dbb19..0067d475f 100644 --- a/src/Blocks/BlockOre.h +++ b/src/Blocks/BlockOre.h @@ -2,7 +2,6 @@ #pragma once #include "BlockHandler.h" -#include "../MersenneTwister.h" #include "../World.h" @@ -20,58 +19,41 @@ public: virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { - short ItemType = m_BlockType; - char Count = 1; - short Meta = 0; - - MTRand r1; + cFastRandom Random; + switch (m_BlockType) { case E_BLOCK_LAPIS_ORE: { - ItemType = E_ITEM_DYE; - Count = 4 + (char)r1.randInt(4); - Meta = 4; + a_Pickups.push_back(cItem(E_ITEM_DYE, (char)(4 + Random.NextInt(5)), 4)); break; } case E_BLOCK_REDSTONE_ORE: case E_BLOCK_REDSTONE_ORE_GLOWING: { - Count = 4 + (char)r1.randInt(1); - break; - } - default: - { - Count = 1; + a_Pickups.push_back(cItem(E_ITEM_REDSTONE_DUST, (char)(4 + Random.NextInt(2)), 0)); break; } - } - - switch (m_BlockType) - { case E_BLOCK_DIAMOND_ORE: { - ItemType = E_ITEM_DIAMOND; - break; - } - case E_BLOCK_REDSTONE_ORE: - case E_BLOCK_REDSTONE_ORE_GLOWING: - { - ItemType = E_ITEM_REDSTONE_DUST; + a_Pickups.push_back(cItem(E_ITEM_DIAMOND)); break; } case E_BLOCK_EMERALD_ORE: { - ItemType = E_ITEM_EMERALD; + a_Pickups.push_back(cItem(E_ITEM_EMERALD)); break; } case E_BLOCK_COAL_ORE: { - ItemType = E_ITEM_COAL; + a_Pickups.push_back(cItem(E_ITEM_COAL)); break; } + default: + { + ASSERT(!"Unhandled ore!"); + } } - a_Pickups.push_back(cItem(ItemType, Count, Meta)); } } ; |