summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Bindings/LuaState.cpp14
-rw-r--r--src/Bindings/LuaState.h1
-rw-r--r--src/BlockEntities/MobSpawnerEntity.cpp2
-rw-r--r--src/Blocks/BlockChest.h6
-rw-r--r--src/Blocks/BlockEnderchest.h6
-rw-r--r--src/Blocks/BlockHandler.cpp2
-rw-r--r--src/Blocks/BlockSnow.h2
-rw-r--r--src/CraftingRecipes.cpp8
-rw-r--r--src/Generating/CompoGen.cpp4
-rw-r--r--src/Items/ItemFood.h2
-rw-r--r--src/Items/ItemHandler.cpp4
-rw-r--r--src/Items/ItemMobHead.h2
-rw-r--r--src/Noise/Noise.h2
-rw-r--r--src/Noise/OctavedNoise.h4
-rw-r--r--src/OSSupport/UDPEndpointImpl.cpp19
-rw-r--r--src/Simulator/DelayedFluidSimulator.cpp2
-rw-r--r--src/UI/SlotArea.cpp6
-rw-r--r--src/Vector3.h36
18 files changed, 67 insertions, 55 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index 50ce04f7c..2f01d2d4f 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -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)
{
ASSERT(IsValid());
@@ -1385,7 +1397,7 @@ bool cLuaState::GetStackValue(int a_StackPos, float & a_ReturnedVal)
{
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 false;
diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h
index 9c97e96d4..67e6dade5 100644
--- a/src/Bindings/LuaState.h
+++ b/src/Bindings/LuaState.h
@@ -589,6 +589,7 @@ public:
void Push(cLuaTCPLink * a_TCPLink);
void Push(cLuaUDPEndpoint * a_UDPEndpoint);
void Push(double a_Value);
+ void Push(float a_Value);
void Push(int a_Value);
void Push(long a_Value);
void Push(const UInt32 a_Value);
diff --git a/src/BlockEntities/MobSpawnerEntity.cpp b/src/BlockEntities/MobSpawnerEntity.cpp
index 7f1b88c9b..6a5b79e42 100644
--- a/src/BlockEntities/MobSpawnerEntity.cpp
+++ b/src/BlockEntities/MobSpawnerEntity.cpp
@@ -170,7 +170,7 @@ void cMobSpawnerEntity::SpawnEntity(void)
}
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)
{
EntitiesSpawned = true;
diff --git a/src/Blocks/BlockChest.h b/src/Blocks/BlockChest.h
index 2c34beeeb..70bb05889 100644
--- a/src/Blocks/BlockChest.h
+++ b/src/Blocks/BlockChest.h
@@ -142,11 +142,11 @@ public:
{
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;
}
diff --git a/src/Blocks/BlockEnderchest.h b/src/Blocks/BlockEnderchest.h
index b5f015ff4..73eebc367 100644
--- a/src/Blocks/BlockEnderchest.h
+++ b/src/Blocks/BlockEnderchest.h
@@ -38,11 +38,11 @@ public:
{
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;
}
diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp
index be254900d..5221ebdab 100644
--- a/src/Blocks/BlockHandler.cpp
+++ b/src/Blocks/BlockHandler.cpp
@@ -583,7 +583,7 @@ bool cBlockHandler::DoesDropOnUnsuitable(void)
/* 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)
{
- return a_Position.y < cBlockInfo::GetBlockHeight(a_BlockType);
+ return a_Position.y < static_cast<double>(cBlockInfo::GetBlockHeight(a_BlockType));
}
diff --git a/src/Blocks/BlockSnow.h b/src/Blocks/BlockSnow.h
index d11c444b9..730fad8a8 100644
--- a/src/Blocks/BlockSnow.h
+++ b/src/Blocks/BlockSnow.h
@@ -91,7 +91,7 @@ public:
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));
}
} ;
diff --git a/src/CraftingRecipes.cpp b/src/CraftingRecipes.cpp
index 3aa9074e2..a3f50865a 100644
--- a/src/CraftingRecipes.cpp
+++ b/src/CraftingRecipes.cpp
@@ -18,7 +18,7 @@
cCraftingGrid::cCraftingGrid(int a_Width, int a_Height) :
m_Width(a_Width),
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) :
m_Width(a_Width),
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--)
{
@@ -44,7 +44,7 @@ cCraftingGrid::cCraftingGrid(const cItem * a_Items, int a_Width, int a_Height) :
cCraftingGrid::cCraftingGrid(const cCraftingGrid & a_Original) :
m_Width(a_Original.m_Width),
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--)
{
@@ -201,7 +201,7 @@ void cCraftingGrid::Dump(void)
for (int y = 0; y < m_Height; y++) for (int x = 0; x < m_Width; x++)
{
#ifdef _DEBUG
- int idx = x + m_Width * y;
+ int idx = x + m_Width * y;
#endif
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
diff --git a/src/Generating/CompoGen.cpp b/src/Generating/CompoGen.cpp
index 6352949fa..bd654cee6 100644
--- a/src/Generating/CompoGen.cpp
+++ b/src/Generating/CompoGen.cpp
@@ -341,8 +341,8 @@ void cCompoGenNether::InitializeCompoGen(cIniFile & a_IniFile)
cCompoGenCache::cCompoGenCache(cTerrainCompositionGenPtr a_Underlying, int a_CacheSize) :
m_Underlying(a_Underlying),
m_CacheSize(a_CacheSize),
- m_CacheOrder(new int[a_CacheSize]),
- m_CacheData(new sCacheData[a_CacheSize]),
+ m_CacheOrder(new int[static_cast<size_t>(a_CacheSize)]),
+ m_CacheData(new sCacheData[static_cast<size_t>(a_CacheSize)]),
m_NumHits(0),
m_NumMisses(0),
m_TotalChain(0)
diff --git a/src/Items/ItemFood.h b/src/Items/ItemFood.h
index cfdac26c6..5111d4087 100644
--- a/src/Items/ItemFood.h
+++ b/src/Items/ItemFood.h
@@ -59,7 +59,7 @@ public:
case E_ITEM_STEAK: return FoodInfo(8, 12.8);
}
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
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index 6984b6111..5c2721381 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -842,7 +842,7 @@ bool cItemHandler::EatItem(cPlayer * a_Player, cItem * a_Item)
}
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);
@@ -856,7 +856,7 @@ bool cItemHandler::EatItem(cPlayer * a_Player, cItem * a_Item)
cFastRandom r1;
if (r1.NextFloat() < Chance)
{
- a_Player->AddEntityEffect(EffectType, EffectDurationTicks, EffectIntensity, Chance);
+ a_Player->AddEntityEffect(EffectType, EffectDurationTicks, EffectIntensity, static_cast<double>(Chance));
}
}
return Success;
diff --git a/src/Items/ItemMobHead.h b/src/Items/ItemMobHead.h
index fdecabbbf..9af4cb14d 100644
--- a/src/Items/ItemMobHead.h
+++ b/src/Items/ItemMobHead.h
@@ -80,7 +80,7 @@ public:
int Rotation = 0;
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);
diff --git a/src/Noise/Noise.h b/src/Noise/Noise.h
index 03f61643d..d4c56492e 100644
--- a/src/Noise/Noise.h
+++ b/src/Noise/Noise.h
@@ -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)
{
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;
}
diff --git a/src/Noise/OctavedNoise.h b/src/Noise/OctavedNoise.h
index 6dd79365f..0b1a25549 100644
--- a/src/Noise/OctavedNoise.h
+++ b/src/Noise/OctavedNoise.h
@@ -61,7 +61,7 @@ public:
std::unique_ptr<NOISE_DATATYPE[]> workspaceHeap;
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();
}
@@ -121,7 +121,7 @@ public:
std::unique_ptr<NOISE_DATATYPE[]> workspaceHeap;
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();
}
diff --git a/src/OSSupport/UDPEndpointImpl.cpp b/src/OSSupport/UDPEndpointImpl.cpp
index 68117e5a0..e43e739b4 100644
--- a/src/OSSupport/UDPEndpointImpl.cpp
+++ b/src/OSSupport/UDPEndpointImpl.cpp
@@ -134,20 +134,20 @@ protected:
{
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)
{
// If the secondary socket is valid, it is an IPv4 socket, so use that:
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
{
// Need an address conversion from IPv4 to IPv6-mapped-IPv4:
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
@@ -164,7 +164,7 @@ protected:
LOGD("UDP endpoint queued sendto: Name not resolved to IPv4 for an IPv4-only socket");
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))
{
// 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
{
// Need to convert IPv4 to IPv6 address before sending:
sockaddr_in6 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
{
- 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;
}
@@ -304,7 +304,7 @@ bool cUDPEndpointImpl::Send(const AString & a_Payload, const AString & a_Host, U
case AF_INET6:
{
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;
}
default:
@@ -563,10 +563,9 @@ void cUDPEndpointImpl::Callback(evutil_socket_t a_Socket, short a_What)
{
// Receive datagram from the socket:
char buf[64 KiB];
- socklen_t buflen = static_cast<socklen_t>(sizeof(buf));
sockaddr_storage 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)
{
// Convert the remote IP address to a string:
diff --git a/src/Simulator/DelayedFluidSimulator.cpp b/src/Simulator/DelayedFluidSimulator.cpp
index d21e8dc6d..1ad7d5f40 100644
--- a/src/Simulator/DelayedFluidSimulator.cpp
+++ b/src/Simulator/DelayedFluidSimulator.cpp
@@ -44,7 +44,7 @@ bool cDelayedFluidSimulatorChunkData::cSlot::Add(int a_RelX, int a_RelY, int a_R
// cDelayedFluidSimulatorChunkData:
cDelayedFluidSimulatorChunkData::cDelayedFluidSimulatorChunkData(int a_TickDelay) :
- m_Slots(new cSlot[a_TickDelay])
+ m_Slots(new cSlot[static_cast<size_t>(a_TickDelay)])
{
}
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index 8878bb900..f644358a6 100644
--- a/src/UI/SlotArea.cpp
+++ b/src/UI/SlotArea.cpp
@@ -1578,7 +1578,7 @@ void cSlotAreaEnchanting::UpdateResult(cPlayer & a_Player)
int Bookshelves = std::min(GetBookshelvesCount(a_Player.GetWorld()), 15);
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 MiddleSlot = (Base * 2) / 3 + 1;
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;
EulerToVector(-a_Player.GetYaw(), a_Player.GetPitch(), vZ, vX, vY);
- vY = -vY * 2 + 1.f;
- 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
+ vY = -vY * 2 + 1;
+ 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
}
diff --git a/src/Vector3.h b/src/Vector3.h
index 8c8dc6ad4..20d1fc12f 100644
--- a/src/Vector3.h
+++ b/src/Vector3.h
@@ -49,21 +49,21 @@ public:
inline void Normalize(void)
{
- double Len = 1.0 / Length();
+ T Len = static_cast<T>(1.0 / Length());
- x = static_cast<T>(x * Len);
- y = static_cast<T>(y * Len);
- z = static_cast<T>(z * Len);
+ x = x * Len;
+ y = y * Len;
+ z = z * Len;
}
inline Vector3<T> NormalizeCopy(void) const
{
- double Len = 1.0 / Length();
+ T Len = static_cast<T>(1.0 / Length());
return Vector3<T>(
- static_cast<T>(x * Len),
- static_cast<T>(y * Len),
- static_cast<T>(z * Len)
+ x * Len,
+ y * Len,
+ z * Len
);
}
@@ -73,12 +73,12 @@ public:
Removed from LuaAPI, because Lua doesn't need distinguishing from the other overload. */
inline void NormalizeCopy(Vector3<T> & a_Rhs) const
{
- double Len = 1.0 / Length();
+ T Len = static_cast<T>(1.0 / Length());
a_Rhs.Set(
- static_cast<T>(x * Len),
- static_cast<T>(y * Len),
- static_cast<T>(z * Len)
+ x * Len,
+ y * Len,
+ z * Len
);
}
@@ -105,7 +105,7 @@ public:
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
@@ -315,7 +315,7 @@ public:
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.
@@ -330,7 +330,7 @@ public:
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.
@@ -345,7 +345,7 @@ public:
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.
@@ -365,7 +365,7 @@ public:
}
/** 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. */
static const double NO_INTERSECTION;
@@ -417,7 +417,7 @@ public:
template <typename T>
-const double Vector3<T>::EPS = 0.000001;
+const T Vector3<T>::EPS = static_cast<T>(0.000001);
template <typename T>
const double Vector3<T>::NO_INTERSECTION = 1e70;