mirror of
https://github.com/worldforge/cyphesis
synced 2026-08-13 12:26:04 -04:00
* rulesets/BaseMind.cpp, rulesets/MemMap.h, rulesets/MemMap.cpp: Add code to flush a characters memory as its mind is deleted. * rulsets/Character.cpp: Delete movement class associated with character when character is deleted. * rulesets/EntityFactory.h, rulesets/EntityFactory.cpp: Delete all the entity factories when the server shuts down. * rulesets/PythonScript.cpp: Decrease reference of and thereby delete the python script at delete time. * server/ServerRouting.cpp: Delete all the objects in idDict, which should include all in game objects, and all explicitly out of game objects, like accounts. * server/WorldRouter.cpp: Delete all pending operations, gameWorld object. Ensure that an object is deleted from ServerRouting's idDict when it is deleted from the world. * server/CommServer.h, server/server.cpp: Added CommServer destructor which deletes all client objects and the server object. * server/server.cpp: Delete the database persistant object and the entity factory at shutdown. Al Riddoch <alriddoch@zepler.org>
53 lines
1.5 KiB
C++
53 lines
1.5 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 <Atlas/Objects/Root.h>
|
|
#include <Atlas/Objects/Operation/Login.h>
|
|
|
|
#include "ServerRouting_methods.h"
|
|
#include "CommServer.h"
|
|
#include "Account.h"
|
|
|
|
#include <common/persistance.h>
|
|
|
|
using Atlas::Message::Object;
|
|
|
|
ServerRouting::ServerRouting(CommServer & server, const string & name) :
|
|
commServer(server), svrName(name), world(*new WorldRouter(*this))
|
|
{
|
|
fullid = name;
|
|
idDict[fullid] = this;
|
|
Account * adm = Persistance::load_admin_account();
|
|
addObject(adm);
|
|
adm->world=&world;
|
|
}
|
|
|
|
ServerRouting::~ServerRouting()
|
|
{
|
|
idDict.erase(fullid);
|
|
idDict.erase(world.fullid);
|
|
dict_t::const_iterator I = idDict.begin();
|
|
for(; I != idDict.end(); I++) {
|
|
cout << "Del " << I->second->fullid << endl << flush;
|
|
delete I->second;
|
|
}
|
|
delete &world;
|
|
}
|
|
|
|
void ServerRouting::addToObject(Object & obj) const
|
|
{
|
|
Object::MapType & omap = obj.AsMap();
|
|
omap["server"] = "cyphesis";
|
|
omap["ruleset"] = 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.
|
|
}
|