From 9faf6be1bda82fb16c497b5a3dffab05f36a8e7f Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 25 Feb 2005 01:46:10 +0000 Subject: [PATCH] hack to work around rounding error --- stepmania/src/UnlockManager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/stepmania/src/UnlockManager.cpp b/stepmania/src/UnlockManager.cpp index 8338aa239d..375af3266b 100644 --- a/stepmania/src/UnlockManager.cpp +++ b/stepmania/src/UnlockManager.cpp @@ -246,7 +246,12 @@ void UnlockManager::Load() if( cmd.GetName() == "song" ) current.m_sSongName = cmd.GetArg(1); else if( cmd.GetName() == "code" ) - current.m_iCode = cmd.GetArg(1); + { + // Hack: Lua only has a floating point type, and codes may be big enough + // that converting them from string to float to int introduces rounding + // error. Convert directly to int. + current.m_iCode = atoi( (CString) cmd.GetArg(1) ); + } else if( cmd.GetName() == "roulette" ) bRoulette = true; else