summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockCrops.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Blocks/BlockCrops.h')
-rw-r--r--src/Blocks/BlockCrops.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/Blocks/BlockCrops.h b/src/Blocks/BlockCrops.h
index 5ca264774..378505430 100644
--- a/src/Blocks/BlockCrops.h
+++ b/src/Blocks/BlockCrops.h
@@ -26,7 +26,7 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_Meta) override
{
- cFastRandom rand;
+ auto & rand = GetRandomProvider();
// If not fully grown, drop the "seed" of whatever is growing:
if (a_Meta < RipeMeta)
@@ -51,30 +51,30 @@ public:
{
case E_BLOCK_BEETROOTS:
{
- char SeedCount = static_cast<char>(1 + (rand.NextInt(3) + rand.NextInt(3)) / 2); // [1 .. 3] with high preference of 2
- a_Pickups.push_back(cItem(E_ITEM_BEETROOT_SEEDS, SeedCount, 0));
- char BeetrootCount = static_cast<char>(1 + (rand.NextInt(3) + rand.NextInt(3)) / 2); // [1 .. 3] with high preference of 2
- a_Pickups.push_back(cItem(E_ITEM_BEETROOT, BeetrootCount, 0));
+ char SeedCount = 1 + ((rand.RandInt<char>(2) + rand.RandInt<char>(2)) / 2); // [1 .. 3] with high preference of 2
+ a_Pickups.emplace_back(E_ITEM_BEETROOT_SEEDS, SeedCount, 0);
+ char BeetrootCount = 1 + ((rand.RandInt<char>(2) + rand.RandInt<char>(2)) / 2); // [1 .. 3] with high preference of 2
+ a_Pickups.emplace_back(E_ITEM_BEETROOT, BeetrootCount, 0);
break;
}
case E_BLOCK_CROPS:
{
- a_Pickups.push_back(cItem(E_ITEM_WHEAT, 1, 0));
- a_Pickups.push_back(cItem(E_ITEM_SEEDS, static_cast<char>(1 + (rand.NextInt(3) + rand.NextInt(3)) / 2), 0)); // [1 .. 3] with high preference of 2
+ a_Pickups.emplace_back(E_ITEM_WHEAT, 1, 0);
+ a_Pickups.emplace_back(E_ITEM_SEEDS, 1 + ((rand.RandInt<char>(2) + rand.RandInt<char>(2)) / 2), 0); // [1 .. 3] with high preference of 2
break;
}
case E_BLOCK_CARROTS:
{
- a_Pickups.push_back(cItem(E_ITEM_CARROT, static_cast<char>(1 + (rand.NextInt(3) + rand.NextInt(3)) / 2), 0)); // [1 .. 3] with high preference of 2
+ a_Pickups.emplace_back(E_ITEM_CARROT, 1 + ((rand.RandInt<char>(2) + rand.RandInt<char>(2)) / 2), 0); // [1 .. 3] with high preference of 2
break;
}
case E_BLOCK_POTATOES:
{
- a_Pickups.push_back(cItem(E_ITEM_POTATO, static_cast<char>(1 + (rand.NextInt(3) + rand.NextInt(3)) / 2), 0)); // [1 .. 3] with high preference of 2
- if (rand.NextInt(21) == 0)
+ a_Pickups.emplace_back(E_ITEM_POTATO, 1 + ((rand.RandInt<char>(2) + rand.RandInt<char>(2)) / 2), 0); // [1 .. 3] with high preference of 2
+ if (rand.RandBool(0.05))
{
// With a 5% chance, drop a poisonous potato as well
- a_Pickups.push_back(cItem(E_ITEM_POISONOUS_POTATO, 1, 0));
+ a_Pickups.emplace_back(E_ITEM_POISONOUS_POTATO, 1, 0);
}
break;
}