2009-06-17 19:32:57 +01: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.
|
|
|
|
|
//
|
|
|
|
|
// 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
|
|
|
|
|
|
2009-06-30 15:58:33 +04:00
|
|
|
#include "PropertyCoverage.h"
|
2009-06-27 02:12:07 +04:00
|
|
|
#include "TestWorld.h"
|
2009-06-17 19:32:57 +01:00
|
|
|
|
2009-06-27 02:12:07 +04:00
|
|
|
#include "rulesets/Entity.h"
|
|
|
|
|
#include "rulesets/Character.h"
|
2009-06-17 19:32:57 +01:00
|
|
|
#include "rulesets/TasksProperty.h"
|
2011-11-03 22:57:46 +00:00
|
|
|
#include "rulesets/Task.h"
|
2009-06-27 02:12:07 +04:00
|
|
|
|
|
|
|
|
#include <Atlas/Message/Element.h>
|
2009-07-29 12:53:22 +01:00
|
|
|
#include <Atlas/Objects/SmartPtr.h>
|
|
|
|
|
#include <Atlas/Objects/Operation.h>
|
2009-06-17 19:32:57 +01:00
|
|
|
|
|
|
|
|
using Atlas::Message::ListType;
|
2009-06-27 02:12:07 +04:00
|
|
|
using Atlas::Message::MapType;
|
|
|
|
|
using Atlas::Message::Element;
|
2009-06-17 19:32:57 +01:00
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
TasksProperty * ap = new TasksProperty;
|
|
|
|
|
|
2013-01-08 00:19:23 +00:00
|
|
|
PropertyChecker<TasksProperty> pc(ap);
|
2009-06-27 02:12:07 +04:00
|
|
|
|
2009-07-29 12:53:22 +01:00
|
|
|
OpVector res;
|
2009-06-30 15:58:33 +04:00
|
|
|
Character * chr = pc.createCharacterEntity();
|
2011-11-03 22:57:46 +00:00
|
|
|
Task * task = new Task(*chr);
|
2009-06-27 02:12:07 +04:00
|
|
|
task->progress() = .1;
|
|
|
|
|
task->rate() = .1;
|
2009-07-29 12:53:22 +01:00
|
|
|
chr->startTask(task, Atlas::Objects::Operation::Action(), res);
|
2009-06-27 02:12:07 +04:00
|
|
|
|
|
|
|
|
MapType map;
|
|
|
|
|
map["one"] = 23;
|
|
|
|
|
map["two"] = 23.;
|
|
|
|
|
map["three"] = "twenty_three";
|
|
|
|
|
map["four"] = ListType(1, 23);
|
|
|
|
|
map["five"] = ListType(1, 23.);
|
|
|
|
|
map["six"] = ListType(1, "twenty_three");
|
2009-06-30 15:58:33 +04:00
|
|
|
pc.testDataAppend(ListType(1, map));
|
2009-06-27 02:12:07 +04:00
|
|
|
|
2009-06-30 15:58:33 +04:00
|
|
|
pc.basicCoverage();
|
2009-06-17 19:32:57 +01:00
|
|
|
|
|
|
|
|
// The is no code in operations.cpp to execute, but we need coverage.
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2010-04-08 23:57:49 +01:00
|
|
|
|
|
|
|
|
// stubs
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
void TestWorld::message(const Operation & op, LocatedEntity & ent)
|
2012-09-11 22:53:15 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
LocatedEntity * TestWorld::addNewEntity(const std::string &,
|
2012-09-06 13:48:40 +01:00
|
|
|
const Atlas::Objects::Entity::RootEntity &)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-17 10:41:47 +00:00
|
|
|
namespace Atlas { namespace Objects { namespace Operation {
|
|
|
|
|
int UPDATE_NO = -1;
|
|
|
|
|
} } }
|
|
|
|
|
|
2010-04-08 23:57:49 +01:00
|
|
|
int Character::startTask(Task * task, const Operation & op, OpVector & res)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-02 23:10:41 +00:00
|
|
|
Task::Task(LocatedEntity & chr) : m_refCount(0), m_serialno(0), m_obsolete(false), m_progress(-1), m_rate(-1), m_owner(chr)
|
2010-04-08 23:57:49 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Task::~Task()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Task::irrelevant()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Task::setAttr(const std::string & attr,
|
|
|
|
|
const Atlas::Message::Element & val)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-03 21:42:12 +00:00
|
|
|
void Task::initTask(const Operation & op, OpVector & res)
|
2010-04-08 23:57:49 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-02 23:19:59 -07:00
|
|
|
void Task::operation(const Operation & op, OpVector & res)
|
2010-04-08 23:57:49 +01:00
|
|
|
{
|
|
|
|
|
}
|