From 1d960d91ff1b3890dfa3caf1c7581647c9fc8537 Mon Sep 17 00:00:00 2001 From: Guillaume Dupuy Date: Thu, 13 Oct 2016 20:46:10 +0200 Subject: [PATCH] Fixed a rare case where float and double mixup would result in an incorrect speed --HG-- branch : fix_speed --- .../entities_game_service/phrase_manager/combat_attacker.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/combat_attacker.cpp b/code/ryzom/server/src/entities_game_service/phrase_manager/combat_attacker.cpp index f6c2cdb85..ca03d0cff 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/combat_attacker.cpp +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/combat_attacker.cpp @@ -130,7 +130,8 @@ CCombatWeapon::CCombatWeapon(CGameItemPtr itemPtr) // weapon hit rate is in hit/10s and we use ticks/hits.... if (itemPtr->hitRate() != 0) { - LatencyInTicks = uint16( (10.0f / itemPtr->hitRate()) / CTickEventHandler::getGameTimeStep()); + //getGameTimeStep() is actually a double and hitRate() a float, so the precision difference will make a cast of the result fail (for example, with hitRate() == 10.0f, the cast will give a value of 9 and not 10 + LatencyInTicks = uint16 ( (10.0f / itemPtr->hitRate() ) / float(CTickEventHandler::getGameTimeStep()) ); } Quality = (uint16)itemPtr->recommended();