Core/Random: Changed random functions returning doubles to return floats

* They were all cast to float at use anyway
* Improves roll_chance_f performance (rand32() is now called internally by uniform_real_distribution once instead of twice)
This commit is contained in:
Shauren
2023-10-31 20:20:00 +01:00
parent a0fdac0ecc
commit 9894f6b802
22 changed files with 47 additions and 45 deletions

View File

@@ -307,7 +307,7 @@ class spell_midsummer_fling_torch : public SpellScript
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Position dest = GetCaster()->GetFirstCollisionPosition(30.0f, (float)rand_norm() * static_cast<float>(2 * M_PI));
Position dest = GetCaster()->GetFirstCollisionPosition(30.0f, rand_norm() * static_cast<float>(2 * M_PI));
GetCaster()->CastSpell(dest, SPELL_FLING_TORCH_TRIGGERED, true);
GetCaster()->CastSpell(dest, SPELL_FLING_TORCH_SHADOW);
}
@@ -391,7 +391,7 @@ class spell_midsummer_fling_torch_catch : public SpellScript
}
else
{
Position dest = player->GetFirstCollisionPosition(15.0f, (float)rand_norm() * static_cast<float>(2 * M_PI));
Position dest = player->GetFirstCollisionPosition(15.0f, rand_norm() * static_cast<float>(2 * M_PI));
player->CastSpell(player, SPELL_TORCHES_CAUGHT);
player->CastSpell(dest, SPELL_FLING_TORCH_TRIGGERED, true);
player->CastSpell(dest, SPELL_FLING_TORCH_SHADOW);