2009-11-18 01:28:45 +00:00
|
|
|
// Cyphesis Online RPG Server and AI Engine
|
|
|
|
|
// Copyright (C) 2009 Alistair Riddoch
|
|
|
|
|
//
|
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
2012-09-12 15:10:00 +01:00
|
|
|
//
|
2009-11-18 01:28:45 +00:00
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
// GNU General Public License for more details.
|
2012-09-12 15:10:00 +01:00
|
|
|
//
|
2009-11-18 01:28:45 +00:00
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
|
// along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
|
|
|
|
|
|
2011-02-15 09:30:46 +00:00
|
|
|
#ifdef NDEBUG
|
|
|
|
|
#undef NDEBUG
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef DEBUG
|
|
|
|
|
#define DEBUG
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-09-12 15:10:00 +01:00
|
|
|
#include "TestBase.h"
|
|
|
|
|
#include "TestWorld.h"
|
2012-08-01 19:42:36 +01:00
|
|
|
|
2009-11-18 01:28:45 +00:00
|
|
|
#include "server/Player.h"
|
2012-09-12 15:10:00 +01:00
|
|
|
|
2009-11-18 01:28:45 +00:00
|
|
|
#include "server/Connection.h"
|
2012-09-12 15:10:00 +01:00
|
|
|
#include "server/Ruleset.h"
|
|
|
|
|
#include "server/ServerRouting.h"
|
2009-11-18 01:28:45 +00:00
|
|
|
|
2010-09-01 14:06:37 +01:00
|
|
|
#include "rulesets/Entity.h"
|
2009-11-18 01:28:45 +00:00
|
|
|
|
2012-11-23 11:05:59 +00:00
|
|
|
#include "common/CommSocket.h"
|
2012-09-12 15:10:00 +01:00
|
|
|
#include "common/compose.hpp"
|
2012-09-13 15:14:14 +01:00
|
|
|
#include "common/debug.h"
|
2009-11-18 01:28:45 +00:00
|
|
|
|
2012-09-12 18:16:26 +01:00
|
|
|
#include <Atlas/Objects/Anonymous.h>
|
|
|
|
|
#include <Atlas/Objects/Operation.h>
|
2009-11-18 01:28:45 +00:00
|
|
|
#include <Atlas/Objects/SmartPtr.h>
|
|
|
|
|
|
|
|
|
|
#include <cassert>
|
|
|
|
|
|
2012-09-13 15:14:14 +01:00
|
|
|
using Atlas::Message::Element;
|
2012-09-12 18:16:26 +01:00
|
|
|
using Atlas::Message::ListType;
|
2009-11-18 01:28:45 +00:00
|
|
|
using Atlas::Message::MapType;
|
|
|
|
|
using Atlas::Objects::Root;
|
2012-09-12 18:16:26 +01:00
|
|
|
using Atlas::Objects::Entity::Anonymous;
|
2009-11-18 01:28:45 +00:00
|
|
|
using Atlas::Objects::Entity::RootEntity;
|
|
|
|
|
|
2012-09-12 15:10:00 +01:00
|
|
|
using String::compose;
|
|
|
|
|
|
2012-09-13 15:14:14 +01:00
|
|
|
std::ostream & operator<<(std::ostream & os,
|
|
|
|
|
const Element & e)
|
|
|
|
|
{
|
|
|
|
|
debug_dump(e, os);
|
|
|
|
|
return os;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
std::ostream & operator<<(std::ostream & os,
|
|
|
|
|
const std::list<T> & sl)
|
|
|
|
|
{
|
|
|
|
|
typename std::list<T>::const_iterator I = sl.begin();
|
|
|
|
|
typename std::list<T>::const_iterator Iend = sl.end();
|
|
|
|
|
os << "[";
|
|
|
|
|
for (; I != Iend; ++I) {
|
|
|
|
|
if (I != sl.begin()) {
|
|
|
|
|
os << ", ";
|
|
|
|
|
}
|
|
|
|
|
os << *I;
|
|
|
|
|
}
|
|
|
|
|
os << "]";
|
|
|
|
|
return os;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-12 15:10:00 +01:00
|
|
|
class Playertest : public Cyphesis::TestBase
|
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
static long m_id_counter;
|
|
|
|
|
|
|
|
|
|
ServerRouting * m_server;
|
|
|
|
|
Connection * m_connection;
|
|
|
|
|
Player * m_account;
|
2009-11-18 01:28:45 +00:00
|
|
|
public:
|
2012-09-12 15:10:00 +01:00
|
|
|
Playertest();
|
2009-11-18 01:28:45 +00:00
|
|
|
|
2012-09-12 15:10:00 +01:00
|
|
|
static long newId();
|
2009-11-18 01:28:45 +00:00
|
|
|
|
2012-09-12 15:10:00 +01:00
|
|
|
void setup();
|
|
|
|
|
void teardown();
|
|
|
|
|
|
2012-09-12 18:16:26 +01:00
|
|
|
void test_getType();
|
|
|
|
|
void test_addToMessage();
|
|
|
|
|
void test_addToEntity();
|
|
|
|
|
void test_characterError_no_name();
|
|
|
|
|
void test_characterError_admin_name();
|
|
|
|
|
void test_characterError_not_playable();
|
|
|
|
|
void test_characterError_playable();
|
|
|
|
|
|
2009-11-18 01:28:45 +00:00
|
|
|
};
|
|
|
|
|
|
2012-09-12 15:10:00 +01:00
|
|
|
long Playertest::m_id_counter = 0L;
|
|
|
|
|
|
|
|
|
|
Playertest::Playertest() : m_server(0),
|
|
|
|
|
m_connection(0),
|
|
|
|
|
m_account(0)
|
|
|
|
|
{
|
2012-09-12 18:16:26 +01:00
|
|
|
ADD_TEST(Playertest::test_getType);
|
|
|
|
|
ADD_TEST(Playertest::test_addToMessage);
|
|
|
|
|
ADD_TEST(Playertest::test_addToEntity);
|
|
|
|
|
ADD_TEST(Playertest::test_characterError_no_name);
|
|
|
|
|
ADD_TEST(Playertest::test_characterError_admin_name);
|
|
|
|
|
ADD_TEST(Playertest::test_characterError_not_playable);
|
|
|
|
|
ADD_TEST(Playertest::test_characterError_playable);
|
2012-09-12 15:10:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long Playertest::newId()
|
|
|
|
|
{
|
|
|
|
|
return ++m_id_counter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Playertest::setup()
|
|
|
|
|
{
|
|
|
|
|
Entity * gw = new Entity(compose("%1", m_id_counter),
|
|
|
|
|
m_id_counter++);
|
|
|
|
|
m_server = new ServerRouting(*new TestWorld(*gw),
|
|
|
|
|
"5529d7a4-0158-4dc1-b4a5-b5f260cac635",
|
|
|
|
|
"bad621d4-616d-4faf-b9e6-471d12b139a9",
|
|
|
|
|
compose("%1", m_id_counter), m_id_counter++,
|
|
|
|
|
compose("%1", m_id_counter), m_id_counter++);
|
|
|
|
|
m_connection = new Connection(*(CommSocket*)0, *m_server,
|
|
|
|
|
"8d18a4e8-f14f-4a46-997e-ada120d5438f",
|
|
|
|
|
compose("%1", m_id_counter), m_id_counter++);
|
|
|
|
|
m_account = new Player(m_connection,
|
|
|
|
|
"6c9f3236-5de7-4ba4-8b7a-b0222df0af38",
|
|
|
|
|
"fa1a03a2-a745-4033-85cb-bb694e921e62",
|
|
|
|
|
compose("%1", m_id_counter), m_id_counter++);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Playertest::teardown()
|
|
|
|
|
{
|
|
|
|
|
delete m_server;
|
2012-09-13 00:02:41 +01:00
|
|
|
delete m_account;
|
|
|
|
|
delete m_connection;
|
2012-09-12 15:10:00 +01:00
|
|
|
}
|
|
|
|
|
|
2012-09-12 18:16:26 +01:00
|
|
|
void Playertest::test_getType()
|
2012-09-12 15:10:00 +01:00
|
|
|
{
|
|
|
|
|
ASSERT_TRUE(m_account != 0);
|
2012-09-12 18:16:26 +01:00
|
|
|
|
|
|
|
|
const char * type = m_account->getType();
|
|
|
|
|
ASSERT_EQUAL(std::string("player"), type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Playertest::test_addToMessage()
|
|
|
|
|
{
|
2012-09-13 14:30:22 +01:00
|
|
|
Player::playableTypes.insert("settler");
|
|
|
|
|
|
2012-09-12 18:16:26 +01:00
|
|
|
MapType data;
|
|
|
|
|
|
|
|
|
|
m_account->addToMessage(data);
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(data.find("character_types") != data.end());
|
2012-09-13 15:14:14 +01:00
|
|
|
ASSERT_EQUAL(data["character_types"], ListType(1, "settler"));
|
2012-09-12 18:16:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Playertest::test_addToEntity()
|
|
|
|
|
{
|
2012-09-13 14:30:22 +01:00
|
|
|
Player::playableTypes.insert("settler");
|
|
|
|
|
|
2012-09-12 18:16:26 +01:00
|
|
|
Anonymous data;
|
|
|
|
|
|
|
|
|
|
m_account->addToEntity(data);
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(data->hasAttr("character_types"));
|
2012-09-13 15:14:14 +01:00
|
|
|
ASSERT_EQUAL(data->getAttr("character_types"), ListType(1, "settler"));
|
2012-09-12 18:16:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Playertest::test_characterError_no_name()
|
|
|
|
|
{
|
|
|
|
|
Player::playableTypes.insert("settler");
|
|
|
|
|
|
|
|
|
|
Atlas::Objects::Operation::Create op;
|
|
|
|
|
Anonymous description;
|
|
|
|
|
description->setParents(std::list<std::string>(1, "settler"));
|
|
|
|
|
OpVector res;
|
|
|
|
|
|
|
|
|
|
int result = m_account->characterError(op, description, res);
|
|
|
|
|
|
2012-12-11 08:20:35 +00:00
|
|
|
ASSERT_NOT_EQUAL(result, 0);
|
2012-09-12 18:16:26 +01:00
|
|
|
ASSERT_EQUAL(res.size(), 1u);
|
|
|
|
|
ASSERT_EQUAL(res.front()->getClassNo(),
|
|
|
|
|
Atlas::Objects::Operation::ERROR_NO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Playertest::test_characterError_admin_name()
|
|
|
|
|
{
|
|
|
|
|
Player::playableTypes.insert("settler");
|
|
|
|
|
|
|
|
|
|
Atlas::Objects::Operation::Create op;
|
|
|
|
|
Anonymous description;
|
|
|
|
|
description->setName("adminfoo");
|
|
|
|
|
description->setParents(std::list<std::string>(1, "settler"));
|
|
|
|
|
OpVector res;
|
|
|
|
|
|
|
|
|
|
int result = m_account->characterError(op, description, res);
|
|
|
|
|
|
2012-12-11 08:20:35 +00:00
|
|
|
ASSERT_NOT_EQUAL(result, 0);
|
2012-09-12 18:16:26 +01:00
|
|
|
ASSERT_EQUAL(res.size(), 1u);
|
|
|
|
|
ASSERT_EQUAL(res.front()->getClassNo(),
|
|
|
|
|
Atlas::Objects::Operation::ERROR_NO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Playertest::test_characterError_not_playable()
|
|
|
|
|
{
|
|
|
|
|
Player::playableTypes.insert("settler");
|
|
|
|
|
|
|
|
|
|
Atlas::Objects::Operation::Create op;
|
|
|
|
|
Anonymous description;
|
|
|
|
|
description->setName("dfdd84f5-4708-4b6d-b418-f825d779efc0");
|
|
|
|
|
description->setParents(std::list<std::string>(1, "goblin"));
|
|
|
|
|
OpVector res;
|
|
|
|
|
|
|
|
|
|
int result = m_account->characterError(op, description, res);
|
|
|
|
|
|
2012-12-11 08:20:35 +00:00
|
|
|
ASSERT_NOT_EQUAL(result, 0);
|
2012-09-12 18:16:26 +01:00
|
|
|
ASSERT_EQUAL(res.size(), 1u);
|
|
|
|
|
ASSERT_EQUAL(res.front()->getClassNo(),
|
|
|
|
|
Atlas::Objects::Operation::ERROR_NO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Playertest::test_characterError_playable()
|
|
|
|
|
{
|
|
|
|
|
Player::playableTypes.insert("settler");
|
|
|
|
|
|
|
|
|
|
Atlas::Objects::Operation::Create op;
|
|
|
|
|
Anonymous description;
|
|
|
|
|
description->setName("13e45264-e512-411b-9f8a-2e5cb6327c87");
|
|
|
|
|
description->setParents(std::list<std::string>(1, "settler"));
|
|
|
|
|
OpVector res;
|
|
|
|
|
|
|
|
|
|
int result = m_account->characterError(op, description, res);
|
|
|
|
|
|
|
|
|
|
ASSERT_EQUAL(result, 0);
|
|
|
|
|
ASSERT_EQUAL(res.size(), 0u);
|
2012-09-12 15:10:00 +01:00
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
void TestWorld::message(const Operation & op, LocatedEntity & ent)
|
2012-09-12 15:10:00 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
LocatedEntity * TestWorld::addNewEntity(const std::string &,
|
2012-09-12 15:10:00 +01:00
|
|
|
const Atlas::Objects::Entity::RootEntity &)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-18 01:28:45 +00:00
|
|
|
int main()
|
|
|
|
|
{
|
2012-09-12 15:10:00 +01:00
|
|
|
Ruleset::init("");
|
2009-11-18 01:28:45 +00:00
|
|
|
|
2012-09-12 15:10:00 +01:00
|
|
|
Playertest t;
|
2010-09-01 14:06:37 +01:00
|
|
|
|
2012-09-12 15:10:00 +01:00
|
|
|
return t.run();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// stubs
|
|
|
|
|
|
|
|
|
|
#include "server/Connection.h"
|
|
|
|
|
#include "server/Juncture.h"
|
|
|
|
|
#include "server/Persistence.h"
|
2013-07-26 20:14:33 +02:00
|
|
|
#include "server/PossessionAuthenticator.h"
|
2009-11-18 01:28:45 +00:00
|
|
|
|
2012-09-12 15:10:00 +01:00
|
|
|
#include "rulesets/Character.h"
|
2009-11-18 01:28:45 +00:00
|
|
|
|
2012-09-12 15:10:00 +01:00
|
|
|
#include "common/globals.h"
|
|
|
|
|
#include "common/id.h"
|
|
|
|
|
#include "common/Inheritance.h"
|
|
|
|
|
#include "common/log.h"
|
|
|
|
|
|
|
|
|
|
#include <cstdlib>
|
|
|
|
|
#include <cstdio>
|
|
|
|
|
|
2014-09-29 19:24:05 +02:00
|
|
|
#include "stubs/server/stubAccount.h"
|
|
|
|
|
#include "stubs/server/stubConnection.h"
|
2009-11-18 01:28:45 +00:00
|
|
|
|
2012-09-12 15:10:00 +01:00
|
|
|
|
2012-11-13 00:09:05 +00:00
|
|
|
ConnectableRouter::ConnectableRouter(const std::string & id,
|
2012-09-12 15:10:00 +01:00
|
|
|
long iid,
|
|
|
|
|
Connection *c) :
|
|
|
|
|
Router(id, iid),
|
|
|
|
|
m_connection(c)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-13 00:09:05 +00:00
|
|
|
ConnectableRouter::~ConnectableRouter()
|
2012-09-12 15:10:00 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ruleset::Ruleset(EntityBuilder * eb) :
|
|
|
|
|
m_taskHandler(0),
|
|
|
|
|
m_entityHandler(0),
|
2013-02-15 23:19:38 +00:00
|
|
|
m_opHandler(0),
|
2013-10-23 22:36:55 +02:00
|
|
|
m_propertyHandler(0),
|
|
|
|
|
m_archetypeHandler(0)
|
2012-09-12 15:10:00 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ruleset * Ruleset::m_instance = NULL;
|
|
|
|
|
|
|
|
|
|
void Ruleset::init(const std::string & ruleset)
|
|
|
|
|
{
|
|
|
|
|
m_instance = new Ruleset(0);
|
|
|
|
|
}
|
2009-11-18 01:28:45 +00:00
|
|
|
|
2012-09-12 15:10:00 +01:00
|
|
|
int Ruleset::modifyRule(const std::string & class_name,
|
|
|
|
|
const Root & class_desc)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2009-11-18 01:28:45 +00:00
|
|
|
|
2012-09-12 15:10:00 +01:00
|
|
|
int Ruleset::installRule(const std::string & class_name,
|
|
|
|
|
const std::string & section,
|
|
|
|
|
const Root & class_desc)
|
|
|
|
|
{
|
2009-11-18 01:28:45 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
2012-09-06 13:48:40 +01:00
|
|
|
|
2012-09-12 15:10:00 +01:00
|
|
|
Juncture::Juncture(Connection * c, const std::string & id, long iid) :
|
2012-11-13 00:09:05 +00:00
|
|
|
ConnectableRouter(id, iid, c),
|
2012-09-12 15:10:00 +01:00
|
|
|
m_address(0),
|
|
|
|
|
m_peer(0),
|
|
|
|
|
m_connectRef(0)
|
2012-09-11 22:53:15 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-12 15:10:00 +01:00
|
|
|
Juncture::~Juncture()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-04 20:39:35 +00:00
|
|
|
void Juncture::externalOperation(const Operation & op, Link &)
|
2012-11-13 23:33:23 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-12 15:10:00 +01:00
|
|
|
void Juncture::operation(const Operation & op, OpVector & res)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Juncture::addToMessage(MapType & omap) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Juncture::addToEntity(const RootEntity & ent) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ServerRouting::ServerRouting(BaseWorld & wrld,
|
|
|
|
|
const std::string & ruleset,
|
|
|
|
|
const std::string & name,
|
|
|
|
|
const std::string & id, long intId,
|
|
|
|
|
const std::string & lId, long lIntId) :
|
|
|
|
|
Router(id, intId),
|
|
|
|
|
m_svrRuleset(ruleset), m_svrName(name),
|
|
|
|
|
m_numClients(0), m_world(wrld), m_lobby(*(Lobby*)0)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ServerRouting::~ServerRouting()
|
|
|
|
|
{
|
2012-09-13 00:02:41 +01:00
|
|
|
delete &m_world;
|
2012-09-12 15:10:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerRouting::addObject(Router * obj)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Router * ServerRouting::getObject(const std::string & id) const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerRouting::addToMessage(Atlas::Message::MapType & omap) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerRouting::addToEntity(const Atlas::Objects::Entity::RootEntity & ent) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Account * ServerRouting::getAccountByName(const std::string & username)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerRouting::addAccount(Account * a)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-04 20:39:35 +00:00
|
|
|
void ServerRouting::externalOperation(const Operation & op, Link &)
|
2012-11-14 00:12:02 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerRouting::operation(const Operation &, OpVector &)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-26 20:14:33 +02:00
|
|
|
PossessionAuthenticator * PossessionAuthenticator::m_instance = NULL;
|
2012-09-12 15:10:00 +01:00
|
|
|
|
2013-07-26 20:14:33 +02:00
|
|
|
int PossessionAuthenticator::removePossession(const std::string &entity_id)
|
2012-09-12 15:10:00 +01:00
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-26 20:14:33 +02:00
|
|
|
LocatedEntity *PossessionAuthenticator::authenticatePossession(const std::string &entity_id,
|
2012-09-12 15:10:00 +01:00
|
|
|
const std::string &possess_key)
|
2012-09-06 13:48:40 +01:00
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2012-09-12 15:10:00 +01:00
|
|
|
|
|
|
|
|
Persistence * Persistence::m_instance = NULL;
|
|
|
|
|
|
|
|
|
|
Persistence::Persistence() : m_db(*(Database*)0)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Persistence * Persistence::instance()
|
|
|
|
|
{
|
|
|
|
|
if (m_instance == NULL) {
|
|
|
|
|
m_instance = new Persistence();
|
|
|
|
|
}
|
|
|
|
|
return m_instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Persistence::putAccount(const Account & ac)
|
|
|
|
|
{
|
|
|
|
|
}
|
2014-09-29 19:24:05 +02:00
|
|
|
#include "stubs/rulesets/stubCharacter.h"
|
|
|
|
|
#include "stubs/rulesets/stubThing.h"
|
|
|
|
|
#include "stubs/rulesets/stubEntity.h"
|
|
|
|
|
#include "stubs/rulesets/stubLocatedEntity.h"
|
2012-09-12 15:10:00 +01:00
|
|
|
|
|
|
|
|
Link::Link(CommSocket & socket, const std::string & id, long iid) :
|
|
|
|
|
Router(id, iid), m_encoder(0), m_commSocket(socket)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Link::~Link()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Link::send(const Operation & op) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Link::disconnect()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Inheritance * Inheritance::m_instance = NULL;
|
|
|
|
|
|
2012-09-18 08:49:50 +01:00
|
|
|
Inheritance::Inheritance() : noClass(0)
|
2012-09-12 15:10:00 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Inheritance & Inheritance::instance()
|
|
|
|
|
{
|
|
|
|
|
if (m_instance == NULL) {
|
|
|
|
|
m_instance = new Inheritance();
|
|
|
|
|
}
|
|
|
|
|
return *m_instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TypeNode * Inheritance::getType(const std::string & parent)
|
|
|
|
|
{
|
|
|
|
|
TypeNodeDict::const_iterator I = atlasObjects.find(parent);
|
|
|
|
|
if (I == atlasObjects.end()) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
return I->second;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const Root & Inheritance::getClass(const std::string & parent)
|
|
|
|
|
{
|
|
|
|
|
return noClass;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Inheritance::hasClass(const std::string & parent)
|
|
|
|
|
{
|
|
|
|
|
TypeNodeDict::const_iterator I = atlasObjects.find(parent);
|
|
|
|
|
if (I == atlasObjects.end()) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Router::Router(const std::string & id, long intId) : m_id(id),
|
|
|
|
|
m_intId(intId)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Router::~Router()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Router::addToMessage(Atlas::Message::MapType & omap) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Router::addToEntity(const Atlas::Objects::Entity::RootEntity & ent) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Router::clientError(const Operation & op,
|
|
|
|
|
const std::string & errstring,
|
|
|
|
|
OpVector & res,
|
|
|
|
|
const std::string & to) const
|
|
|
|
|
{
|
2012-09-12 18:16:26 +01:00
|
|
|
res.push_back(Atlas::Objects::Operation::Error());
|
2012-09-12 15:10:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Router::error(const Operation & op,
|
|
|
|
|
const std::string & errstring,
|
|
|
|
|
OpVector & res,
|
|
|
|
|
const std::string & to) const
|
|
|
|
|
{
|
2012-09-12 18:16:26 +01:00
|
|
|
res.push_back(Atlas::Objects::Operation::Error());
|
2012-09-12 15:10:00 +01:00
|
|
|
}
|
2014-09-29 19:24:05 +02:00
|
|
|
#include "stubs/common/stubBaseWorld.h"
|
|
|
|
|
#include "stubs/modules/stubLocation.h"
|
2012-09-12 15:10:00 +01:00
|
|
|
|
|
|
|
|
long newId(std::string & id)
|
|
|
|
|
{
|
|
|
|
|
static char buf[32];
|
|
|
|
|
long new_id = Playertest::newId();
|
|
|
|
|
sprintf(buf, "%ld", new_id);
|
|
|
|
|
id = buf;
|
|
|
|
|
assert(!id.empty());
|
|
|
|
|
return new_id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void logEvent(LogEvent lev, const std::string & msg)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void log(LogLevel lvl, const std::string & msg)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool database_flag = false;
|
|
|
|
|
|
|
|
|
|
namespace Atlas { namespace Objects { namespace Operation {
|
|
|
|
|
int MONITOR_NO = -1;
|
|
|
|
|
} } }
|
2012-10-25 10:41:44 -04:00
|
|
|
|
|
|
|
|
#include <common/Shaker.h>
|
|
|
|
|
|
|
|
|
|
Shaker::Shaker()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
std::string Shaker::generateSalt(size_t length)
|
|
|
|
|
{
|
|
|
|
|
return "";
|
|
|
|
|
}
|