@ -403,10 +403,10 @@ sint CComLuaModule::luaSaveUserComponentFile(lua_State* state)
luaL_checktype ( state , 1 , LUA_TSTRING ) ;
luaL_checktype ( state , 1 , LUA_TSTRING ) ;
luaL_checktype ( state , 2 , LUA_TNUMBER ) ;
luaL_checktype ( state , 2 , LUA_TNUMBER ) ;
std : : string filename ( lua_tostring ( state , 1 ) ) ;
std : : string filename ( lua_tostring ( state , 1 ) ) ;
double mustCompress ( lua_tonumb er( state , 2 ) ) ;
bool mustCompress ( lua_tointeg er( state , 2 ) ! = 0 ) ;
CComLuaModule * this2 = getInstance ( state ) ;
CComLuaModule * this2 = getInstance ( state ) ;
this2 - > _Client - > getEditionModule ( ) . saveUserComponentFile ( filename , mustCompress ! = 0 ) ;
this2 - > _Client - > getEditionModule ( ) . saveUserComponentFile ( filename , mustCompress ) ;
return 0 ;
return 0 ;
}
}
@ -425,7 +425,7 @@ sint CComLuaModule::luaUpdateUserComponentsInfo(lua_State* state)
std : : string filename ( lua_tostring ( state , 1 ) ) ;
std : : string filename ( lua_tostring ( state , 1 ) ) ;
std : : string name ( lua_tostring ( state , 2 ) ) ;
std : : string name ( lua_tostring ( state , 2 ) ) ;
std : : string description ( lua_tostring ( state , 3 ) ) ;
std : : string description ( lua_tostring ( state , 3 ) ) ;
uint32 timestamp ( static_cast < uint32 > ( lua_to numb er( state , 3 ) ) ) ;
uint32 timestamp ( static_cast < uint32 > ( lua_to integ er( state , 3 ) ) ) ;
std : : string md5Id ( lua_tostring ( state , 3 ) ) ;
std : : string md5Id ( lua_tostring ( state , 3 ) ) ;
CComLuaModule * this2 = getInstance ( state ) ;
CComLuaModule * this2 = getInstance ( state ) ;
@ -441,7 +441,7 @@ sint CComLuaModule::luaGetSheetIdName(lua_State* state)
CComLuaModule * this2 = getInstance ( state ) ;
CComLuaModule * this2 = getInstance ( state ) ;
nlassert ( this2 ) ;
nlassert ( this2 ) ;
uint32 sheetIdValue = static_cast < uint32 > ( lua_to numb er( state , 1 ) ) ;
uint32 sheetIdValue = static_cast < uint32 > ( lua_to integ er( state , 1 ) ) ;
NLMISC : : CSheetId sheetId ( sheetIdValue ) ;
NLMISC : : CSheetId sheetId ( sheetIdValue ) ;
if ( sheetId ! = NLMISC : : CSheetId : : Unknown )
if ( sheetId ! = NLMISC : : CSheetId : : Unknown )
@ -538,7 +538,7 @@ sint CComLuaModule::luaRequestSetWeather(lua_State* state)
{
{
//H_AUTO(R2_CComLuaModule_luaRequestSetWeather)
//H_AUTO(R2_CComLuaModule_luaRequestSetWeather)
luaL_checktype ( state , 1 , LUA_TNUMBER ) ;
luaL_checktype ( state , 1 , LUA_TNUMBER ) ;
uint16 weatherValue = ( uint16 ) lua_to numb er( state , 1 ) ;
uint16 weatherValue = ( uint16 ) lua_to integ er( state , 1 ) ;
CComLuaModule * this2 = getInstance ( state ) ;
CComLuaModule * this2 = getInstance ( state ) ;
nlassert ( this2 ) ;
nlassert ( this2 ) ;
this2 - > _Client - > getEditionModule ( ) . requestSetWeather ( weatherValue ) ;
this2 - > _Client - > getEditionModule ( ) . requestSetWeather ( weatherValue ) ;
@ -550,7 +550,7 @@ sint CComLuaModule::luaRequestSetSeason(lua_State* state)
{
{
//H_AUTO(R2_CComLuaModule_luaRequestSetSeason)
//H_AUTO(R2_CComLuaModule_luaRequestSetSeason)
luaL_checktype ( state , 1 , LUA_TNUMBER ) ;
luaL_checktype ( state , 1 , LUA_TNUMBER ) ;
uint8 season = ( uint8 ) lua_to numb er( state , 1 ) ;
uint8 season = ( uint8 ) lua_to integ er( state , 1 ) ;
CComLuaModule * this2 = getInstance ( state ) ;
CComLuaModule * this2 = getInstance ( state ) ;
nlassert ( this2 ) ;
nlassert ( this2 ) ;
this2 - > _Client - > getEditionModule ( ) . requestSetSeason ( season ) ;
this2 - > _Client - > getEditionModule ( ) . requestSetSeason ( season ) ;
@ -572,7 +572,7 @@ sint CComLuaModule::luaRequestStartAct(lua_State* state)
{
{
//H_AUTO(R2_CComLuaModule_luaRequestStartAct)
//H_AUTO(R2_CComLuaModule_luaRequestStartAct)
luaL_checktype ( state , 1 , LUA_TNUMBER ) ;
luaL_checktype ( state , 1 , LUA_TNUMBER ) ;
uint32 actId ( static_cast < uint32 > ( lua_to numb er( state , 1 ) ) ) ;
uint32 actId ( static_cast < uint32 > ( lua_to integ er( state , 1 ) ) ) ;
CComLuaModule * this2 = getInstance ( state ) ;
CComLuaModule * this2 = getInstance ( state ) ;
nlassert ( this2 ) ;
nlassert ( this2 ) ;
this2 - > _Client - > getEditionModule ( ) . requestStartAct ( actId ) ;
this2 - > _Client - > getEditionModule ( ) . requestStartAct ( actId ) ;
@ -712,7 +712,7 @@ sint CComLuaModule::luaRequestMapConnection(lua_State* state)
CHECK_LUA_ARG_COUNT ( 1 , " requestMapConnection " ) ;
CHECK_LUA_ARG_COUNT ( 1 , " requestMapConnection " ) ;
luaL_checktype ( state , 1 , LUA_TNUMBER ) ;
luaL_checktype ( state , 1 , LUA_TNUMBER ) ;
uint32 adventureId = static_cast < uint32 > ( lua_to numb er( state , 1 ) ) ;
uint32 adventureId = static_cast < uint32 > ( lua_to integ er( state , 1 ) ) ;
CComLuaModule * this2 = getInstance ( state ) ;
CComLuaModule * this2 = getInstance ( state ) ;
nlassert ( this2 ) ;
nlassert ( this2 ) ;
@ -751,7 +751,7 @@ sint CComLuaModule::requestInsertNode(lua_State* state, bool isGhost)
std : : string instanceId ( lua_tostring ( state , 1 ) ) ;
std : : string instanceId ( lua_tostring ( state , 1 ) ) ;
std : : string attrName ( lua_tostring ( state , 2 ) ) ;
std : : string attrName ( lua_tostring ( state , 2 ) ) ;
sint position ( static_cast < sint > ( lua_to numb er( state , 3 ) ) ) ;
sint position ( static_cast < sint > ( lua_to integ er( state , 3 ) ) ) ;
std : : string key ( lua_tostring ( state , 4 ) ) ;
std : : string key ( lua_tostring ( state , 4 ) ) ;
CObject * value = getObjectFromLua ( state , 5 ) ;
CObject * value = getObjectFromLua ( state , 5 ) ;
value - > setGhost ( isGhost ) ;
value - > setGhost ( isGhost ) ;
@ -837,7 +837,7 @@ sint CComLuaModule::luaRequestEraseNode(lua_State* state)
std : : string attrName ;
std : : string attrName ;
sint position = - 1 ;
sint position = - 1 ;
if ( args > 1 ) { attrName = lua_tostring ( state , 2 ) ; }
if ( args > 1 ) { attrName = lua_tostring ( state , 2 ) ; }
if ( args > 2 ) { position = static_cast < sint > ( lua_to numb er( state , 3 ) ) ; }
if ( args > 2 ) { position = static_cast < sint > ( lua_to integ er( state , 3 ) ) ; }
CComLuaModule * this2 = getInstance ( state ) ;
CComLuaModule * this2 = getInstance ( state ) ;
nlassert ( this2 ) ;
nlassert ( this2 ) ;
this2 - > _Client - > requestEraseNode ( instanceId , attrName , position ) ;
this2 - > _Client - > requestEraseNode ( instanceId , attrName , position ) ;
@ -863,11 +863,11 @@ sint CComLuaModule::luaRequestMoveNode(lua_State* state)
std : : string instanceId ( lua_tostring ( state , 1 ) ) ;
std : : string instanceId ( lua_tostring ( state , 1 ) ) ;
std : : string attrName ( lua_tostring ( state , 2 ) ) ;
std : : string attrName ( lua_tostring ( state , 2 ) ) ;
sint position = static_cast < sint > ( lua_to numb er( state , 3 ) ) ;
sint position = static_cast < sint > ( lua_to integ er( state , 3 ) ) ;
std : : string instanceId2 ( lua_tostring ( state , 4 ) ) ;
std : : string instanceId2 ( lua_tostring ( state , 4 ) ) ;
std : : string attrName2 ( lua_tostring ( state , 5 ) ) ;
std : : string attrName2 ( lua_tostring ( state , 5 ) ) ;
sint position2 = static_cast < sint > ( lua_to numb er( state , 6 ) ) ;
sint position2 = static_cast < sint > ( lua_to integ er( state , 6 ) ) ;
CComLuaModule * this2 = getInstance ( state ) ;
CComLuaModule * this2 = getInstance ( state ) ;
nlassert ( this2 ) ;
nlassert ( this2 ) ;
@ -967,7 +967,7 @@ sint CComLuaModule::luaRequestNewMultiAction(lua_State* state)
sint args = lua_gettop ( state ) ;
sint args = lua_gettop ( state ) ;
CHECK_LUA_ARG_COUNT ( 2 , funcName ) ;
CHECK_LUA_ARG_COUNT ( 2 , funcName ) ;
luaL_checktype ( state , 2 , LUA_TNUMBER ) ;
luaL_checktype ( state , 2 , LUA_TNUMBER ) ;
uint count = ( uint ) lua_to numb er( state , 2 ) ;
uint count = ( uint ) lua_to integ er( state , 2 ) ;
lua_pop ( state , 1 ) ;
lua_pop ( state , 1 ) ;
return luaRequestNewAction ( state , false , count ) ;
return luaRequestNewAction ( state , false , count ) ;
}
}
@ -979,7 +979,7 @@ sint CComLuaModule::luaRequestNewPendingMultiAction(lua_State* state)
sint args = lua_gettop ( state ) ;
sint args = lua_gettop ( state ) ;
CHECK_LUA_ARG_COUNT ( 2 , funcName ) ;
CHECK_LUA_ARG_COUNT ( 2 , funcName ) ;
luaL_checktype ( state , 2 , LUA_TNUMBER ) ;
luaL_checktype ( state , 2 , LUA_TNUMBER ) ;
uint count = ( uint ) lua_to numb er( state , 2 ) ;
uint count = ( uint ) lua_to integ er( state , 2 ) ;
lua_pop ( state , 1 ) ;
lua_pop ( state , 1 ) ;
return luaRequestNewAction ( state , true , count ) ;
return luaRequestNewAction ( state , true , count ) ;
}
}
@ -1049,6 +1049,13 @@ void CComLuaModule::setObjectToLua(lua_State* state, CObject* object)
lua_pushnil ( state ) ;
lua_pushnil ( state ) ;
return ;
return ;
}
}
if ( object - > isInteger ( ) )
{
lua_pushinteger ( state , object - > toInteger ( ) ) ;
return ;
}
if ( object - > isNumber ( ) )
if ( object - > isNumber ( ) )
{
{
lua_pushnumber ( state , object - > toNumber ( ) ) ;
lua_pushnumber ( state , object - > toNumber ( ) ) ;
@ -1226,10 +1233,21 @@ CObject* CComLuaModule::getObjectFromLua(lua_State* state, sint idx)
{
{
case LUA_TNUMBER :
case LUA_TNUMBER :
{
{
# if LUA_VERSION_NUM >= 503
if ( lua_isinteger ( state , - 1 ) ! = 0 )
{
sint64 value = lua_tointeger ( state , - 1 ) ;
lua_pop ( state , 1 ) ;
return new CObjectInteger ( value ) ;
}
else
# endif
{
double value = lua_tonumber ( state , - 1 ) ;
double value = lua_tonumber ( state , - 1 ) ;
lua_pop ( state , 1 ) ;
lua_pop ( state , 1 ) ;
return new CObjectNumber ( value ) ;
return new CObjectNumber ( value ) ;
}
}
}
break ;
break ;
case LUA_TBOOLEAN :
case LUA_TBOOLEAN :
@ -1738,8 +1756,8 @@ sint CComLuaModule::luaTriggerUserTrigger(lua_State* state)
//H_AUTO(R2_CComLuaModule_luaTriggerUserTrigger)
//H_AUTO(R2_CComLuaModule_luaTriggerUserTrigger)
CComLuaModule * this2 = getInstance ( state ) ;
CComLuaModule * this2 = getInstance ( state ) ;
nlassert ( this2 ) ;
nlassert ( this2 ) ;
uint32 actId ( static_cast < uint32 > ( lua_to numb er( state , 1 ) ) ) ;
uint32 actId ( static_cast < uint32 > ( lua_to integ er( state , 1 ) ) ) ;
uint32 id ( static_cast < uint32 > ( lua_to numb er( state , 2 ) ) ) ;
uint32 id ( static_cast < uint32 > ( lua_to integ er( state , 2 ) ) ) ;
this2 - > _Client - > getEditionModule ( ) . requestTriggerUserTrigger ( actId , id ) ;
this2 - > _Client - > getEditionModule ( ) . requestTriggerUserTrigger ( actId , id ) ;
return 0 ;
return 0 ;
@ -1869,7 +1887,7 @@ sint CComLuaModule::luaReserveIdRange(lua_State* state)
CHECK_LUA_ARG_COUNT ( 1 , " reserveIdRange " ) ;
CHECK_LUA_ARG_COUNT ( 1 , " reserveIdRange " ) ;
luaL_checktype ( state , 1 , LUA_TNUMBER ) ;
luaL_checktype ( state , 1 , LUA_TNUMBER ) ;
uint32 range = static_cast < uint32 > ( lua_to numb er( state , 1 ) ) ;
uint32 range = static_cast < uint32 > ( lua_to integ er( state , 1 ) ) ;
this2 - > _Client - > getEditionModule ( ) . reserveIdRange ( range ) ;
this2 - > _Client - > getEditionModule ( ) . reserveIdRange ( range ) ;
@ -1897,7 +1915,7 @@ sint CComLuaModule::luaRequestTpToEntryPoint(lua_State* state)
CHECK_LUA_ARG_COUNT ( 1 , " requestTpToEntryPoint " ) ;
CHECK_LUA_ARG_COUNT ( 1 , " requestTpToEntryPoint " ) ;
luaL_checktype ( state , 1 , LUA_TNUMBER ) ;
luaL_checktype ( state , 1 , LUA_TNUMBER ) ;
uint32 actIndex = static_cast < uint32 > ( lua_to numb er( state , 1 ) ) ;
uint32 actIndex = static_cast < uint32 > ( lua_to integ er( state , 1 ) ) ;
this2 - > _Client - > getEditionModule ( ) . requestTpToEntryPoint ( actIndex ) ;
this2 - > _Client - > getEditionModule ( ) . requestTpToEntryPoint ( actIndex ) ;
return 0 ;
return 0 ;
@ -1914,7 +1932,7 @@ sint CComLuaModule::luaRequestSetStartingAct(lua_State* state)
CHECK_LUA_ARG_COUNT ( 1 , " requestSetStartingAct " ) ;
CHECK_LUA_ARG_COUNT ( 1 , " requestSetStartingAct " ) ;
luaL_checktype ( state , 1 , LUA_TNUMBER ) ;
luaL_checktype ( state , 1 , LUA_TNUMBER ) ;
uint32 actIndex = static_cast < uint32 > ( lua_to numb er( state , 1 ) ) ;
uint32 actIndex = static_cast < uint32 > ( lua_to integ er( state , 1 ) ) ;
this2 - > _Client - > getEditionModule ( ) . requestSetStartingAct ( actIndex ) ;
this2 - > _Client - > getEditionModule ( ) . requestSetStartingAct ( actIndex ) ;
return 0 ;
return 0 ;
@ -1993,7 +2011,7 @@ sint CComLuaModule::luaSetDisplayInfo(lua_State* state)
std : : string formName ( lua_tostring ( state , 1 ) ) ;
std : : string formName ( lua_tostring ( state , 1 ) ) ;
bool displayInfo = static_cast < bool > ( lua_tonumber ( state , 2 ) = = 0 ) ;
bool displayInfo = lua_tointeger ( state , 2 ) ! = 0 ;
//this2->_Client->getEditionModule().reserveIdRange(range);
//this2->_Client->getEditionModule().reserveIdRange(range);
this2 - > _Client - > getEditionModule ( ) . setDisplayInfo ( formName , displayInfo ) ;
this2 - > _Client - > getEditionModule ( ) . setDisplayInfo ( formName , displayInfo ) ;
@ -2024,7 +2042,7 @@ sint CComLuaModule::luaSetStartingActIndex(lua_State* state)
sint args = lua_gettop ( state ) ;
sint args = lua_gettop ( state ) ;
CHECK_LUA_ARG_COUNT ( 1 , " setStartingActIndex " ) ;
CHECK_LUA_ARG_COUNT ( 1 , " setStartingActIndex " ) ;
luaL_checktype ( state , 1 , LUA_TNUMBER ) ;
luaL_checktype ( state , 1 , LUA_TNUMBER ) ;
this2 - > _Client - > getEditionModule ( ) . setStartingActIndex ( static_cast < uint32 > ( lua_to numb er( state , 1 ) ) ) ;
this2 - > _Client - > getEditionModule ( ) . setStartingActIndex ( static_cast < uint32 > ( lua_to integ er( state , 1 ) ) ) ;
return 0 ;
return 0 ;
}
}
@ -2229,12 +2247,12 @@ sint CComLuaModule::luaUpdateScenarioAck(lua_State* state)
{
{
std : : string key = object - > getKey ( i ) ;
std : : string key = object - > getKey ( i ) ;
CObject * value = object - > getValue ( i ) ;
CObject * value = object - > getValue ( i ) ;
if ( value - > is Numb er( ) )
if ( value - > is Integ er( ) )
{
{
if ( key . size ( ) = = 1 )
if ( key . size ( ) = = 1 )
{
{
level [ key ] = static_cast < int > ( value - > to Numb er( ) ) ;
level [ key ] = static_cast < int > ( value - > to Integ er( ) ) ;
}
}
}
}
}
}