diff --git a/Plugins/Core.lua b/Plugins/Core.lua
index cd87182bf..65ab3b534 100644
--- a/Plugins/Core.lua
+++ b/Plugins/Core.lua
@@ -572,15 +572,33 @@ end
function PlayerListWeb:HandleRequest( Request )
local World = cRoot:Get():GetWorld()
local Content = ""
- Content = Content .. "
Connected Players: " .. World:GetNumPlayers() .. "
"
- Content = Content .. "
Could not find player " .. KickPlayerName .. " !
" + elseif( Player:GetName() == KickPlayerName ) then + Player:GetClientHandle():Kick("You were kicked from the game!") + Content = Content .. "" .. KickPlayerName .. " has been kicked from the game!
" + end + end + + Content = Content .. "Connected Players: " .. World:GetNumPlayers() .. "
" + Content = Content .. "" .. i .. ". | " + Content = Content .. "" .. Player:GetName() .. " | " + Content = Content .. "Kick | " + Content = Content .. "
Reloading plugins...
" cRoot:Get():GetPluginManager():ReloadPlugins() else - Content = Content .. "Whitelist is currently disabled! Click here to enable.
" + end + + Content = Content .. "" .. PlayerName .. " | " .. HTMLDeleteButton( PlayerName ) .. " |
" .. PlayerName .. " | " .. HTMLDeleteButton( PlayerName ) .. " |
None |
Whitelist is currently enabled, click here to disable.
" + end + return Content end diff --git a/iniFile/iniFile.h b/iniFile/iniFile.h index c23c0369f..d0d34e145 100644 --- a/iniFile/iniFile.h +++ b/iniFile/iniFile.h @@ -45,7 +45,7 @@ private: std::string CheckCase( std::string s) const; public: - enum errors{ noID = -1}; + enum errors{ noID = -1}; //tolua_export cIniFile( const std::string iniPath = ""); //tolua_export virtual ~cIniFile() {} diff --git a/source/Bindings.cpp b/source/Bindings.cpp index 8b0724d9f..930ed4e45 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 01/01/12 19:41:18. +** Generated automatically by tolua++-1.0.92 on 01/22/12 20:44:42. */ #ifndef __cplusplus @@ -12820,6 +12820,40 @@ static int tolua_AllToLua_Vector3d_Cross00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: Equals of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_Equals00 +static int tolua_AllToLua_Vector3d_Equals00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); + const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Equals'", NULL); +#endif + { + bool tolua_ret = (bool) self->Equals(*v); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Equals'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* method: operator+ of class Vector3d */ #ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d__add00 static int tolua_AllToLua_Vector3d__add00(lua_State* tolua_S) @@ -14628,6 +14662,36 @@ static int tolua_set_cPacket_Login_m_MapSeed(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* get function: m_LevelType of class cPacket_Login */ +#ifndef TOLUA_DISABLE_tolua_get_cPacket_Login_m_LevelType +static int tolua_get_cPacket_Login_m_LevelType(lua_State* tolua_S) +{ + cPacket_Login* self = (cPacket_Login*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_LevelType'",NULL); +#endif + tolua_pushcppstring(tolua_S,(const char*)self->m_LevelType); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: m_LevelType of class cPacket_Login */ +#ifndef TOLUA_DISABLE_tolua_set_cPacket_Login_m_LevelType +static int tolua_set_cPacket_Login_m_LevelType(lua_State* tolua_S) +{ + cPacket_Login* self = (cPacket_Login*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_LevelType'",NULL); + if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->m_LevelType = ((std::string) tolua_tocppstring(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + /* get function: m_ServerMode of class cPacket_Login */ #ifndef TOLUA_DISABLE_tolua_get_cPacket_Login_m_ServerMode static int tolua_get_cPacket_Login_m_ServerMode(lua_State* tolua_S) @@ -15407,6 +15471,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_cclass(tolua_S,"cIniFile","cIniFile","",NULL); #endif tolua_beginmodule(tolua_S,"cIniFile"); + tolua_constant(tolua_S,"noID",cIniFile::noID); tolua_function(tolua_S,"new",tolua_AllToLua_cIniFile_new00); tolua_function(tolua_S,"new_local",tolua_AllToLua_cIniFile_new00_local); tolua_function(tolua_S,".call",tolua_AllToLua_cIniFile_new00_local); @@ -16375,6 +16440,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"SqrLength",tolua_AllToLua_Vector3d_SqrLength00); tolua_function(tolua_S,"Dot",tolua_AllToLua_Vector3d_Dot00); tolua_function(tolua_S,"Cross",tolua_AllToLua_Vector3d_Cross00); + tolua_function(tolua_S,"Equals",tolua_AllToLua_Vector3d_Equals00); tolua_function(tolua_S,".add",tolua_AllToLua_Vector3d__add00); tolua_function(tolua_S,".add",tolua_AllToLua_Vector3d__add01); tolua_function(tolua_S,".sub",tolua_AllToLua_Vector3d__sub00); @@ -16474,6 +16540,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_variable(tolua_S,"m_ProtocolVersion",tolua_get_cPacket_Login_m_ProtocolVersion,tolua_set_cPacket_Login_m_ProtocolVersion); tolua_variable(tolua_S,"m_Username",tolua_get_cPacket_Login_m_Username,tolua_set_cPacket_Login_m_Username); tolua_variable(tolua_S,"m_MapSeed",tolua_get_cPacket_Login_m_MapSeed,tolua_set_cPacket_Login_m_MapSeed); + tolua_variable(tolua_S,"m_LevelType",tolua_get_cPacket_Login_m_LevelType,tolua_set_cPacket_Login_m_LevelType); tolua_variable(tolua_S,"m_ServerMode",tolua_get_cPacket_Login_m_ServerMode,tolua_set_cPacket_Login_m_ServerMode); tolua_variable(tolua_S,"m_Dimension",tolua_get_cPacket_Login_m_Dimension,tolua_set_cPacket_Login_m_Dimension); tolua_variable(tolua_S,"m_Difficulty",tolua_get_cPacket_Login_m_Difficulty,tolua_set_cPacket_Login_m_Difficulty); diff --git a/source/Bindings.h b/source/Bindings.h index 3a43ccb32..7f80ee6a0 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 01/01/12 19:41:18. +** Generated automatically by tolua++-1.0.92 on 01/22/12 20:44:42. */ /* Exported function */ diff --git a/source/cServer.cpp b/source/cServer.cpp index 8d4f9ea16..326bbf9ce 100644 --- a/source/cServer.cpp +++ b/source/cServer.cpp @@ -278,11 +278,9 @@ void cServer::StartListenClient() bool cServer::Tick(float a_Dt) { - //LOG("1. Tick"); + //LOG("1. Tick %0.2f", a_Dt); if( a_Dt > 100.f ) a_Dt = 100.f; // Don't go over 1/10 second - cSleep::MilliSleep( 50 ); // Don't tick too much - m_Millisecondsf += a_Dt; if( m_Millisecondsf > 1.f ) { @@ -331,6 +329,7 @@ void ServerTickThread( void * a_Param ) cTimer Timer; + long long msPerTick = 50; // TODO - Put this in server config file long long LastTime = Timer.GetNowTime(); bool bKeepGoing = true; @@ -339,6 +338,13 @@ void ServerTickThread( void * a_Param ) long long NowTime = Timer.GetNowTime(); float DeltaTime = (float)(NowTime-LastTime); bKeepGoing = CServerObj->Tick( DeltaTime ); + long long TickTime = Timer.GetNowTime() - NowTime; + + if( TickTime < msPerTick ) // Stretch tick time until it's at least msPerTick + { + cSleep::MilliSleep( (unsigned int)( msPerTick - TickTime ) ); + } + LastTime = NowTime; } diff --git a/source/cWebAdmin.cpp b/source/cWebAdmin.cpp index bc22a4681..86dbf5990 100644 --- a/source/cWebAdmin.cpp +++ b/source/cWebAdmin.cpp @@ -99,28 +99,7 @@ void cWebAdmin::Request_Handler(webserver::http_request* r) std::string Menu; std::string Content; std::string Template = WebAdmin->GetTemplate(); - - Content += "" + std::string( cRoot::Get()->GetServer()->GetServerID() ) + "
"; - - Content += "";
- cPluginManager* PM = cRoot::Get()->GetPluginManager();
- const cPluginManager::PluginList & List = PM->GetAllPlugins();
- for( cPluginManager::PluginList::const_iterator itr = List.begin(); itr != List.end(); ++itr )
- {
- Content += std::string( (*itr)->GetName() ) + "
";
- }
- Content += "
";
-
- cWorld* World = cRoot::Get()->GetWorld(); // TODO - Create a list of worlds and players
- cWorld::PlayerList PlayerList = World->GetAllPlayers();
- for( cWorld::PlayerList::iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr )
- {
- Content += std::string( (*itr)->GetName() ) + "
";
- }
- Content += "
" + Content + "
"; - } } delete Request.Params; + if( FoundPlugin.empty() ) // Default page + { + Content.clear(); + FoundPlugin = "Current Game"; + Content += "" + std::string( cRoot::Get()->GetServer()->GetServerID() ) + "
"; + + Content += "