- silence float truncation warnings for explicit casts.

This commit is contained in:
Christoph Oelckers 2021-05-21 21:06:48 +02:00
parent 4739c71b39
commit 16c6e2db05

View file

@ -932,7 +932,7 @@ FxExpression *FxIntCast::Resolve(FCompileContext &ctx)
{ {
ExpVal constval = static_cast<FxConstant *>(basex)->GetValue(); ExpVal constval = static_cast<FxConstant *>(basex)->GetValue();
FxExpression *x = new FxConstant(constval.GetInt(), ScriptPosition); FxExpression *x = new FxConstant(constval.GetInt(), ScriptPosition);
if (constval.GetInt() != constval.GetFloat()) if (constval.GetInt() != constval.GetFloat() && !Explicit)
{ {
ScriptPosition.Message(MSG_WARNING, "Truncation of floating point constant %f", constval.GetFloat()); ScriptPosition.Message(MSG_WARNING, "Truncation of floating point constant %f", constval.GetFloat());
} }