cyphesis/server/ServerRouting.cpp
Al Riddoch a44ee6f86d * BUGS: Note that C++ version of client currently does not work.
* TODO: Update on important issues which allow easy DOS attacks.

	* client/ClientConnection.cpp, client/ClientConnection.h:
	  Cleaned up unused code from ClientConnection class.

	* client/client.cpp: Removed monitoring section of client
	  so it simply exits once the world is initialised.

	* rulesets/basic/mind/goals/humanoid/werewolf.py:
	  Started work on dynamic goals for playing werewolf.

	* rulesets/werewolf/define_world.py: Added in the mayor, who runs
	  werewolf games.

	* common/BaseEntity.h: Made id of entity private, and implemented
	  accessors.

Al Riddoch  <alriddoch@zepler.org>
2001-09-13 15:21:16 +00:00

58 lines
1.6 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 <Atlas/Message/Object.h>
#include "ServerRouting_methods.h"
#include "CommServer.h"
#include "Account.h"
#include "Lobby.h"
#include "Persistance.h"
#include <common/debug.h>
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), opSerialNo(0),
world(*new WorldRouter(*this)), lobby(*new Lobby())
{
setId(name);
idDict[getId()] = this;
Account * adm = Persistance::loadAdminAccount();
addObject(adm);
adm->world=&world;
}
ServerRouting::~ServerRouting()
{
idDict.erase(getId());
idDict.erase(world.getId());
dict_t::const_iterator I = idDict.begin();
for(; I != idDict.end(); I++) {
debug(cout << "Del " << I->second->getId() << endl << 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();
if (Persistance::restricted) {
omap["restricted"] = "true";
}
// We could add all sorts of stats here, but I don't know exactly what yet.
}