@@ -60,14 +60,14 @@ int CLuaBlipDefs::CreateBlip(lua_State* luaVM)
6060{
6161 CVector vecPosition;
6262 unsigned char ucIcon = 0 ;
63- unsigned char ucSize = 2 ;
63+ int iSize = 2 ;
6464 SColorRGBA color (255 , 0 , 0 , 255 );
6565 int iOrdering = 0 ;
6666 int iVisibleDistance = 16383 ;
6767 CScriptArgReader argStream (luaVM);
6868 argStream.ReadVector3D (vecPosition);
6969 argStream.ReadNumber (ucIcon, 0 );
70- argStream.ReadNumber (ucSize , 2 );
70+ argStream.ReadNumber (iSize , 2 );
7171 argStream.ReadNumber (color.R , 255 );
7272 argStream.ReadNumber (color.G , 0 );
7373 argStream.ReadNumber (color.B , 0 );
@@ -88,6 +88,7 @@ int CLuaBlipDefs::CreateBlip(lua_State* luaVM)
8888 CResource* pResource = pLuaMain->GetResource ();
8989 if (pResource)
9090 {
91+ unsigned char ucSize = Clamp (0 , iSize, 25 );
9192 short sOrdering = Clamp (-32768 , iOrdering, 32767 );
9293 unsigned short usVisibleDistance = Clamp (0 , iVisibleDistance, 65535 );
9394
@@ -120,14 +121,14 @@ int CLuaBlipDefs::CreateBlipAttachedTo(lua_State* luaVM)
120121 CClientEntity* pEntity = NULL ;
121122 // Default colors and size
122123 unsigned char ucIcon = 0 ;
123- unsigned char ucSize = 2 ;
124+ int iSize = 2 ;
124125 SColorRGBA color (255 , 0 , 0 , 255 );
125126 int iOrdering = 0 ;
126127 int iVisibleDistance = 16383 ;
127128 CScriptArgReader argStream (luaVM);
128129 argStream.ReadUserData (pEntity);
129130 argStream.ReadNumber (ucIcon, 0 );
130- argStream.ReadNumber (ucSize , 2 );
131+ argStream.ReadNumber (iSize , 2 );
131132 argStream.ReadNumber (color.R , 255 );
132133 argStream.ReadNumber (color.G , 0 );
133134 argStream.ReadNumber (color.B , 0 );
@@ -148,6 +149,7 @@ int CLuaBlipDefs::CreateBlipAttachedTo(lua_State* luaVM)
148149 CResource* pResource = pLuaMain->GetResource ();
149150 if (pResource)
150151 {
152+ unsigned char ucSize = Clamp (0 , iSize, 25 );
151153 short sOrdering = Clamp (-32768 , iOrdering, 32767 );
152154 unsigned short usVisibleDistance = Clamp (0 , iVisibleDistance, 65535 );
153155
@@ -303,13 +305,15 @@ int CLuaBlipDefs::SetBlipIcon(lua_State* luaVM)
303305int CLuaBlipDefs::SetBlipSize (lua_State* luaVM)
304306{
305307 CClientEntity* pEntity = NULL ;
306- unsigned char ucSize = 0 ;
308+ int iSize = 0 ;
307309 CScriptArgReader argStream (luaVM);
308310 argStream.ReadUserData (pEntity);
309- argStream.ReadNumber (ucSize );
311+ argStream.ReadNumber (iSize );
310312
311313 if (!argStream.HasErrors ())
312314 {
315+ unsigned char ucSize = Clamp (0 , iSize, 25 );
316+
313317 if (CStaticFunctionDefinitions::SetBlipSize (*pEntity, ucSize))
314318 {
315319 lua_pushboolean (luaVM, true );
0 commit comments