Skip to content

Commit 5a0ac60

Browse files
committed
changed rounding method (#884)
1 parent 770a066 commit 5a0ac60

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

src/game/common/rts/player.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2998,7 +2998,7 @@ void Player::Do_Bounty_For_Kill(const Object *killer, const Object *killed)
29982998
{
29992999
if (killer != nullptr && killed != nullptr && !killed->Get_Status(OBJECT_STATUS_UNDER_CONSTRUCTION)) {
30003000
unsigned int amount =
3001-
GameMath::Fast_To_Int_Round(killed->Get_Template()->Calc_Cost_To_Build(this) * m_bountyCostToBuild);
3001+
GameMath::Fast_To_Int_Floor(killed->Get_Template()->Calc_Cost_To_Build(this) * m_bountyCostToBuild);
30023002

30033003
if (amount != 0) {
30043004
Get_Money()->Deposit(amount, true);

src/w3d/math/gamemath.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -378,23 +378,6 @@ inline int Fast_To_Int_Truncate(float val)
378378
#endif
379379
}
380380

381-
inline int Fast_To_Int_Round(float val)
382-
{
383-
static const float _exactly_half = 0.5f;
384-
385-
if (Fast_Is_Float_Positive(val)) {
386-
val += _exactly_half;
387-
} else {
388-
val -= _exactly_half;
389-
}
390-
391-
#ifdef BUILD_WITH_GAMEMATH
392-
return gm_lrintf(gm_truncf(val));
393-
#else
394-
return lrintf(truncf(val)); // TODO reimplement based on fdlibm for cross platform reproducibility.
395-
#endif
396-
}
397-
398381
inline float Random_Float()
399382
{
400383
return float((float(rand() & 0xFFF)) / float(0xFFF));

0 commit comments

Comments
 (0)