Eluna implement changes from new_mthread to master ~ Does not add multithread support

This commit is contained in:
Rochet2
2014-11-30 01:37:45 +02:00
parent a7f4954fbe
commit 6268216a64
27 changed files with 3331 additions and 3000 deletions

View File

@@ -16,9 +16,9 @@ namespace LuaMap
*
* @return bool isArena
*/
int IsArena(lua_State* L, Map* map)
int IsArena(Eluna* E, Map* map)
{
Eluna::Push(L, map->IsBattleArena());
Eluna::Push(E->L, map->IsBattleArena());
return 1;
}
#endif
@@ -28,12 +28,12 @@ namespace LuaMap
*
* @return bool isBattleGround
*/
int IsBattleground(lua_State* L, Map* map)
int IsBattleground(Eluna* E, Map* map)
{
#ifndef TRINITY
Eluna::Push(L, map->IsBattleGround());
Eluna::Push(E->L, map->IsBattleGround());
#else
Eluna::Push(L, map->IsBattleground());
Eluna::Push(E->L, map->IsBattleground());
#endif
return 1;
}
@@ -43,9 +43,9 @@ namespace LuaMap
*
* @return bool isDungeon
*/
int IsDungeon(lua_State* L, Map* map)
int IsDungeon(Eluna* E, Map* map)
{
Eluna::Push(L, map->IsDungeon());
Eluna::Push(E->L, map->IsDungeon());
return 1;
}
@@ -54,9 +54,9 @@ namespace LuaMap
*
* @return bool isEmpty
*/
int IsEmpty(lua_State* L, Map* map)
int IsEmpty(Eluna* E, Map* map)
{
Eluna::Push(L, map->isEmpty());
Eluna::Push(E->L, map->isEmpty());
return 1;
}
@@ -66,9 +66,9 @@ namespace LuaMap
*
* @return bool isHeroic
*/
int IsHeroic(lua_State* L, Map* map)
int IsHeroic(Eluna* E, Map* map)
{
Eluna::Push(L, map->IsHeroic());
Eluna::Push(E->L, map->IsHeroic());
return 1;
}
#endif
@@ -78,9 +78,9 @@ namespace LuaMap
*
* @return bool isRaid
*/
int IsRaid(lua_State* L, Map* map)
int IsRaid(Eluna* E, Map* map)
{
Eluna::Push(L, map->IsRaid());
Eluna::Push(E->L, map->IsRaid());
return 1;
}
@@ -89,9 +89,9 @@ namespace LuaMap
*
* @return string mapName
*/
int GetName(lua_State* L, Map* map)
int GetName(Eluna* E, Map* map)
{
Eluna::Push(L, map->GetMapName());
Eluna::Push(E->L, map->GetMapName());
return 1;
}
@@ -102,18 +102,18 @@ namespace LuaMap
* @param float y
* @return float z
*/
int GetHeight(lua_State* L, Map* map)
int GetHeight(Eluna* E, Map* map)
{
float x = Eluna::CHECKVAL<float>(L, 2);
float y = Eluna::CHECKVAL<float>(L, 3);
float x = Eluna::CHECKVAL<float>(E->L, 2);
float y = Eluna::CHECKVAL<float>(E->L, 3);
#if (defined(TBC) || defined(CLASSIC))
float z = map->GetHeight(x, y, MAX_HEIGHT);
#else
uint32 phasemask = Eluna::CHECKVAL<uint32>(L, 4, 1);
uint32 phasemask = Eluna::CHECKVAL<uint32>(E->L, 4, 1);
float z = map->GetHeight(phasemask, x, y, MAX_HEIGHT);
#endif
if (z != INVALID_HEIGHT)
Eluna::Push(L, z);
Eluna::Push(E->L, z);
return 1;
}
@@ -122,12 +122,12 @@ namespace LuaMap
*
* @return int32 difficulty
*/
int GetDifficulty(lua_State* L, Map* map)
int GetDifficulty(Eluna* E, Map* map)
{
#ifndef CLASSIC
Eluna::Push(L, map->GetDifficulty());
Eluna::Push(E->L, map->GetDifficulty());
#else
Eluna::Push(L, (Difficulty)0);
Eluna::Push(E->L, (Difficulty)0);
#endif
return 1;
}
@@ -137,9 +137,9 @@ namespace LuaMap
*
* @return uint32 instanceId
*/
int GetInstanceId(lua_State* L, Map* map)
int GetInstanceId(Eluna* E, Map* map)
{
Eluna::Push(L, map->GetInstanceId());
Eluna::Push(E->L, map->GetInstanceId());
return 1;
}
@@ -149,9 +149,9 @@ namespace LuaMap
*
* @return uint32 playerCount
*/
int GetPlayerCount(lua_State* L, Map* map)
int GetPlayerCount(Eluna* E, Map* map)
{
Eluna::Push(L, map->GetPlayersCountExceptGMs());
Eluna::Push(E->L, map->GetPlayersCountExceptGMs());
return 1;
}
@@ -160,9 +160,9 @@ namespace LuaMap
*
* @return uint32 mapId
*/
int GetMapId(lua_State* L, Map* map)
int GetMapId(Eluna* E, Map* map)
{
Eluna::Push(L, map->GetId());
Eluna::Push(E->L, map->GetId());
return 1;
}
@@ -174,16 +174,16 @@ namespace LuaMap
* @param float z
* @return uint32 areaId
*/
int GetAreaId(lua_State* L, Map* map)
int GetAreaId(Eluna* E, Map* map)
{
float x = Eluna::CHECKVAL<float>(L, 2);
float y = Eluna::CHECKVAL<float>(L, 3);
float z = Eluna::CHECKVAL<float>(L, 4);
float x = Eluna::CHECKVAL<float>(E->L, 2);
float y = Eluna::CHECKVAL<float>(E->L, 3);
float z = Eluna::CHECKVAL<float>(E->L, 4);
#ifndef TRINITY
Eluna::Push(L, map->GetTerrain()->GetAreaId(x, y, z));
Eluna::Push(E->L, map->GetTerrain()->GetAreaId(x, y, z));
#else
Eluna::Push(L, map->GetAreaId(x, y, z));
Eluna::Push(E->L, map->GetAreaId(x, y, z));
#endif
return 1;
}
@@ -193,35 +193,35 @@ namespace LuaMap
*
* @param uint64 guid
*/
int GetWorldObject(lua_State* L, Map* map)
int GetWorldObject(Eluna* E, Map* map)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
uint64 guid = Eluna::CHECKVAL<uint64>(E->L, 2);
#ifndef TRINITY
Eluna::Push(L, map->GetWorldObject(ObjectGuid(guid)));
Eluna::Push(E->L, map->GetWorldObject(ObjectGuid(guid)));
#else
switch (GUID_HIPART(guid))
{
case HIGHGUID_PLAYER:
Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Player*)NULL));
Eluna::Push(E->L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Player*)NULL));
break;
case HIGHGUID_TRANSPORT:
case HIGHGUID_MO_TRANSPORT:
case HIGHGUID_GAMEOBJECT:
Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (GameObject*)NULL));
Eluna::Push(E->L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (GameObject*)NULL));
break;
case HIGHGUID_VEHICLE:
case HIGHGUID_UNIT:
Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Creature*)NULL));
Eluna::Push(E->L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Creature*)NULL));
break;
case HIGHGUID_PET:
Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Pet*)NULL));
Eluna::Push(E->L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Pet*)NULL));
break;
case HIGHGUID_DYNAMICOBJECT:
Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (DynamicObject*)NULL));
Eluna::Push(E->L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (DynamicObject*)NULL));
break;
case HIGHGUID_CORPSE:
Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Corpse*)NULL));
Eluna::Push(E->L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Corpse*)NULL));
break;
default:
break;