Skip to content

Commit

Permalink
C4DrawTransform: Don't manually convert floats to string
Browse files Browse the repository at this point in the history
  • Loading branch information
Fulgen301 committed Aug 6, 2023
1 parent b0de1ef commit 63bb306
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions src/C4Facet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,20 +396,10 @@ void C4DrawTransform::CompileFunc(StdCompiler *pComp)
{
bool fCompiler = pComp->isCompiler();
int i;
// hacky. StdCompiler doesn't allow floats to be safed directly.
for (i = 0; i < 6; i++)
{
if (i) pComp->Separator();
StdStrBuf val; if (!fCompiler) val.Format("%g", mat[i]);
pComp->Value(mkParAdapt(val, StdCompiler::RCT_Idtf));
if (fCompiler && pComp->hasNaming())
if (pComp->Separator(StdCompiler::SEP_PART))
{
StdStrBuf val2;
pComp->Value(mkParAdapt(val2, StdCompiler::RCT_Idtf));
val.AppendChar('.'); val.Append(val2);
}
if (fCompiler) sscanf(val.getData(), "%g", &mat[i]);
pComp->Value(mat[i]);
}
pComp->Separator();
pComp->Value(FlipDir);
Expand All @@ -423,16 +413,7 @@ void C4DrawTransform::CompileFunc(StdCompiler *pComp)
}
else
{
StdStrBuf val; if (!fCompiler) val.Format("%g", mat[i]);
pComp->Value(mkParAdapt(val, StdCompiler::RCT_Idtf));
if (fCompiler && pComp->hasNaming())
if (pComp->Separator(StdCompiler::SEP_PART))
{
StdStrBuf val2;
pComp->Value(mkParAdapt(val2, StdCompiler::RCT_Idtf));
val.AppendChar('.'); val.Append(val2);
}
if (fCompiler) sscanf(val.getData(), "%g", &mat[i]);
pComp->Value(mat[i]);
}
}
}
Expand Down

0 comments on commit 63bb306

Please sign in to comment.