cyphesis/tests/BaseClienttest.cpp

377 lines
6.8 KiB
C++
Raw Permalink Normal View History

2010-11-18 16:42:57 +00:00
// Cyphesis Online RPG Server and AI Engine
// Copyright (C) 2010 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.
//
// 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.
//
// 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
// $Id$
2011-02-15 09:30:46 +00:00
#ifdef NDEBUG
#undef NDEBUG
#endif
#ifndef DEBUG
#define DEBUG
#endif
2010-11-18 16:42:57 +00:00
#include "client/BaseClient.h"
#include <Atlas/Objects/RootOperation.h>
#include <cassert>
using Atlas::Objects::Root;
using Atlas::Objects::Operation::RootOperation;
2010-11-19 00:59:45 +00:00
class TestBaseClient : public BaseClient
{
public:
TestBaseClient() : BaseClient() { }
virtual void idle() { }
};
2010-11-18 16:42:57 +00:00
int main()
{
2010-11-19 00:59:45 +00:00
{
BaseClient * bc = new TestBaseClient;
delete bc;
}
2010-11-22 18:35:11 +00:00
{
BaseClient * bc = new TestBaseClient;
bc->createAccount("8e7e4452-f666-11df-8027-00269e5444b3", "84abee0c-f666-11df-8f7e-00269e5444b3");
delete bc;
}
2010-11-19 00:59:45 +00:00
{
BaseClient * bc = new TestBaseClient;
bc->createSystemAccount();
delete bc;
}
2010-11-22 18:35:11 +00:00
{
BaseClient * bc = new TestBaseClient;
bc->createCharacter("9e7f4004-f666-11df-a327-00269e5444b3");
delete bc;
}
{
BaseClient * bc = new TestBaseClient;
bc->logout();
delete bc;
}
{
BaseClient * bc = new TestBaseClient;
bc->handleNet();
delete bc;
}
2010-11-18 16:42:57 +00:00
return 0;
}
// stubs
#include "client/CreatorClient.h"
#include "common/log.h"
#include <cstdlib>
CreatorClient::CreatorClient(const std::string & id, long intId,
ClientConnection &c) :
CharacterClient(id, intId, c)
{
}
ClientConnection::ClientConnection()
{
}
ClientConnection::~ClientConnection()
{
}
void ClientConnection::operation(const RootOperation & op)
{
}
int ClientConnection::wait()
{
return 0;
}
RootOperation ClientConnection::pop()
{
return RootOperation(0);
}
CharacterClient::CharacterClient(const std::string & id, long intId,
ClientConnection & c) :
BaseMind(id, intId), m_connection(c)
{
}
MemMap::MemMap(Script *& s) : m_checkIterator(m_entities.begin()), m_script(s)
{
}
AtlasStreamClient::AtlasStreamClient() : reply_flag(false), error_flag(false),
serialNo(512), m_fd(-1), m_encoder(0),
m_codec(0), m_ios(0), m_currentTask(0)
{
}
AtlasStreamClient::~AtlasStreamClient()
{
}
void AtlasStreamClient::objectArrived(const Root & obj)
{
}
void AtlasStreamClient::operation(const RootOperation & op)
{
}
void AtlasStreamClient::infoArrived(const RootOperation & op)
{
}
void AtlasStreamClient::appearanceArrived(const RootOperation & op)
{
}
void AtlasStreamClient::disappearanceArrived(const RootOperation & op)
{
}
void AtlasStreamClient::sightArrived(const RootOperation & op)
{
}
void AtlasStreamClient::soundArrived(const RootOperation & op)
{
}
void AtlasStreamClient::errorArrived(const RootOperation & op)
{
}
void AtlasStreamClient::loginSuccess(const Root & arg)
{
}
2010-11-18 16:42:57 +00:00
void AtlasStreamClient::send(const RootOperation & op)
{
}
void log(LogLevel lvl, const std::string & msg)
{
}
std::string create_session_username()
{
return "admin_test";
}
long integerId(const std::string & id)
{
long intId = strtol(id.c_str(), 0, 10);
if (intId == 0 && id != "0") {
intId = -1L;
}
return intId;
}
BaseMind::BaseMind(const std::string & id, long intId) :
MemEntity(id, intId), m_map(m_script)
{
}
BaseMind::~BaseMind()
{
}
void BaseMind::SightOperation(const Operation & op, OpVector & res)
{
}
void BaseMind::SoundOperation(const Operation & op, OpVector & res)
{
}
void BaseMind::AppearanceOperation(const Operation & op, OpVector & res)
{
}
void BaseMind::DisappearanceOperation(const Operation & op, OpVector & res)
{
}
void BaseMind::UnseenOperation(const Operation & op, OpVector & res)
{
}
void BaseMind::operation(const Operation & op, OpVector & res)
{
}
MemEntity::MemEntity(const std::string & id, long intId) :
2013-01-14 09:59:54 +00:00
LocatedEntity(id, intId), m_lastSeen(0.)
2010-11-18 16:42:57 +00:00
{
}
MemEntity::~MemEntity()
{
}
void MemEntity::externalOperation(const Operation & op, Link &)
{
}
void MemEntity::operation(const Operation &, OpVector &)
{
}
2013-01-24 22:23:01 +00:00
void MemEntity::destroy()
{
}
2010-11-18 16:42:57 +00:00
LocatedEntity::LocatedEntity(const std::string & id, long intId) :
Router(id, intId),
m_refCount(0), m_seq(0),
2013-01-14 09:59:54 +00:00
m_script(0), m_type(0), m_flags(0), m_contains(0)
2010-11-18 16:42:57 +00:00
{
}
LocatedEntity::~LocatedEntity()
{
}
bool LocatedEntity::hasAttr(const std::string & name) const
{
return false;
}
2011-09-29 17:36:26 +01:00
int LocatedEntity::getAttr(const std::string & name,
Atlas::Message::Element & attr) const
2010-11-18 16:42:57 +00:00
{
2011-09-29 17:36:26 +01:00
return -1;
2010-11-18 16:42:57 +00:00
}
2011-09-29 17:36:26 +01:00
int LocatedEntity::getAttrType(const std::string & name,
Atlas::Message::Element & attr,
int type) const
2010-11-18 16:42:57 +00:00
{
2011-09-29 17:36:26 +01:00
return -1;
2010-11-18 16:42:57 +00:00
}
2011-02-28 00:28:25 +00:00
PropertyBase * LocatedEntity::setAttr(const std::string & name,
const Atlas::Message::Element & attr)
2010-11-18 16:42:57 +00:00
{
2011-02-28 00:28:25 +00:00
return 0;
2010-11-18 16:42:57 +00:00
}
const PropertyBase * LocatedEntity::getProperty(const std::string & name) const
{
return 0;
}
PropertyBase * LocatedEntity::modProperty(const std::string & name)
{
return 0;
}
PropertyBase * LocatedEntity::setProperty(const std::string & name,
PropertyBase * prop)
{
return 0;
}
void LocatedEntity::installDelegate(int, const std::string &)
{
}
void LocatedEntity::destroy()
{
}
Domain * LocatedEntity::getMovementDomain()
{
return 0;
}
void LocatedEntity::sendWorld(const Operation & op)
{
}
2010-11-18 16:42:57 +00:00
void LocatedEntity::onContainered()
{
}
void LocatedEntity::onUpdated()
{
}
void LocatedEntity::merge(const Atlas::Message::MapType & ent)
{
}
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
{
}
Location::Location() : m_loc(0)
{
}
int Location::readFromEntity(const Atlas::Objects::Entity::RootEntity & ent)
{
return 0;
}
void WorldTime::initTimeInfo()
{
}
DateTime::DateTime(int t)
{
}