void lua_pushelement ( lua_State* luaVM, CElement* pElement ) { if ( pElement ) { ElementID ID = pElement->GetID (); if ( ID != INVALID_ELEMENT_ID ) { lua_pushlightuserdata ( luaVM, (void*) reinterpret_cast<unsigned int *>(ID.Value()) ); return; } } lua_pushnil ( luaVM ); }
ElementID CElementIDs::PopClientID ( void ) { // Pop an unique ID ElementID ID; if ( m_ClientStack.Pop (ID) && ID != INVALID_ELEMENT_ID ) { // Make it at the beginning after server range ends return ID.Value() + MAX_SERVER_ELEMENTS; } // Return it return INVALID_ELEMENT_ID; }
void CLuaArgument::ReadElementID(ElementID ID) { m_strString = ""; DeleteTableData(); m_iType = LUA_TUSERDATA; m_pUserData = (void*)reinterpret_cast<unsigned int*>(ID.Value()); }
void lua_pushelement ( lua_State* luaVM, CClientEntity* pElement ) { if ( pElement ) { if ( pElement->IsBeingDeleted ( ) ) { lua_pushboolean ( luaVM, false ); return; } ElementID ID = pElement->GetID (); if ( ID != INVALID_ELEMENT_ID ) { const char* szClass = NULL; CLuaMain* pLuaMain = g_pClientGame->GetLuaManager ()->GetVirtualMachine ( luaVM ); if ( pLuaMain->IsOOPEnabled () ) szClass = CLuaClassDefs::GetEntityClass ( pElement ); lua_pushobject ( luaVM, szClass, ( void* ) reinterpret_cast < unsigned int * > ( ID.Value () ) ); return; } } lua_pushnil ( luaVM ); }
void CElementIDs::SetElement ( ElementID ID, CClientEntity* pEntity ) { if ( ID < MAX_SERVER_ELEMENTS + MAX_CLIENT_ELEMENTS ) m_Elements [ID.Value()] = pEntity; #ifdef MTA_DEBUG else assert ( 0 ); #endif }
void lua_pushelement ( lua_State* luaVM, CElement* pElement ) { if ( pElement ) { ElementID ID = pElement->GetID (); if ( ID != INVALID_ELEMENT_ID ) { #pragma message( "Assigned to: lil_Toady" ) #if REMOVE_WHEN_FIXED lua_pushuserdata ( luaVM, "Element", (void*) reinterpret_cast<unsigned int *>(ID.Value()) ); #else lua_pushlightuserdata ( luaVM, (void*) reinterpret_cast<unsigned int *>(ID.Value()) ); #endif return; } } lua_pushnil ( luaVM ); }
void CElementIDs::PushClientID ( ElementID ID ) { // Not invalid? if ( ID != INVALID_ELEMENT_ID ) { // It's in the server element ID range, put it down to client ID = ID.Value () - MAX_SERVER_ELEMENTS; m_ClientStack.Push ( ID ); } }