mirror of
https://github.com/worldforge/cyphesis
synced 2026-08-13 12:26:04 -04:00
* rulesets/Line.h, rulesets/Line.cpp, rulesets/Area.h, rulesets/Area.cpp, server/EntityFactory.cpp: Added stub base classes for new geometric entities. * server/ServerRouting.cpp, server/Lobby.h, server/Lobby.cpp, server/Connection.cpp: Fleshed out lobby functionality, so that accounts/connections are no longer responsible for managing their own appearance and disappearance. * server/Account.cpp: Send info of logout.
59 lines
1.6 KiB
C++
59 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 "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);
|
|
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(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();
|
|
if (Persistance::restricted) {
|
|
omap["restricted"] = "true";
|
|
}
|
|
|
|
// We could add all sorts of stats here, but I don't know exactly what yet.
|
|
}
|