cyphesis/server/ServerRouting.cpp
Al Riddoch 13922d54da 2002-05-17 Al Riddoch <alriddoch@zepler.org>
* rulesets/Py_Operation.cpp, rulesets/Py_Operation.h: Add a variant
	  of the python Operation wrapper which handles const operations.

	* rulesets/PythonMindScript.cpp, rulesets/PythonThingScript.cpp:
	  Pass const versions of operations to the python scripts, rather
	  than having to copy them.

	* server/ServerRouting.cpp: Add build date, time and version to
	  server info.
2002-05-17 17:18:40 +00:00

62 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
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "ServerRouting_methods.h"
#include "Persistance.h"
#include "CommServer.h"
#include "Account.h"
#include "Lobby.h"
#include <common/debug.h>
#include <iostream>
static bool debug_flag = false;
using Atlas::Message::Object;
ServerRouting::ServerRouting(CommServer & server, const std::string & ruleset,
const std::string & name) :
commServer(server), svrRuleset(ruleset), svrName(name),
world(*new WorldRouter(*this)), lobby(*new Lobby(*this))
{
setId(name);
Account * adm = Persistance::loadAdminAccount();
addObject(adm);
adm->world=&world;
}
ServerRouting::~ServerRouting()
{
BaseDict::const_iterator I = objects.begin();
for(; I != objects.end(); I++) {
debug(std::cout << "Del " << I->second->getId() << std::endl
<< std::flush;);
delete I->second;
}
delete &world;
delete &lobby;
}
void ServerRouting::addToObject(Object::MapType & omap) const
{
omap["server"] = "cyphesis";
omap["ruleset"] = svrRuleset;
omap["name"] = svrName;
Object::ListType plist(1, "server");
omap["parents"] = plist;
omap["clients"] = commServer.numClients();
omap["uptime"] = world.upTime();
omap["builddate"] = std::string(__TIME__) + ", " + std::string(__DATE__);
omap["version"] = std::string(VERSION);
if (Persistance::restricted) {
omap["restricted"] = "true";
}
// We could add all sorts of stats here, but I don't know exactly what yet.
}