summaryrefslogtreecommitdiffstats
path: root/source/cWebAdmin.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-13 22:47:03 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-13 22:47:03 +0100
commit4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c (patch)
treefebea3ecd89c0d4aa83924e430bf11366d754733 /source/cWebAdmin.cpp
parentNew makefile with automatic *.cpp sourcefile import, automatic header file dependencies and switchable debug / release configuration. gnumake-specific :( (diff)
downloadcuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.tar
cuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.tar.gz
cuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.tar.bz2
cuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.tar.lz
cuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.tar.xz
cuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.tar.zst
cuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.zip
Diffstat (limited to '')
-rw-r--r--source/cWebAdmin.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/source/cWebAdmin.cpp b/source/cWebAdmin.cpp
index b33d28e16..bd762736f 100644
--- a/source/cWebAdmin.cpp
+++ b/source/cWebAdmin.cpp
@@ -27,7 +27,28 @@
-cWebAdmin * WebAdmin = 0;
+/// Helper class - appends all player names together in a HTML list
+class cPlayerAccum :
+ public cPlayerListCallback
+{
+ virtual bool Item(cPlayer * a_Player) override
+ {
+ m_Contents.append("<li>");
+ m_Contents.append(a_Player->GetName());
+ m_Contents.append("</li>");
+ return false;
+ }
+
+public:
+
+ AString m_Contents;
+} ;
+
+
+
+
+
+cWebAdmin * WebAdmin = NULL;
@@ -191,12 +212,10 @@ void cWebAdmin::Request_Handler(webserver::http_request* r)
Content += "</ul>";
Content += "<h4>Players:</h4><ul>";
- 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("<li>") + std::string( (*itr)->GetName() ) + "</li>";
- }
+ cPlayerAccum PlayerAccum;
+ cWorld * World = cRoot::Get()->GetWorld(); // TODO - Create a list of worlds and players
+ World->ForEachPlayer(&PlayerAccum);
+ Content.append(PlayerAccum.m_Contents);
Content += "</ul><br>";
}