Skip to content

Commit a1cd502

Browse files
committed
Addendum to 60ae4c3 (experimental fix)
The problem is that tocolor(255,255,255) returns -1.0d, but dxDrawText reads an uint, so it relies on unclean conversion from double to uint. Instead, tocolor should return (lua_Number)0xffffffff instead of (lua_Number)(int)0xffffffff Also, lua_pushinteger(l, int n) is basically lua_pushnumber(l, (lua_Number)n) so the unsigned information is just lost here. This commit might cause side effects though as there may be scripts that rely on tocolor returning -1 for 0xffffffff/white
1 parent 13f505b commit a1cd502

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

MTA10/mods/shared_logic/lua/CLuaFunctionDefs.Util.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,8 @@ int CLuaFunctionDefs::tocolor ( lua_State* luaVM )
413413
{
414414
// Make it into an unsigned long
415415
unsigned long ulColor = COLOR_RGBA ( iRed, iGreen, iBlue, iAlpha );
416-
lua_pushinteger ( luaVM, static_cast < lua_Integer > ( ulColor ) );
416+
//lua_pushinteger ( luaVM, static_cast < lua_Integer > ( ulColor ) );
417+
lua_pushnumber ( luaVM, ulColor );
417418
return 1;
418419
}
419420

0 commit comments

Comments
 (0)