Skip to content
Permalink
Browse files

Server/Misc: Fix multiple static analysis issues.

Signed-off-by: AriDEV <aridev666@gmail.com>
  • Loading branch information...
AriDEV committed Oct 28, 2019
1 parent 76d0eb0 commit bdb94a3d5547105c4be9c346dab2f2c112691aa9
@@ -390,7 +390,7 @@ bool SmartAI::IsEscortInvokerInRange()
if (targets->size() == 1 && GetScript()->IsPlayer((*targets->begin())))
{
Player* player = (*targets->begin())->ToPlayer();
if (me->GetDistance(player) <= SMART_ESCORT_MAX_PLAYER_DIST)
if (me->GetDistance(player) <= float(SMART_ESCORT_MAX_PLAYER_DIST))
return true;

if (Group* group = player->GetGroup())
@@ -399,7 +399,7 @@ bool SmartAI::IsEscortInvokerInRange()
{
Player* groupGuy = groupRef->GetSource();

if (me->GetDistance(groupGuy) <= SMART_ESCORT_MAX_PLAYER_DIST)
if (me->GetDistance(groupGuy) <= float(SMART_ESCORT_MAX_PLAYER_DIST))
return true;
}
}
@@ -409,7 +409,7 @@ bool SmartAI::IsEscortInvokerInRange()
{
if (GetScript()->IsPlayer((*iter)))
{
if (me->GetDistance((*iter)->ToPlayer()) <= SMART_ESCORT_MAX_PLAYER_DIST)
if (me->GetDistance((*iter)->ToPlayer()) <= float(SMART_ESCORT_MAX_PLAYER_DIST))
return true;
}
}
@@ -1038,7 +1038,7 @@ enum SMARTAI_TARGETS

struct SmartTarget
{
SmartTarget (SMARTAI_TARGETS t = SMART_TARGET_NONE, uint32 p1 = 0, uint32 p2 = 0, uint32 p3 = 0)
SmartTarget (SMARTAI_TARGETS t = SMART_TARGET_NONE, uint32 p1 = 0, uint32 p2 = 0, uint32 p3 = 0) : x(0.0f), y(0.0f), z(0.0f), o(0.0f)
{
type = t;
raw.param1 = p1;
@@ -1149,7 +1149,7 @@ bool BfCapturePoint::Update(uint32 diff)
}

// get the difference of numbers
float fact_diff = ((float) m_activePlayers[0].size() - (float) m_activePlayers[1].size()) * diff / BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL;
float fact_diff = ((float) m_activePlayers[0].size() - (float) m_activePlayers[1].size()) * diff / float(BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL);
if (G3D::fuzzyEq(fact_diff, 0.0f))
return false;

@@ -91,7 +91,6 @@ class Transport : public GameObject, public TransportBase

KeyFrameVec::const_iterator _currentFrame;
KeyFrameVec::const_iterator _nextFrame;
uint32 _moveTimer;
TimeTrackerSmall _positionChangeTimer;
bool _isMoving;
bool _pendingStop;
@@ -1420,7 +1420,7 @@ void Guild::HandleRoster(WorldSession* session /*= NULL*/)
memberData.WriteByteSeq(guid[3]);
memberData << uint64(member->GetTotalActivity());
memberData.WriteString(member->GetOfficerNote());
memberData << float(member->IsOnline() ? 0.0f : float(::time(NULL) - member->GetLogoutTime()) / DAY);
memberData << float(member->IsOnline() ? 0.0f : float(::time(NULL) - member->GetLogoutTime()) / float(DAY));
memberData << uint8(0); // Gender
memberData << uint32(member->GetRankId());
memberData << uint32(realmID);
@@ -809,7 +809,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
mailData << uint64(mail->COD);
mailData.WriteString(mail->subject);
mailData << uint32(mail->stationery);
mailData << float(float(mail->expire_time - time(NULL)) / DAY);
mailData << float(float(mail->expire_time - time(NULL)) / float(DAY));
mailData << uint64(mail->money);
mailData << uint32(mail->checked);

@@ -331,7 +331,7 @@ void InstanceSaveManager::LoadResetTimes()
{
Field* fields = result2->Fetch();
uint32 instance = fields[1].GetUInt32();
time_t resettime = time_t(fields[0].GetUInt32() + 2 * HOUR);
time_t resettime = time_t(fields[0].GetUInt32() + 2 * uint32(HOUR));
InstResetTimeMapDiffType::iterator itr = instResetTime.find(instance);
if (itr != instResetTime.end() && itr->second.second != resettime)
{
@@ -391,7 +391,7 @@ void InstanceSaveManager::LoadResetTimes()
continue;

// the reset_delay must be at least one day
uint32 period = uint32(((mapDiff->resetTime * sWorld->getRate(RATE_INSTANCE_RESET_TIME)) / DAY) * DAY);
uint32 period = uint32(((mapDiff->resetTime * sWorld->getRate(RATE_INSTANCE_RESET_TIME)) / uint32(DAY)) * uint32(DAY));
if (period < DAY)
period = DAY;

@@ -603,7 +603,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, DifficultyID difficulty,
// calculate the next reset time
uint32 diff = sWorld->getIntConfig(CONFIG_INSTANCE_RESET_TIME_HOUR) * HOUR;

uint32 period = uint32(((mapDiff->resetTime * sWorld->getRate(RATE_INSTANCE_RESET_TIME))/DAY) * DAY);
uint32 period = uint32(((mapDiff->resetTime * sWorld->getRate(RATE_INSTANCE_RESET_TIME))/uint32(DAY)) * uint32(DAY));
if (period < DAY)
period = DAY;

@@ -303,23 +303,23 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl
if (keyFrames[0].IsStopFrame())
{
curPathTime = float(keyFrames[0].Node->delay);
keyFrames[0].DepartureTime = uint32(curPathTime * IN_MILLISECONDS);
keyFrames[0].DepartureTime = uint32(curPathTime * float(IN_MILLISECONDS));
}

for (size_t i = 1; i < keyFrames.size(); ++i)
{
curPathTime += keyFrames[i - 1].TimeTo;
if (keyFrames[i].IsStopFrame())
{
keyFrames[i].ArriveTime = uint32(curPathTime * IN_MILLISECONDS);
keyFrames[i].ArriveTime = uint32(curPathTime * float(IN_MILLISECONDS));
keyFrames[i - 1].NextArriveTime = keyFrames[i].ArriveTime;
curPathTime += float(keyFrames[i].Node->delay);
keyFrames[i].DepartureTime = uint32(curPathTime * IN_MILLISECONDS);
keyFrames[i].DepartureTime = uint32(curPathTime * float(IN_MILLISECONDS));
}
else
{
curPathTime -= keyFrames[i].TimeTo;
keyFrames[i].ArriveTime = uint32(curPathTime * IN_MILLISECONDS);
keyFrames[i].ArriveTime = uint32(curPathTime * float(IN_MILLISECONDS));
keyFrames[i - 1].NextArriveTime = keyFrames[i].ArriveTime;
keyFrames[i].DepartureTime = keyFrames[i].ArriveTime;
}
@@ -85,6 +85,8 @@ typedef std::map<uint32, TransportRotationEntry const*> TransportPathRotationCon

struct TransportAnimation
{
TransportAnimation() : TotalTime(0) { }

TransportPathContainer Path;
TransportPathRotationContainer Rotations;
uint32 TotalTime;
@@ -226,7 +226,7 @@ bool MoveSplineInitArgs::_checkPathBounds() const
for (uint32 i = 1; i < path.size()-1; ++i)
{
offset = path[i] - middle;
if (fabs(offset.x) >= MAX_OFFSET || fabs(offset.y) >= MAX_OFFSET || fabs(offset.z) >= MAX_OFFSET)
if (fabs(offset.x) >= float(MAX_OFFSET) || fabs(offset.y) >= float(MAX_OFFSET) || fabs(offset.z) >= float(MAX_OFFSET))
{
SF_LOG_ERROR("misc", "MoveSplineInitArgs::_checkPathBounds check failed");
return false;
@@ -30,15 +30,15 @@ class WorldPacket : public ByteBuffer
{
public:
// just container for later use
WorldPacket() : ByteBuffer(0), m_opcode(UNKNOWN_OPCODE), m_rcvdOpcodeNumber(0)
WorldPacket() : ByteBuffer(0), m_opcode(UNKNOWN_OPCODE), m_rcvdOpcodeNumber(0), _compressionStream(NULL)
{
}

WorldPacket(Opcodes opcode, size_t res = 200) : ByteBuffer(res), m_opcode(opcode), m_rcvdOpcodeNumber(0)
WorldPacket(Opcodes opcode, size_t res = 200) : ByteBuffer(res), m_opcode(opcode), m_rcvdOpcodeNumber(0), _compressionStream(NULL)
{
}
// copy constructor
WorldPacket(WorldPacket const& packet) : ByteBuffer(packet), m_opcode(packet.m_opcode), m_rcvdOpcodeNumber(0)
WorldPacket(WorldPacket const& packet) : ByteBuffer(packet), m_opcode(packet.m_opcode), m_rcvdOpcodeNumber(0), _compressionStream(NULL)
{
}

@@ -249,19 +249,21 @@ class SpellEffectInfo
Mechanics Mechanic;
SpellImplicitTargetInfo TargetA;
SpellImplicitTargetInfo TargetB;
SpellRadiusEntry const* RadiusEntry;
SpellRadiusEntry const* MaxRadiusEntry;
SpellRadiusEntry const* RadiusEntry = { };
SpellRadiusEntry const* MaxRadiusEntry = { };
uint32 ChainTarget;
uint32 ItemType;
uint32 TriggerSpell;
flag128 SpellClassMask;
std::list<Condition*>* ImplicitTargetConditions;
std::list<Condition*>* ImplicitTargetConditions = { };
// SpellScalingEntry
float ScalingMultiplier;
float DeltaScalingMultiplier;
float ComboScalingMultiplier;

SpellEffectInfo() { }
SpellEffectInfo() : ApplyAuraName(0), ApplyAuraTickCount(0), BasePoints(0), BonusMultiplier(0), ChainTarget(0), ComboScalingMultiplier(0.0f),
DamageMultiplier(0.0f), DeltaScalingMultiplier(0.0f), DieSides(0), Effect(0), ItemType(0), Mechanic(MECHANIC_NONE), MiscValue(0), MiscValueB(0),
PointsPerComboPoint(0.0f), RealPointsPerLevel(0.0f), ScalingMultiplier(0.0f), TriggerSpell(0), ValueMultiplier(0.0f), _effIndex(0), _spellInfo(NULL) { }
SpellEffectInfo(SpellEntry const* spellEntry, SpellInfo const* spellInfo, uint8 effIndex, SpellEffectEntry const* effect);

bool IsEffect() const;
@@ -29,7 +29,7 @@
#include "Player.h"
#include "Opcodes.h"

inline float GetAge(uint64 t) { return float(time(NULL) - t) / DAY; }
inline float GetAge(uint64 t) { return float(time(NULL) - t) / float(DAY); }

TicketMgr::TicketMgr() : _feedbackSystemStatus(false), _gmTicketSystemStatus(false),
_lastGmTicketId(0), _lastBugId(0), _lastSuggestId(0), _lastChange(0),

0 comments on commit bdb94a3

Please sign in to comment.
You can’t perform that action at this time.