Warnings fixes

This commit is contained in:
Tiger Wang 2016-11-13 19:00:01 +00:00
parent 7e15912a8b
commit 944fdd173f
18 changed files with 67 additions and 55 deletions

View File

@ -1066,6 +1066,18 @@ void cLuaState::Push(double a_Value)
void cLuaState::Push(float a_Value)
{
ASSERT(IsValid());
tolua_pushnumber(m_LuaState, static_cast<double>(a_Value));
m_NumCurrentFunctionArgs += 1;
}
void cLuaState::Push(int a_Value) void cLuaState::Push(int a_Value)
{ {
ASSERT(IsValid()); ASSERT(IsValid());
@ -1385,7 +1397,7 @@ bool cLuaState::GetStackValue(int a_StackPos, float & a_ReturnedVal)
{ {
if (lua_isnumber(m_LuaState, a_StackPos)) if (lua_isnumber(m_LuaState, a_StackPos))
{ {
a_ReturnedVal = static_cast<float>(tolua_tonumber(m_LuaState, a_StackPos, a_ReturnedVal)); a_ReturnedVal = static_cast<float>(tolua_tonumber(m_LuaState, a_StackPos, static_cast<double>(a_ReturnedVal)));
return true; return true;
} }
return false; return false;

View File

@ -589,6 +589,7 @@ public:
void Push(cLuaTCPLink * a_TCPLink); void Push(cLuaTCPLink * a_TCPLink);
void Push(cLuaUDPEndpoint * a_UDPEndpoint); void Push(cLuaUDPEndpoint * a_UDPEndpoint);
void Push(double a_Value); void Push(double a_Value);
void Push(float a_Value);
void Push(int a_Value); void Push(int a_Value);
void Push(long a_Value); void Push(long a_Value);
void Push(const UInt32 a_Value); void Push(const UInt32 a_Value);

View File

@ -170,7 +170,7 @@ void cMobSpawnerEntity::SpawnEntity(void)
} }
Monster->SetPosition(PosX, RelY, PosZ); Monster->SetPosition(PosX, RelY, PosZ);
Monster->SetYaw(Random.NextFloat() * 360.0f); Monster->SetYaw(static_cast<double>(Random.NextFloat()) * 360);
if (Chunk->GetWorld()->SpawnMobFinalize(Monster) != cEntity::INVALID_ID) if (Chunk->GetWorld()->SpawnMobFinalize(Monster) != cEntity::INVALID_ID)
{ {
EntitiesSpawned = true; EntitiesSpawned = true;

View File

@ -142,11 +142,11 @@ public:
{ {
a_Yaw += 90 + 45; // So its not aligned with axis a_Yaw += 90 + 45; // So its not aligned with axis
if (a_Yaw > 360.f) if (a_Yaw > 360)
{ {
a_Yaw -= 360.f; a_Yaw -= 360;
} }
if ((a_Yaw >= 0.f) && (a_Yaw < 90.f)) if ((a_Yaw >= 0) && (a_Yaw < 90))
{ {
return 0x04; return 0x04;
} }

View File

@ -38,11 +38,11 @@ public:
{ {
a_Rotation += 90 + 45; // So its not aligned with axis a_Rotation += 90 + 45; // So its not aligned with axis
if (a_Rotation > 360.f) if (a_Rotation > 360)
{ {
a_Rotation -= 360.f; a_Rotation -= 360;
} }
if ((a_Rotation >= 0.f) && (a_Rotation < 90.f)) if ((a_Rotation >= 0) && (a_Rotation < 90))
{ {
return 0x4; return 0x4;
} }

View File

@ -583,7 +583,7 @@ bool cBlockHandler::DoesDropOnUnsuitable(void)
/* default functionality: only test for height, since we assume full voxels with varying height */ /* default functionality: only test for height, since we assume full voxels with varying height */
bool cBlockHandler::IsInsideBlock(const Vector3d & a_Position, const BLOCKTYPE a_BlockType, const NIBBLETYPE a_BlockMeta) bool cBlockHandler::IsInsideBlock(const Vector3d & a_Position, const BLOCKTYPE a_BlockType, const NIBBLETYPE a_BlockMeta)
{ {
return a_Position.y < cBlockInfo::GetBlockHeight(a_BlockType); return a_Position.y < static_cast<double>(cBlockInfo::GetBlockHeight(a_BlockType));
} }

View File

@ -91,7 +91,7 @@ public:
virtual bool IsInsideBlock(const Vector3d & a_Position, const BLOCKTYPE a_BlockType, const NIBBLETYPE a_BlockMeta) override virtual bool IsInsideBlock(const Vector3d & a_Position, const BLOCKTYPE a_BlockType, const NIBBLETYPE a_BlockMeta) override
{ {
return a_Position.y < (cBlockInfo::GetBlockHeight(a_BlockType) * (a_BlockMeta & 7)); return a_Position.y < (static_cast<double>(cBlockInfo::GetBlockHeight(a_BlockType)) * (a_BlockMeta & 7));
} }
} ; } ;

View File

@ -18,7 +18,7 @@
cCraftingGrid::cCraftingGrid(int a_Width, int a_Height) : cCraftingGrid::cCraftingGrid(int a_Width, int a_Height) :
m_Width(a_Width), m_Width(a_Width),
m_Height(a_Height), m_Height(a_Height),
m_Items(new cItem[a_Width * a_Height]) m_Items(new cItem[static_cast<size_t>(a_Width * a_Height)])
{ {
} }
@ -29,7 +29,7 @@ cCraftingGrid::cCraftingGrid(int a_Width, int a_Height) :
cCraftingGrid::cCraftingGrid(const cItem * a_Items, int a_Width, int a_Height) : cCraftingGrid::cCraftingGrid(const cItem * a_Items, int a_Width, int a_Height) :
m_Width(a_Width), m_Width(a_Width),
m_Height(a_Height), m_Height(a_Height),
m_Items(new cItem[a_Width * a_Height]) m_Items(new cItem[static_cast<size_t>(a_Width * a_Height)])
{ {
for (int i = a_Width * a_Height - 1; i >= 0; i--) for (int i = a_Width * a_Height - 1; i >= 0; i--)
{ {
@ -44,7 +44,7 @@ cCraftingGrid::cCraftingGrid(const cItem * a_Items, int a_Width, int a_Height) :
cCraftingGrid::cCraftingGrid(const cCraftingGrid & a_Original) : cCraftingGrid::cCraftingGrid(const cCraftingGrid & a_Original) :
m_Width(a_Original.m_Width), m_Width(a_Original.m_Width),
m_Height(a_Original.m_Height), m_Height(a_Original.m_Height),
m_Items(new cItem[a_Original.m_Width * a_Original.m_Height]) m_Items(new cItem[static_cast<size_t>(a_Original.m_Width * a_Original.m_Height)])
{ {
for (int i = m_Width * m_Height - 1; i >= 0; i--) for (int i = m_Width * m_Height - 1; i >= 0; i--)
{ {
@ -201,7 +201,7 @@ void cCraftingGrid::Dump(void)
for (int y = 0; y < m_Height; y++) for (int x = 0; x < m_Width; x++) for (int y = 0; y < m_Height; y++) for (int x = 0; x < m_Width; x++)
{ {
#ifdef _DEBUG #ifdef _DEBUG
int idx = x + m_Width * y; int idx = x + m_Width * y;
#endif #endif
LOGD("Slot (%d, %d): Type %d, health %d, count %d", LOGD("Slot (%d, %d): Type %d, health %d, count %d",
x, y, m_Items[idx].m_ItemType, m_Items[idx].m_ItemDamage, m_Items[idx].m_ItemCount x, y, m_Items[idx].m_ItemType, m_Items[idx].m_ItemDamage, m_Items[idx].m_ItemCount

View File

@ -341,8 +341,8 @@ void cCompoGenNether::InitializeCompoGen(cIniFile & a_IniFile)
cCompoGenCache::cCompoGenCache(cTerrainCompositionGenPtr a_Underlying, int a_CacheSize) : cCompoGenCache::cCompoGenCache(cTerrainCompositionGenPtr a_Underlying, int a_CacheSize) :
m_Underlying(a_Underlying), m_Underlying(a_Underlying),
m_CacheSize(a_CacheSize), m_CacheSize(a_CacheSize),
m_CacheOrder(new int[a_CacheSize]), m_CacheOrder(new int[static_cast<size_t>(a_CacheSize)]),
m_CacheData(new sCacheData[a_CacheSize]), m_CacheData(new sCacheData[static_cast<size_t>(a_CacheSize)]),
m_NumHits(0), m_NumHits(0),
m_NumMisses(0), m_NumMisses(0),
m_TotalChain(0) m_TotalChain(0)

View File

@ -59,7 +59,7 @@ public:
case E_ITEM_STEAK: return FoodInfo(8, 12.8); case E_ITEM_STEAK: return FoodInfo(8, 12.8);
} }
LOGWARNING("%s: Unknown food item (%d), returning zero nutrition", __FUNCTION__, m_ItemType); LOGWARNING("%s: Unknown food item (%d), returning zero nutrition", __FUNCTION__, m_ItemType);
return FoodInfo(0, 0.f); return FoodInfo(0, 0);
} }
virtual bool GetEatEffect(cEntityEffect::eType & a_EffectType, int & a_EffectDurationTicks, short & a_EffectIntensity, float & a_Chance) override virtual bool GetEatEffect(cEntityEffect::eType & a_EffectType, int & a_EffectDurationTicks, short & a_EffectIntensity, float & a_Chance) override

View File

@ -842,7 +842,7 @@ bool cItemHandler::EatItem(cPlayer * a_Player, cItem * a_Item)
} }
FoodInfo Info = GetFoodInfo(); FoodInfo Info = GetFoodInfo();
if ((Info.FoodLevel > 0) || (Info.Saturation > 0.f)) if ((Info.FoodLevel > 0) || (Info.Saturation > 0))
{ {
bool Success = a_Player->Feed(Info.FoodLevel, Info.Saturation); bool Success = a_Player->Feed(Info.FoodLevel, Info.Saturation);
@ -856,7 +856,7 @@ bool cItemHandler::EatItem(cPlayer * a_Player, cItem * a_Item)
cFastRandom r1; cFastRandom r1;
if (r1.NextFloat() < Chance) if (r1.NextFloat() < Chance)
{ {
a_Player->AddEntityEffect(EffectType, EffectDurationTicks, EffectIntensity, Chance); a_Player->AddEntityEffect(EffectType, EffectDurationTicks, EffectIntensity, static_cast<double>(Chance));
} }
} }
return Success; return Success;

View File

@ -80,7 +80,7 @@ public:
int Rotation = 0; int Rotation = 0;
if (m_BlockMeta == 1) if (m_BlockMeta == 1)
{ {
Rotation = FloorC(m_Player.GetYaw() * 16.0f / 360.0f + 0.5f) & 0x0f; Rotation = FloorC(m_Player.GetYaw() * 16.0 / 360.0 + 0.5) & 0x0f;
} }
MobHeadEntity->SetType(m_HeadType); MobHeadEntity->SetType(m_HeadType);

View File

@ -269,7 +269,7 @@ NOISE_DATATYPE cNoise::CubicInterpolate(NOISE_DATATYPE a_A, NOISE_DATATYPE a_B,
NOISE_DATATYPE cNoise::CosineInterpolate(NOISE_DATATYPE a_A, NOISE_DATATYPE a_B, NOISE_DATATYPE a_Pct) NOISE_DATATYPE cNoise::CosineInterpolate(NOISE_DATATYPE a_A, NOISE_DATATYPE a_B, NOISE_DATATYPE a_Pct)
{ {
const NOISE_DATATYPE ft = a_Pct * static_cast<NOISE_DATATYPE>(3.1415927); const NOISE_DATATYPE ft = a_Pct * static_cast<NOISE_DATATYPE>(3.1415927);
const NOISE_DATATYPE f = static_cast<NOISE_DATATYPE>(static_cast<NOISE_DATATYPE>(1 - cos(ft)) * static_cast<NOISE_DATATYPE>(0.5)); const NOISE_DATATYPE f = static_cast<NOISE_DATATYPE>(static_cast<NOISE_DATATYPE>(1 - cos(static_cast<double>(ft))) * static_cast<NOISE_DATATYPE>(0.5));
return a_A * (1 - f) + a_B * f; return a_A * (1 - f) + a_B * f;
} }

View File

@ -61,7 +61,7 @@ public:
std::unique_ptr<NOISE_DATATYPE[]> workspaceHeap; std::unique_ptr<NOISE_DATATYPE[]> workspaceHeap;
if (a_Workspace == nullptr) if (a_Workspace == nullptr)
{ {
workspaceHeap.reset(new NOISE_DATATYPE[a_SizeX * a_SizeY]); workspaceHeap.reset(new NOISE_DATATYPE[static_cast<size_t>(a_SizeX * a_SizeY)]);
a_Workspace = workspaceHeap.get(); a_Workspace = workspaceHeap.get();
} }
@ -121,7 +121,7 @@ public:
std::unique_ptr<NOISE_DATATYPE[]> workspaceHeap; std::unique_ptr<NOISE_DATATYPE[]> workspaceHeap;
if (a_Workspace == nullptr) if (a_Workspace == nullptr)
{ {
workspaceHeap.reset(new NOISE_DATATYPE[a_SizeX * a_SizeY * a_SizeZ]); workspaceHeap.reset(new NOISE_DATATYPE[static_cast<size_t>(a_SizeX * a_SizeY * a_SizeZ)]);
a_Workspace = workspaceHeap.get(); a_Workspace = workspaceHeap.get();
} }

View File

@ -134,20 +134,20 @@ protected:
{ {
if (m_HasIPv6) if (m_HasIPv6)
{ {
sendto(m_MainSock, m_Data.data(), static_cast<socklen_t>(m_Data.size()), 0, reinterpret_cast<const sockaddr *>(&m_AddrIPv6), static_cast<socklen_t>(sizeof(m_AddrIPv6))); sendto(m_MainSock, m_Data.data(), m_Data.size(), 0, reinterpret_cast<const sockaddr *>(&m_AddrIPv6), static_cast<socklen_t>(sizeof(m_AddrIPv6)));
} }
else if (m_HasIPv4) else if (m_HasIPv4)
{ {
// If the secondary socket is valid, it is an IPv4 socket, so use that: // If the secondary socket is valid, it is an IPv4 socket, so use that:
if (m_SecondSock != -1) if (m_SecondSock != -1)
{ {
sendto(m_SecondSock, m_Data.data(), static_cast<socklen_t>(m_Data.size()), 0, reinterpret_cast<const sockaddr *>(&m_AddrIPv4), static_cast<socklen_t>(sizeof(m_AddrIPv4))); sendto(m_SecondSock, m_Data.data(), m_Data.size(), 0, reinterpret_cast<const sockaddr *>(&m_AddrIPv4), static_cast<socklen_t>(sizeof(m_AddrIPv4)));
} }
else else
{ {
// Need an address conversion from IPv4 to IPv6-mapped-IPv4: // Need an address conversion from IPv4 to IPv6-mapped-IPv4:
ConvertIPv4ToMappedIPv6(m_AddrIPv4, m_AddrIPv6); ConvertIPv4ToMappedIPv6(m_AddrIPv4, m_AddrIPv6);
sendto(m_MainSock, m_Data.data(), static_cast<socklen_t>(m_Data.size()), 0, reinterpret_cast<const sockaddr *>(&m_AddrIPv6), static_cast<socklen_t>(sizeof(m_AddrIPv6))); sendto(m_MainSock, m_Data.data(), m_Data.size(), 0, reinterpret_cast<const sockaddr *>(&m_AddrIPv6), static_cast<socklen_t>(sizeof(m_AddrIPv6)));
} }
} }
else else
@ -164,7 +164,7 @@ protected:
LOGD("UDP endpoint queued sendto: Name not resolved to IPv4 for an IPv4-only socket"); LOGD("UDP endpoint queued sendto: Name not resolved to IPv4 for an IPv4-only socket");
return; return;
} }
sendto(m_MainSock, m_Data.data(), static_cast<socklen_t>(m_Data.size()), 0, reinterpret_cast<const sockaddr *>(&m_AddrIPv4), static_cast<socklen_t>(sizeof(m_AddrIPv4))); sendto(m_MainSock, m_Data.data(), m_Data.size(), 0, reinterpret_cast<const sockaddr *>(&m_AddrIPv4), static_cast<socklen_t>(sizeof(m_AddrIPv4)));
} }
} }
@ -284,19 +284,19 @@ bool cUDPEndpointImpl::Send(const AString & a_Payload, const AString & a_Host, U
if (IsValidSocket(m_SecondarySock)) if (IsValidSocket(m_SecondarySock))
{ {
// The secondary socket, which is always IPv4, is present: // The secondary socket, which is always IPv4, is present:
NumSent = static_cast<int>(sendto(m_SecondarySock, a_Payload.data(), static_cast<socklen_t>(a_Payload.size()), 0, reinterpret_cast<const sockaddr *>(&sa), static_cast<socklen_t>(salen))); NumSent = static_cast<int>(sendto(m_SecondarySock, a_Payload.data(), a_Payload.size(), 0, reinterpret_cast<const sockaddr *>(&sa), static_cast<socklen_t>(salen)));
} }
else else
{ {
// Need to convert IPv4 to IPv6 address before sending: // Need to convert IPv4 to IPv6 address before sending:
sockaddr_in6 IPv6; sockaddr_in6 IPv6;
ConvertIPv4ToMappedIPv6(*reinterpret_cast<sockaddr_in *>(&sa), IPv6); ConvertIPv4ToMappedIPv6(*reinterpret_cast<sockaddr_in *>(&sa), IPv6);
NumSent = static_cast<int>(sendto(m_MainSock, a_Payload.data(), static_cast<socklen_t>(a_Payload.size()), 0, reinterpret_cast<const sockaddr *>(&IPv6), static_cast<socklen_t>(sizeof(IPv6)))); NumSent = static_cast<int>(sendto(m_MainSock, a_Payload.data(), a_Payload.size(), 0, reinterpret_cast<const sockaddr *>(&IPv6), static_cast<socklen_t>(sizeof(IPv6))));
} }
} }
else else
{ {
NumSent = static_cast<int>(sendto(m_MainSock, a_Payload.data(), static_cast<socklen_t>(a_Payload.size()), 0, reinterpret_cast<const sockaddr *>(&sa), static_cast<socklen_t>(salen))); NumSent = static_cast<int>(sendto(m_MainSock, a_Payload.data(), a_Payload.size(), 0, reinterpret_cast<const sockaddr *>(&sa), static_cast<socklen_t>(salen)));
} }
break; break;
} }
@ -304,7 +304,7 @@ bool cUDPEndpointImpl::Send(const AString & a_Payload, const AString & a_Host, U
case AF_INET6: case AF_INET6:
{ {
reinterpret_cast<sockaddr_in6 *>(&sa)->sin6_port = htons(a_Port); reinterpret_cast<sockaddr_in6 *>(&sa)->sin6_port = htons(a_Port);
NumSent = static_cast<int>(sendto(m_MainSock, a_Payload.data(), static_cast<socklen_t>(a_Payload.size()), 0, reinterpret_cast<const sockaddr *>(&sa), static_cast<socklen_t>(salen))); NumSent = static_cast<int>(sendto(m_MainSock, a_Payload.data(), a_Payload.size(), 0, reinterpret_cast<const sockaddr *>(&sa), static_cast<socklen_t>(salen)));
break; break;
} }
default: default:
@ -563,10 +563,9 @@ void cUDPEndpointImpl::Callback(evutil_socket_t a_Socket, short a_What)
{ {
// Receive datagram from the socket: // Receive datagram from the socket:
char buf[64 KiB]; char buf[64 KiB];
socklen_t buflen = static_cast<socklen_t>(sizeof(buf));
sockaddr_storage sa; sockaddr_storage sa;
socklen_t salen = static_cast<socklen_t>(sizeof(sa)); socklen_t salen = static_cast<socklen_t>(sizeof(sa));
auto len = recvfrom(a_Socket, buf, buflen, 0, reinterpret_cast<sockaddr *>(&sa), &salen); auto len = recvfrom(a_Socket, buf, sizeof(buf), 0, reinterpret_cast<sockaddr *>(&sa), &salen);
if (len >= 0) if (len >= 0)
{ {
// Convert the remote IP address to a string: // Convert the remote IP address to a string:

View File

@ -44,7 +44,7 @@ bool cDelayedFluidSimulatorChunkData::cSlot::Add(int a_RelX, int a_RelY, int a_R
// cDelayedFluidSimulatorChunkData: // cDelayedFluidSimulatorChunkData:
cDelayedFluidSimulatorChunkData::cDelayedFluidSimulatorChunkData(int a_TickDelay) : cDelayedFluidSimulatorChunkData::cDelayedFluidSimulatorChunkData(int a_TickDelay) :
m_Slots(new cSlot[a_TickDelay]) m_Slots(new cSlot[static_cast<size_t>(a_TickDelay)])
{ {
} }

View File

@ -1578,7 +1578,7 @@ void cSlotAreaEnchanting::UpdateResult(cPlayer & a_Player)
int Bookshelves = std::min(GetBookshelvesCount(a_Player.GetWorld()), 15); int Bookshelves = std::min(GetBookshelvesCount(a_Player.GetWorld()), 15);
cFastRandom Random; cFastRandom Random;
int Base = (Random.GenerateRandomInteger(1, 8) + static_cast<int>(floor(static_cast<float>(Bookshelves / 2)) + Random.GenerateRandomInteger(0, Bookshelves))); int Base = (Random.GenerateRandomInteger(1, 8) + static_cast<int>(floor(Bookshelves / 2) + Random.GenerateRandomInteger(0, Bookshelves)));
int TopSlot = std::max(Base / 3, 1); int TopSlot = std::max(Base / 3, 1);
int MiddleSlot = (Base * 2) / 3 + 1; int MiddleSlot = (Base * 2) / 3 + 1;
int BottomSlot = std::max(Base, Bookshelves * 2); int BottomSlot = std::max(Base, Bookshelves * 2);
@ -2566,8 +2566,8 @@ void cSlotAreaTemporary::TossItems(cPlayer & a_Player, int a_Begin, int a_End)
double vX = 0, vY = 0, vZ = 0; double vX = 0, vY = 0, vZ = 0;
EulerToVector(-a_Player.GetYaw(), a_Player.GetPitch(), vZ, vX, vY); EulerToVector(-a_Player.GetYaw(), a_Player.GetPitch(), vZ, vX, vY);
vY = -vY * 2 + 1.f; vY = -vY * 2 + 1;
a_Player.GetWorld()->SpawnItemPickups(Drops, a_Player.GetPosX(), a_Player.GetPosY() + 1.6f, a_Player.GetPosZ(), vX * 3, vY * 3, vZ * 3, true); // 'true' because player created a_Player.GetWorld()->SpawnItemPickups(Drops, a_Player.GetPosX(), a_Player.GetPosY() + 1.6, a_Player.GetPosZ(), vX * 3, vY * 3, vZ * 3, true); // 'true' because player created
} }

View File

@ -49,21 +49,21 @@ public:
inline void Normalize(void) inline void Normalize(void)
{ {
double Len = 1.0 / Length(); T Len = static_cast<T>(1.0 / Length());
x = static_cast<T>(x * Len); x = x * Len;
y = static_cast<T>(y * Len); y = y * Len;
z = static_cast<T>(z * Len); z = z * Len;
} }
inline Vector3<T> NormalizeCopy(void) const inline Vector3<T> NormalizeCopy(void) const
{ {
double Len = 1.0 / Length(); T Len = static_cast<T>(1.0 / Length());
return Vector3<T>( return Vector3<T>(
static_cast<T>(x * Len), x * Len,
static_cast<T>(y * Len), y * Len,
static_cast<T>(z * Len) z * Len
); );
} }
@ -73,12 +73,12 @@ public:
Removed from LuaAPI, because Lua doesn't need distinguishing from the other overload. */ Removed from LuaAPI, because Lua doesn't need distinguishing from the other overload. */
inline void NormalizeCopy(Vector3<T> & a_Rhs) const inline void NormalizeCopy(Vector3<T> & a_Rhs) const
{ {
double Len = 1.0 / Length(); T Len = static_cast<T>(1.0 / Length());
a_Rhs.Set( a_Rhs.Set(
static_cast<T>(x * Len), x * Len,
static_cast<T>(y * Len), y * Len,
static_cast<T>(z * Len) z * Len
); );
} }
@ -105,7 +105,7 @@ public:
inline double SqrLength(void) const inline double SqrLength(void) const
{ {
return x * x + y * y + z * z; return static_cast<double>(x * x + y * y + z * z);
} }
inline T Dot(const Vector3<T> & a_Rhs) const inline T Dot(const Vector3<T> & a_Rhs) const
@ -315,7 +315,7 @@ public:
return NO_INTERSECTION; return NO_INTERSECTION;
} }
return (a_Z - z) / (a_OtherEnd.z - z); return static_cast<double>((a_Z - z) / (a_OtherEnd.z - z));
} }
/** Returns the coefficient for the (a_OtherEnd - this) line to reach the specified Y coord. /** Returns the coefficient for the (a_OtherEnd - this) line to reach the specified Y coord.
@ -330,7 +330,7 @@ public:
return NO_INTERSECTION; return NO_INTERSECTION;
} }
return (a_Y - y) / (a_OtherEnd.y - y); return static_cast<double>((a_Y - y) / (a_OtherEnd.y - y));
} }
/** Returns the coefficient for the (a_OtherEnd - this) line to reach the specified X coord. /** Returns the coefficient for the (a_OtherEnd - this) line to reach the specified X coord.
@ -345,7 +345,7 @@ public:
return NO_INTERSECTION; return NO_INTERSECTION;
} }
return (a_X - x) / (a_OtherEnd.x - x); return static_cast<double>((a_X - x) / (a_OtherEnd.x - x));
} }
/** Rotates the vector 90 degrees clockwise around the vertical axis. /** Rotates the vector 90 degrees clockwise around the vertical axis.
@ -365,7 +365,7 @@ public:
} }
/** The max difference between two coords for which the coords are assumed equal. */ /** The max difference between two coords for which the coords are assumed equal. */
static const double EPS; static const T EPS;
/** Return value of LineCoeffToPlane() if the line is parallel to the plane. */ /** Return value of LineCoeffToPlane() if the line is parallel to the plane. */
static const double NO_INTERSECTION; static const double NO_INTERSECTION;
@ -417,7 +417,7 @@ public:
template <typename T> template <typename T>
const double Vector3<T>::EPS = 0.000001; const T Vector3<T>::EPS = static_cast<T>(0.000001);
template <typename T> template <typename T>
const double Vector3<T>::NO_INTERSECTION = 1e70; const double Vector3<T>::NO_INTERSECTION = 1e70;