mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-24 01:48:44 +00:00
Use double instead of float to allow big values of GameCycle (like on winchgate server)
This commit is contained in:
parent
1020c758b9
commit
bf8677131b
7 changed files with 16 additions and 17 deletions
|
@ -651,9 +651,9 @@ public :
|
||||||
bool getStats(const std::string &stats, std::string &final );
|
bool getStats(const std::string &stats, std::string &final );
|
||||||
|
|
||||||
/// accessors to the action latency end date
|
/// accessors to the action latency end date
|
||||||
inline float getLatencyEndDate(){ return _LatencyEndDate; }
|
inline double getLatencyEndDate(){ return _LatencyEndDate; }
|
||||||
|
|
||||||
inline void setLatencyEndDate( float latencyEndDate ){ _LatencyEndDate = latencyEndDate; }
|
inline void setLatencyEndDate( double latencyEndDate ){ _LatencyEndDate = latencyEndDate; }
|
||||||
|
|
||||||
/// set the max sap load craft parameter
|
/// set the max sap load craft parameter
|
||||||
inline void setMaxSapLoad(float value)
|
inline void setMaxSapLoad(float value)
|
||||||
|
@ -950,7 +950,7 @@ private:
|
||||||
/// string associated with this item
|
/// string associated with this item
|
||||||
std::string _PhraseId;
|
std::string _PhraseId;
|
||||||
/// tick when the proc will be available again
|
/// tick when the proc will be available again
|
||||||
float _LatencyEndDate;
|
double _LatencyEndDate;
|
||||||
/// image of the item in bag / equipment
|
/// image of the item in bag / equipment
|
||||||
// uint16 _SlotImage;
|
// uint16 _SlotImage;
|
||||||
NLMISC::TGameCycle _TotalSaleCycle;
|
NLMISC::TGameCycle _TotalSaleCycle;
|
||||||
|
|
|
@ -130,8 +130,7 @@ CCombatWeapon::CCombatWeapon(CGameItemPtr itemPtr)
|
||||||
// weapon hit rate is in hit/10s and we use ticks/hits....
|
// weapon hit rate is in hit/10s and we use ticks/hits....
|
||||||
if (itemPtr->hitRate() != 0)
|
if (itemPtr->hitRate() != 0)
|
||||||
{
|
{
|
||||||
//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 = (10.0f / itemPtr->hitRate() ) / CTickEventHandler::getGameTimeStep();
|
||||||
LatencyInTicks = (10.0f / itemPtr->hitRate() ) / float(CTickEventHandler::getGameTimeStep());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Quality = (uint16)itemPtr->recommended();
|
Quality = (uint16)itemPtr->recommended();
|
||||||
|
@ -298,7 +297,7 @@ void CCombatAttackerAI::initFromRowId( const TDataSetRow &rowId )
|
||||||
_RightHandWeapon.Damage = (float)form->getCreatureDamagePerHit() * BotDamageFactor;
|
_RightHandWeapon.Damage = (float)form->getCreatureDamagePerHit() * BotDamageFactor;
|
||||||
|
|
||||||
_RightHandWeapon.DmgType = DMGTYPE::SLASHING;
|
_RightHandWeapon.DmgType = DMGTYPE::SLASHING;
|
||||||
_RightHandWeapon.LatencyInTicks = (float)form->getAttackLatency();
|
_RightHandWeapon.LatencyInTicks = (double)form->getAttackLatency();
|
||||||
_RightHandWeapon.Family = ITEMFAMILY::MELEE_WEAPON;
|
_RightHandWeapon.Family = ITEMFAMILY::MELEE_WEAPON;
|
||||||
_RightHandWeapon.Skill = BarehandCombatSkill;
|
_RightHandWeapon.Skill = BarehandCombatSkill;
|
||||||
_RightHandWeapon.SabrinaCost = (uint16)_SkillValue;
|
_RightHandWeapon.SabrinaCost = (uint16)_SkillValue;
|
||||||
|
@ -417,7 +416,7 @@ void CCombatAttackerNpc::initFromRowId( const TDataSetRow &rowId )
|
||||||
{
|
{
|
||||||
// get speed, dmg type, skill and family
|
// get speed, dmg type, skill and family
|
||||||
_RightHandWeapon = CCombatWeapon(entity->getRightHandItem());
|
_RightHandWeapon = CCombatWeapon(entity->getRightHandItem());
|
||||||
_RightHandWeapon.LatencyInTicks = (float)form->getAttackLatency();
|
_RightHandWeapon.LatencyInTicks = (double)form->getAttackLatency();
|
||||||
|
|
||||||
// check ammo
|
// check ammo
|
||||||
if (entity->getAmmoItem() != NULL && entity->getAmmoItem()->getStaticForm() != NULL && entity->getAmmoItem()->getStaticForm()->Family == ITEMFAMILY::AMMO)
|
if (entity->getAmmoItem() != NULL && entity->getAmmoItem()->getStaticForm() != NULL && entity->getAmmoItem()->getStaticForm()->Family == ITEMFAMILY::AMMO)
|
||||||
|
@ -427,7 +426,7 @@ void CCombatAttackerNpc::initFromRowId( const TDataSetRow &rowId )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_RightHandWeapon.LatencyInTicks = (float)form->getAttackLatency();
|
_RightHandWeapon.LatencyInTicks = (double)form->getAttackLatency();
|
||||||
_RightHandWeapon.Family = ITEMFAMILY::MELEE_WEAPON;
|
_RightHandWeapon.Family = ITEMFAMILY::MELEE_WEAPON;
|
||||||
_RightHandWeapon.Skill = BarehandCombatSkill;
|
_RightHandWeapon.Skill = BarehandCombatSkill;
|
||||||
_RightHandWeapon.DmgType = DMGTYPE::BLUNT;
|
_RightHandWeapon.DmgType = DMGTYPE::BLUNT;
|
||||||
|
|
|
@ -92,7 +92,7 @@ public:
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* do not forget to update the operator= if attributes change
|
/* do not forget to update the operator= if attributes change
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
float LatencyInTicks;
|
double LatencyInTicks;
|
||||||
float Damage;
|
float Damage;
|
||||||
uint16 Quality;
|
uint16 Quality;
|
||||||
DMGTYPE::EDamageType DmgType;
|
DMGTYPE::EDamageType DmgType;
|
||||||
|
|
|
@ -1843,14 +1843,14 @@ bool CCombatPhrase::launch()
|
||||||
}
|
}
|
||||||
|
|
||||||
// get weapon latency
|
// get weapon latency
|
||||||
float latency;
|
double latency;
|
||||||
if(_LeftWeapon.LatencyInTicks != 0)
|
if(_LeftWeapon.LatencyInTicks != 0)
|
||||||
{
|
{
|
||||||
latency = float(_HitRateModifier + std::max( float(MinTwoWeaponsLatency.get()), std::max(_RightWeapon.LatencyInTicks, _LeftWeapon.LatencyInTicks)) + _Ammo.LatencyInTicks);
|
latency = double(_HitRateModifier + std::max( double(MinTwoWeaponsLatency.get()), std::max(_RightWeapon.LatencyInTicks, _LeftWeapon.LatencyInTicks)) + _Ammo.LatencyInTicks);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
latency = float(_HitRateModifier + std::max(_RightWeapon.LatencyInTicks, _LeftWeapon.LatencyInTicks) + _Ammo.LatencyInTicks);
|
latency = double(_HitRateModifier + std::max(_RightWeapon.LatencyInTicks, _LeftWeapon.LatencyInTicks) + _Ammo.LatencyInTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for madness effect
|
// check for madness effect
|
||||||
|
@ -2183,7 +2183,7 @@ bool CCombatPhrase::launch()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_LatencyEndDate = (float)time + latency;
|
_LatencyEndDate = (double)time + latency;
|
||||||
}
|
}
|
||||||
nlwarning("_LatencyEndDate : %f, latency: %f", _LatencyEndDate, latency);
|
nlwarning("_LatencyEndDate : %f, latency: %f", _LatencyEndDate, latency);
|
||||||
// compute the apply date
|
// compute the apply date
|
||||||
|
|
|
@ -716,7 +716,7 @@ void CFgProspectionPhrase::apply()
|
||||||
MBEHAV::CBehaviour behav = player->getBehaviour(); // keep arguments
|
MBEHAV::CBehaviour behav = player->getBehaviour(); // keep arguments
|
||||||
behav.Behaviour = MBEHAV::PROSPECTING_END;
|
behav.Behaviour = MBEHAV::PROSPECTING_END;
|
||||||
PHRASE_UTILITIES::sendUpdateBehaviour( _ActorRowId, behav );
|
PHRASE_UTILITIES::sendUpdateBehaviour( _ActorRowId, behav );
|
||||||
_LatencyEndDate =(float)ForageSourceSpawnDelay.get(); // wait a short time before spawning the source(s) (to let animation/fx time)
|
_LatencyEndDate =(double)ForageSourceSpawnDelay.get(); // wait a short time before spawning the source(s) (to let animation/fx time)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1566,7 +1566,7 @@ bool CMagicPhrase::launch()
|
||||||
// add post cast latency, only for non instant cast
|
// add post cast latency, only for non instant cast
|
||||||
const NLMISC::TGameCycle time = CTickEventHandler::getGameCycle();
|
const NLMISC::TGameCycle time = CTickEventHandler::getGameCycle();
|
||||||
if (_DivineInterventionOccured||_ShootAgainOccured?_BaseCastingTime:_CastingTime)
|
if (_DivineInterventionOccured||_ShootAgainOccured?_BaseCastingTime:_CastingTime)
|
||||||
_LatencyEndDate = (float)time + PostCastLatency + _PostCastTime;
|
_LatencyEndDate = (double)time + PostCastLatency + _PostCastTime;
|
||||||
else
|
else
|
||||||
_LatencyEndDate = 0.0f + _PostCastTime;
|
_LatencyEndDate = 0.0f + _PostCastTime;
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ public:
|
||||||
inline NLMISC::TGameCycle applyDate() const { return _ApplyDate; }
|
inline NLMISC::TGameCycle applyDate() const { return _ApplyDate; }
|
||||||
|
|
||||||
/// get latency end date
|
/// get latency end date
|
||||||
inline float latencyEndDate() const { return _LatencyEndDate; }
|
inline double latencyEndDate() const { return _LatencyEndDate; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* build the phrase from bricks, actor and main target
|
* build the phrase from bricks, actor and main target
|
||||||
|
@ -207,7 +207,7 @@ protected:
|
||||||
/// apply date
|
/// apply date
|
||||||
NLMISC::TGameCycle _ApplyDate;
|
NLMISC::TGameCycle _ApplyDate;
|
||||||
/// latency end date
|
/// latency end date
|
||||||
float _LatencyEndDate;
|
double _LatencyEndDate;
|
||||||
/// index in client phrase book (0 = not in the phrase book)
|
/// index in client phrase book (0 = not in the phrase book)
|
||||||
uint16 _PhraseBookIndex;
|
uint16 _PhraseBookIndex;
|
||||||
/// next counter
|
/// next counter
|
||||||
|
|
Loading…
Reference in a new issue