cyphesis/server/ServerRouting.cpp
Al Riddoch 42787d5954 2004-05-06 Al Riddoch <alriddoch@zepler.org>
* common/BaseWorld.h, server/Connection.h, server/ServerRouting.cpp,
	  server/ServerRouting.h, server/ServerRouting_methods.h,
	  server/WorldRouter.cpp, server/WorldRouter.h:
	  Get rid of obsolete return value, from idle functions, and
	  adjust WorldRouter::idle() so it only dispatches a certain
	  number of ops at a time.

	* server/Admin.cpp: Remove debugging output for monitoring code.

	* server/ExternalMind.cpp, server/ExternalMind.h: Rename member
	  variables to fit with convention.

	* tools/cycmd.cpp: Document monitor features.
2004-05-06 23:00:53 +00:00

58 lines
1.7 KiB
C++

// This file may be redistributed and modified only under the terms of
// the GNU General Public License (See COPYING for details).
// Copyright (C) 2000,2001 Alistair Riddoch
#include "ServerRouting.h"
#include "Lobby.h"
#include "common/debug.h"
#include "common/const.h"
#include "common/BaseWorld.h"
#include <iostream>
static bool debug_flag = false;
ServerRouting::ServerRouting(BaseWorld & wrld,
const std::string & ruleset, const std::string & name) :
OOGThing(name), m_svrRuleset(ruleset), m_svrName(name), m_numClients(0),
m_world(wrld), m_lobby(*new Lobby("lobby", *this))
{
}
ServerRouting::~ServerRouting()
{
BaseDict::const_iterator I = m_objects.begin();
for(; I != m_objects.end(); I++) {
debug(std::cout << "Del " << I->second->getId() << std::endl
<< std::flush;);
delete I->second;
}
delete &m_lobby;
}
void ServerRouting::addToObject(Element::MapType & omap) const
{
omap["objtype"] = "obj";
omap["server"] = "cyphesis";
omap["ruleset"] = m_svrRuleset;
omap["name"] = m_svrName;
omap["parents"] = Element::ListType(1, "server");
omap["clients"] = m_numClients;
omap["uptime"] = m_world.upTime();
omap["builddate"] = std::string(consts::buildTime)+", "+std::string(consts::buildDate);
omap["version"] = std::string(consts::version);
if (restricted_flag) {
omap["restricted"] = "true";
}
// We could add all sorts of stats here, but I don't know exactly what yet.
}
#if defined(__GNUC__) && __GNUC__ < 3 && __GNUC_MINOR__ < 96
void ServerRouting::idle() {
world.idle();
}
#endif // defined(__GNUC__) && __GNUC_MINOR__ <= 96