Fixed some Visual Studio warnings
This commit is contained in:
parent
9329c2c2cb
commit
218010cd96
@ -979,6 +979,18 @@ void cLuaState::GetStackValue(int a_StackPos, double & a_ReturnedVal)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cLuaState::GetStackValue(int a_StackPos, eWeather & a_ReturnedVal)
|
void cLuaState::GetStackValue(int a_StackPos, eWeather & a_ReturnedVal)
|
||||||
{
|
{
|
||||||
if (!lua_isnumber(m_LuaState, a_StackPos))
|
if (!lua_isnumber(m_LuaState, a_StackPos))
|
||||||
@ -1415,7 +1427,7 @@ bool cLuaState::CheckParamFunctionOrNil(int a_StartParam, int a_EndParam)
|
|||||||
bool cLuaState::CheckParamEnd(int a_Param)
|
bool cLuaState::CheckParamEnd(int a_Param)
|
||||||
{
|
{
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
if (tolua_isnoobj(m_LuaState, a_Param, &tolua_err))
|
if (tolua_isnoobj(m_LuaState, a_Param, &tolua_err) == 1)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1437,7 +1449,7 @@ bool cLuaState::IsParamUserType(int a_Param, AString a_UserType)
|
|||||||
ASSERT(IsValid());
|
ASSERT(IsValid());
|
||||||
|
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
return tolua_isusertype(m_LuaState, a_Param, a_UserType.c_str(), 0, &tolua_err);
|
return (tolua_isusertype(m_LuaState, a_Param, a_UserType.c_str(), 0, &tolua_err) == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1449,7 +1461,7 @@ bool cLuaState::IsParamNumber(int a_Param)
|
|||||||
ASSERT(IsValid());
|
ASSERT(IsValid());
|
||||||
|
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
return tolua_isnumber(m_LuaState, a_Param, 0, &tolua_err);
|
return (tolua_isnumber(m_LuaState, a_Param, 0, &tolua_err) == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -251,6 +251,7 @@ public:
|
|||||||
void GetStackValue(int a_StackPos, bool & a_Value);
|
void GetStackValue(int a_StackPos, bool & a_Value);
|
||||||
void GetStackValue(int a_StackPos, cRef & a_Ref);
|
void GetStackValue(int a_StackPos, cRef & a_Ref);
|
||||||
void GetStackValue(int a_StackPos, double & a_Value);
|
void GetStackValue(int a_StackPos, double & a_Value);
|
||||||
|
void GetStackValue(int a_StackPos, float & a_ReturnedVal);
|
||||||
void GetStackValue(int a_StackPos, eWeather & a_Value);
|
void GetStackValue(int a_StackPos, eWeather & a_Value);
|
||||||
void GetStackValue(int a_StackPos, int & a_Value);
|
void GetStackValue(int a_StackPos, int & a_Value);
|
||||||
void GetStackValue(int a_StackPos, pBlockArea & a_Value);
|
void GetStackValue(int a_StackPos, pBlockArea & a_Value);
|
||||||
|
@ -2036,8 +2036,8 @@ static int tolua_cWorld_BroadcastParticleEffect(lua_State * tolua_S)
|
|||||||
// Read the params:
|
// Read the params:
|
||||||
cWorld * World = nullptr;
|
cWorld * World = nullptr;
|
||||||
AString Name;
|
AString Name;
|
||||||
double PosX, PosY, PosZ, OffX, OffY, OffZ;
|
float PosX, PosY, PosZ, OffX, OffY, OffZ;
|
||||||
double ParticleData;
|
float ParticleData;
|
||||||
int ParticleAmmount;
|
int ParticleAmmount;
|
||||||
L.GetStackValues(1, World, Name, PosX, PosY, PosZ, OffX, OffY, OffZ, ParticleData, ParticleAmmount);
|
L.GetStackValues(1, World, Name, PosX, PosY, PosZ, OffX, OffY, OffZ, ParticleData, ParticleAmmount);
|
||||||
if (World == nullptr)
|
if (World == nullptr)
|
||||||
|
@ -1827,7 +1827,7 @@ bool cChunk::SetSignLines(int a_PosX, int a_PosY, int a_PosZ, const AString & a_
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
MarkDirty();
|
MarkDirty();
|
||||||
(reinterpret_cast<cSignEntity *>(*itr))->SetLines(a_Line1, a_Line2, a_Line3, a_Line4);
|
reinterpret_cast<cSignEntity *>(*itr)->SetLines(a_Line1, a_Line2, a_Line3, a_Line4);
|
||||||
m_World->BroadcastBlockEntity(a_PosX, a_PosY, a_PosZ);
|
m_World->BroadcastBlockEntity(a_PosX, a_PosY, a_PosZ);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -261,11 +261,11 @@ void cMonster::MoveToWayPoint(cChunk & a_Chunk)
|
|||||||
|
|
||||||
bool cMonster::EnsureProperDestination(cChunk & a_Chunk)
|
bool cMonster::EnsureProperDestination(cChunk & a_Chunk)
|
||||||
{
|
{
|
||||||
cChunk * Chunk = a_Chunk.GetNeighborChunk(m_FinalDestination.x, m_FinalDestination.z);
|
cChunk * Chunk = a_Chunk.GetNeighborChunk(FloorC(m_FinalDestination.x), FloorC(m_FinalDestination.z));
|
||||||
BLOCKTYPE BlockType;
|
BLOCKTYPE BlockType;
|
||||||
NIBBLETYPE BlockMeta;
|
NIBBLETYPE BlockMeta;
|
||||||
int RelX = m_FinalDestination.x - Chunk->GetPosX() * cChunkDef::Width;
|
int RelX = FloorC(m_FinalDestination.x) - Chunk->GetPosX() * cChunkDef::Width;
|
||||||
int RelZ = m_FinalDestination.z - Chunk->GetPosZ() * cChunkDef::Width;
|
int RelZ = FloorC(m_FinalDestination.z) - Chunk->GetPosZ() * cChunkDef::Width;
|
||||||
if ((Chunk == nullptr) || !Chunk->IsValid())
|
if ((Chunk == nullptr) || !Chunk->IsValid())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -274,7 +274,7 @@ bool cMonster::EnsureProperDestination(cChunk & a_Chunk)
|
|||||||
// If destination in the air, go down to the lowest air block.
|
// If destination in the air, go down to the lowest air block.
|
||||||
while (m_FinalDestination.y > 0)
|
while (m_FinalDestination.y > 0)
|
||||||
{
|
{
|
||||||
Chunk->GetBlockTypeMeta(RelX, m_FinalDestination.y - 1, RelZ, BlockType, BlockMeta);
|
Chunk->GetBlockTypeMeta(RelX, FloorC(m_FinalDestination.y) - 1, RelZ, BlockType, BlockMeta);
|
||||||
if (cBlockInfo::IsSolid(BlockType))
|
if (cBlockInfo::IsSolid(BlockType))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
@ -288,7 +288,7 @@ bool cMonster::EnsureProperDestination(cChunk & a_Chunk)
|
|||||||
bool InWater = false;
|
bool InWater = false;
|
||||||
while (m_FinalDestination.y < cChunkDef::Height)
|
while (m_FinalDestination.y < cChunkDef::Height)
|
||||||
{
|
{
|
||||||
Chunk->GetBlockTypeMeta(RelX, m_FinalDestination.y, RelZ, BlockType, BlockMeta);
|
Chunk->GetBlockTypeMeta(RelX, FloorC(m_FinalDestination.y), RelZ, BlockType, BlockMeta);
|
||||||
if (BlockType == E_BLOCK_STATIONARY_WATER)
|
if (BlockType == E_BLOCK_STATIONARY_WATER)
|
||||||
{
|
{
|
||||||
InWater = true;
|
InWater = true;
|
||||||
|
@ -56,13 +56,13 @@ int cTracer::SigNum(float a_Num)
|
|||||||
{
|
{
|
||||||
if (a_Num < 0.f)
|
if (a_Num < 0.f)
|
||||||
{
|
{
|
||||||
return -1.f;
|
return -1;
|
||||||
}
|
}
|
||||||
if (a_Num > 0.f)
|
if (a_Num > 0.f)
|
||||||
{
|
{
|
||||||
return 1.f;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0.f;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,14 +80,14 @@ public:
|
|||||||
|
|
||||||
inline bool HasNonZeroLength(void) const
|
inline bool HasNonZeroLength(void) const
|
||||||
{
|
{
|
||||||
#ifndef __GNUC__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostics push
|
#pragma clang diagnostics push
|
||||||
#pragma clang diagnostics ignored "-Wfloat-equal"
|
#pragma clang diagnostics ignored "-Wfloat-equal"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ((x != 0) || (y != 0) || (z != 0));
|
return ((x != 0) || (y != 0) || (z != 0));
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostics pop
|
#pragma clang diagnostics pop
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -136,14 +136,14 @@ public:
|
|||||||
// Perform a strict comparison of the contents - we want to know whether this object is exactly equal
|
// Perform a strict comparison of the contents - we want to know whether this object is exactly equal
|
||||||
// To perform EPS-based comparison, use the EqualsEps() function
|
// To perform EPS-based comparison, use the EqualsEps() function
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostics push
|
#pragma clang diagnostics push
|
||||||
#pragma clang diagnostics ignored "-Wfloat-equal"
|
#pragma clang diagnostics ignored "-Wfloat-equal"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return !((x != a_Rhs.x) || (y != a_Rhs.y) || (z != a_Rhs.z));
|
return !((x != a_Rhs.x) || (y != a_Rhs.y) || (z != a_Rhs.z));
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostics pop
|
#pragma clang diagnostics pop
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user