1
0

Got rid of cWorld::GetAllPlayers() and implemented ForEachPlayer() more or less in Lua

Core now uses ForEachPlayer() to interact with connected players

git-svn-id: http://mc-server.googlecode.com/svn/trunk@260 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
faketruth
2012-02-14 19:14:23 +00:00
parent 46df5ee331
commit e7ea352f41
6 changed files with 127 additions and 87 deletions

View File

@@ -989,26 +989,6 @@ bool cWorld::ForEachPlayer(cPlayerListCallback * a_Callback)
void cWorld::GetAllPlayers( lua_State* L )
{
lua_createtable(L, m_Players.size(), 0);
int newTable = lua_gettop(L);
int index = 1;
cPlayerList::const_iterator iter = m_Players.begin();
while(iter != m_Players.end())
{
tolua_pushusertype( L, (*iter), "cPlayer" );
lua_rawseti(L, newTable, index);
++iter;
++index;
}
}
// TODO: This interface is dangerous!
cPlayer* cWorld::GetPlayer( const char* a_PlayerName )
{