2010-03-22 16:59:58 +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.
|
|
|
|
|
//
|
|
|
|
|
// 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
|
|
|
|
|
|
2012-12-22 19:14:22 +00:00
|
|
|
#include "TestBase.h"
|
|
|
|
|
|
2010-03-22 16:59:58 +00:00
|
|
|
#include "server/WorldRouter.h"
|
|
|
|
|
|
|
|
|
|
#include "server/EntityBuilder.h"
|
|
|
|
|
#include "server/SpawnEntity.h"
|
|
|
|
|
|
|
|
|
|
#include "rulesets/Domain.h"
|
|
|
|
|
#include "rulesets/World.h"
|
|
|
|
|
|
|
|
|
|
#include "common/const.h"
|
|
|
|
|
#include "common/globals.h"
|
|
|
|
|
#include "common/id.h"
|
|
|
|
|
#include "common/Inheritance.h"
|
|
|
|
|
#include "common/log.h"
|
|
|
|
|
#include "common/Monitors.h"
|
2011-10-31 12:47:56 +01:00
|
|
|
#include "common/SystemTime.h"
|
2010-03-22 16:59:58 +00:00
|
|
|
#include "common/Tick.h"
|
|
|
|
|
#include "common/Variable.h"
|
|
|
|
|
|
|
|
|
|
#include <Atlas/Objects/Anonymous.h>
|
|
|
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
|
#include <cstdlib>
|
|
|
|
|
|
|
|
|
|
#include <cassert>
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
using Atlas::Message::Element;
|
2010-03-22 16:59:58 +00:00
|
|
|
using Atlas::Message::MapType;
|
|
|
|
|
using Atlas::Objects::Entity::Anonymous;
|
|
|
|
|
using Atlas::Objects::Entity::RootEntity;
|
|
|
|
|
using Atlas::Objects::Operation::Tick;
|
|
|
|
|
|
2012-12-22 19:14:22 +00:00
|
|
|
class WorldRouterintegration : public Cyphesis::TestBase
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
WorldRouterintegration();
|
|
|
|
|
|
|
|
|
|
void setup();
|
|
|
|
|
void teardown();
|
|
|
|
|
|
|
|
|
|
void test_sequence();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
WorldRouterintegration::WorldRouterintegration()
|
|
|
|
|
{
|
|
|
|
|
ADD_TEST(WorldRouterintegration::test_sequence);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WorldRouterintegration::setup()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WorldRouterintegration::teardown()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WorldRouterintegration::test_sequence()
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
database_flag = false;
|
|
|
|
|
|
2010-08-16 00:15:38 +01:00
|
|
|
new Domain;
|
|
|
|
|
|
2012-12-28 13:35:26 +00:00
|
|
|
WorldRouter * test_world = new WorldRouter(SystemTime());
|
2010-03-22 16:59:58 +00:00
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
LocatedEntity * ent1 = test_world->addNewEntity("__no_such_type__",
|
|
|
|
|
Anonymous());
|
2010-03-22 16:59:58 +00:00
|
|
|
assert(ent1 == 0);
|
|
|
|
|
|
|
|
|
|
ent1 = test_world->addNewEntity("thing", Anonymous());
|
|
|
|
|
assert(ent1 != 0);
|
|
|
|
|
|
|
|
|
|
std::string id;
|
|
|
|
|
long int_id = newId(id);
|
|
|
|
|
|
|
|
|
|
Entity * ent2 = new Thing(id, int_id);
|
|
|
|
|
assert(ent2 != 0);
|
|
|
|
|
ent2->m_location.m_loc = &test_world->m_gameWorld;
|
|
|
|
|
ent2->m_location.m_pos = Point3D(0,0,0);
|
|
|
|
|
test_world->addEntity(ent2);
|
|
|
|
|
|
2012-12-28 13:35:26 +00:00
|
|
|
test_world->getOperationFromQueue();
|
2010-03-22 16:59:58 +00:00
|
|
|
|
|
|
|
|
Tick tick;
|
|
|
|
|
tick->setFutureSeconds(0);
|
|
|
|
|
tick->setTo(ent2->getId());
|
|
|
|
|
test_world->message(tick, *ent2);
|
|
|
|
|
|
2012-12-28 13:35:26 +00:00
|
|
|
test_world->getOperationFromQueue();
|
2010-03-22 16:59:58 +00:00
|
|
|
|
|
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
MapType spawn_data;
|
2010-03-22 16:59:58 +00:00
|
|
|
test_world->createSpawnPoint(spawn_data, ent2);
|
2012-12-24 10:50:44 +00:00
|
|
|
ASSERT_EQUAL(test_world->m_spawns.size(), 0u);
|
2010-03-22 16:59:58 +00:00
|
|
|
|
|
|
|
|
spawn_data["name"] = 1;
|
|
|
|
|
test_world->createSpawnPoint(spawn_data, ent2);
|
2012-12-24 10:50:44 +00:00
|
|
|
ASSERT_EQUAL(test_world->m_spawns.size(), 0u);
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(test_world->m_spawns.find("bob") ==
|
|
|
|
|
test_world->m_spawns.end());
|
2010-03-22 16:59:58 +00:00
|
|
|
|
|
|
|
|
spawn_data["name"] = "bob";
|
|
|
|
|
test_world->createSpawnPoint(spawn_data, ent2);
|
2012-12-24 10:50:44 +00:00
|
|
|
ASSERT_EQUAL(test_world->m_spawns.size(), 1u);
|
|
|
|
|
ASSERT_TRUE(test_world->m_spawns.find("bob") !=
|
|
|
|
|
test_world->m_spawns.end());
|
2010-03-22 16:59:58 +00:00
|
|
|
|
|
|
|
|
test_world->createSpawnPoint(spawn_data, ent2);
|
2012-12-24 10:50:44 +00:00
|
|
|
ASSERT_EQUAL(test_world->m_spawns.size(), 1u);
|
|
|
|
|
ASSERT_TRUE(test_world->m_spawns.find("bob") !=
|
|
|
|
|
test_world->m_spawns.end());
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
{
|
2012-12-24 10:50:44 +00:00
|
|
|
ASSERT_EQUAL(test_world->m_spawns.size(), 1u);
|
2010-03-22 16:59:58 +00:00
|
|
|
Atlas::Message::ListType spawn_repr;
|
|
|
|
|
test_world->getSpawnList(spawn_repr);
|
|
|
|
|
assert(!spawn_repr.empty());
|
2012-12-24 10:50:44 +00:00
|
|
|
ASSERT_EQUAL(spawn_repr.size(), 1u);
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
LocatedEntity * ent3 = test_world->spawnNewEntity("__no_spawn__",
|
|
|
|
|
"character",
|
|
|
|
|
Anonymous());
|
2010-03-22 16:59:58 +00:00
|
|
|
assert(ent3 == 0);
|
|
|
|
|
|
|
|
|
|
ent3 = test_world->spawnNewEntity("bob",
|
|
|
|
|
"character",
|
|
|
|
|
Anonymous());
|
|
|
|
|
assert(ent3 == 0);
|
|
|
|
|
|
|
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
MapType spawn_data;
|
2010-03-22 16:59:58 +00:00
|
|
|
spawn_data["name"] = "bob";
|
|
|
|
|
spawn_data["character_types"] = Atlas::Message::ListType(1, "spiddler");
|
|
|
|
|
test_world->createSpawnPoint(spawn_data, ent2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ent3 = test_world->spawnNewEntity("bob",
|
|
|
|
|
"spiddler",
|
|
|
|
|
Anonymous());
|
|
|
|
|
assert(ent3 == 0);
|
|
|
|
|
|
|
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
MapType spawn_data;
|
2010-03-22 16:59:58 +00:00
|
|
|
spawn_data["name"] = "bob";
|
|
|
|
|
spawn_data["character_types"] = Atlas::Message::ListType(1, "character");
|
|
|
|
|
test_world->createSpawnPoint(spawn_data, ent2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ent3 = test_world->spawnNewEntity("bob",
|
|
|
|
|
"character",
|
|
|
|
|
Anonymous());
|
|
|
|
|
assert(ent3 != 0);
|
|
|
|
|
|
|
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
MapType spawn_data;
|
2010-03-22 16:59:58 +00:00
|
|
|
spawn_data["name"] = "bob";
|
|
|
|
|
spawn_data["character_types"] = Atlas::Message::ListType(1, "character");
|
|
|
|
|
spawn_data["contains"] = Atlas::Message::ListType(1, "thing");
|
|
|
|
|
test_world->createSpawnPoint(spawn_data, ent2);
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
LocatedEntity * ent4 = test_world->spawnNewEntity("bob",
|
|
|
|
|
"character",
|
|
|
|
|
Anonymous());
|
2010-03-22 16:59:58 +00:00
|
|
|
assert(ent4 != 0);
|
|
|
|
|
|
2012-12-28 13:35:26 +00:00
|
|
|
test_world->delEntity(&test_world->m_gameWorld);
|
|
|
|
|
test_world->delEntity(ent4);
|
2010-03-22 16:59:58 +00:00
|
|
|
ent4 = 0;
|
|
|
|
|
|
|
|
|
|
delete test_world;
|
2012-12-22 19:14:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
WorldRouterintegration t;
|
2010-03-22 16:59:58 +00:00
|
|
|
|
2012-12-22 19:14:22 +00:00
|
|
|
return t.run();
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
// stubs
|
2010-03-22 16:59:58 +00:00
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
#include "server/EntityFactory.h"
|
|
|
|
|
#include "server/CorePropertyManager.h"
|
2010-03-22 16:59:58 +00:00
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
#include "rulesets/AreaProperty.h"
|
|
|
|
|
#include "rulesets/AtlasProperties.h"
|
|
|
|
|
#include "rulesets/BBoxProperty.h"
|
|
|
|
|
#include "rulesets/CalendarProperty.h"
|
|
|
|
|
#include "rulesets/EntityProperty.h"
|
|
|
|
|
#include "rulesets/ExternalProperty.h"
|
|
|
|
|
#include "rulesets/OutfitProperty.h"
|
|
|
|
|
#include "rulesets/StatusProperty.h"
|
|
|
|
|
#include "rulesets/TasksProperty.h"
|
|
|
|
|
#include "rulesets/TerrainProperty.h"
|
|
|
|
|
|
|
|
|
|
#include "rulesets/Character.h"
|
|
|
|
|
#include "rulesets/ExternalMind.h"
|
|
|
|
|
#include "rulesets/Motion.h"
|
|
|
|
|
#include "rulesets/Pedestrian.h"
|
|
|
|
|
#include "rulesets/PythonArithmeticFactory.h"
|
|
|
|
|
#include "rulesets/Task.h"
|
|
|
|
|
|
|
|
|
|
#include <Atlas/Objects/Operation.h>
|
|
|
|
|
|
|
|
|
|
CorePropertyManager::CorePropertyManager()
|
|
|
|
|
{
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
CorePropertyManager::~CorePropertyManager()
|
|
|
|
|
{
|
|
|
|
|
}
|
2010-03-22 16:59:58 +00:00
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
PropertyBase * CorePropertyManager::addProperty(const std::string & name,
|
|
|
|
|
int type)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
return 0;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2013-02-22 09:57:10 +00:00
|
|
|
int CorePropertyManager::installFactory(const std::string & type_name,
|
|
|
|
|
const Atlas::Objects::Root & type_desc,
|
|
|
|
|
PropertyKit * factory)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
template <class T>
|
|
|
|
|
EntityFactory<T>::EntityFactory(EntityFactory<T> & o)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
template <class T>
|
|
|
|
|
EntityFactory<T>::EntityFactory()
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
template <class T>
|
|
|
|
|
EntityFactory<T>::~EntityFactory()
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
template <class T>
|
2013-01-17 10:17:07 +00:00
|
|
|
LocatedEntity * EntityFactory<T>::newEntity(const std::string & id, long intId)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
return new Entity(id, intId);
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
template <class T>
|
|
|
|
|
EntityKit * EntityFactory<T>::duplicateFactory()
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
return 0;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
class Creator;
|
|
|
|
|
class Plant;
|
|
|
|
|
class Stackable;
|
|
|
|
|
class World;
|
|
|
|
|
|
|
|
|
|
template <>
|
2013-01-17 10:17:07 +00:00
|
|
|
LocatedEntity * EntityFactory<World>::newEntity(const std::string & id,
|
|
|
|
|
long intId)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
return 0;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
template <>
|
2013-01-17 10:17:07 +00:00
|
|
|
LocatedEntity * EntityFactory<Character>::newEntity(const std::string & id,
|
|
|
|
|
long intId)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
return new Character(id, intId);
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
template <>
|
2013-01-17 10:17:07 +00:00
|
|
|
LocatedEntity * EntityFactory<Thing>::newEntity(const std::string & id,
|
|
|
|
|
long intId)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
return new Thing(id, intId);
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
template class EntityFactory<Thing>;
|
|
|
|
|
template class EntityFactory<Character>;
|
|
|
|
|
template class EntityFactory<Creator>;
|
|
|
|
|
template class EntityFactory<Plant>;
|
|
|
|
|
template class EntityFactory<Stackable>;
|
|
|
|
|
template class EntityFactory<World>;
|
|
|
|
|
|
|
|
|
|
AreaProperty::AreaProperty()
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
AreaProperty::~AreaProperty()
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void AreaProperty::set(const Atlas::Message::Element & ent)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-08 00:19:23 +00:00
|
|
|
AreaProperty * AreaProperty::copy() const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
void AreaProperty::apply(LocatedEntity * owner)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
CalendarProperty::CalendarProperty()
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
int CalendarProperty::get(Element & ent) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
return 0;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void CalendarProperty::set(const Element & ent)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-07 23:03:25 +00:00
|
|
|
CalendarProperty * CalendarProperty::copy() const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
ExternalProperty::ExternalProperty(ExternalMind * & data) : m_data(data)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
int ExternalProperty::get(Element & val) const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2010-03-22 16:59:58 +00:00
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void ExternalProperty::set(const Element & val)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void ExternalProperty::add(const std::string & s,
|
|
|
|
|
MapType & map) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void ExternalProperty::add(const std::string & s,
|
|
|
|
|
const Atlas::Objects::Entity::RootEntity & ent) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-07 23:03:25 +00:00
|
|
|
ExternalProperty * ExternalProperty::copy() const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
EntityProperty::EntityProperty()
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
int EntityProperty::get(Element & val) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
return 0;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void EntityProperty::set(const Element & val)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void EntityProperty::add(const std::string & s,
|
|
|
|
|
MapType & map) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void EntityProperty::add(const std::string & s,
|
|
|
|
|
const Atlas::Objects::Entity::RootEntity & ent) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-07 23:03:25 +00:00
|
|
|
EntityProperty * EntityProperty::copy() const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
IdProperty::IdProperty(const std::string & data) : PropertyBase(per_ephem),
|
|
|
|
|
m_data(data)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
int IdProperty::get(Atlas::Message::Element & e) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
e = m_data;
|
|
|
|
|
return 0;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void IdProperty::set(const Atlas::Message::Element & e)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void IdProperty::add(const std::string & key,
|
|
|
|
|
Atlas::Message::MapType & ent) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void IdProperty::add(const std::string & key,
|
|
|
|
|
const Atlas::Objects::Entity::RootEntity & ent) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-07 23:03:25 +00:00
|
|
|
IdProperty * IdProperty::copy() const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
OutfitProperty::OutfitProperty()
|
2012-06-30 01:06:14 -07:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
OutfitProperty::~OutfitProperty()
|
2012-06-30 01:06:14 -07:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
int OutfitProperty::get(Element & val) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
return 0;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void OutfitProperty::set(const Element & val)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void OutfitProperty::add(const std::string & key,
|
|
|
|
|
MapType & map) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void OutfitProperty::add(const std::string & key,
|
|
|
|
|
const Atlas::Objects::Entity::RootEntity & ent) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-07 23:03:25 +00:00
|
|
|
OutfitProperty * OutfitProperty::copy() const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void OutfitProperty::cleanUp()
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
void OutfitProperty::wear(LocatedEntity * wearer,
|
2012-12-21 22:45:12 +00:00
|
|
|
const std::string & location,
|
2013-01-17 10:17:07 +00:00
|
|
|
LocatedEntity * garment)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
void OutfitProperty::itemRemoved(LocatedEntity * garment, LocatedEntity * wearer)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
TerrainProperty::TerrainProperty() :
|
|
|
|
|
m_data(*(Mercator::Terrain*)0),
|
|
|
|
|
m_tileShader(*(Mercator::TileShader*)0)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
TerrainProperty::~TerrainProperty()
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
int TerrainProperty::get(Element & ent) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
return 0;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void TerrainProperty::set(const Element & ent)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-07 23:03:25 +00:00
|
|
|
TerrainProperty * TerrainProperty::copy() const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
bool TerrainProperty::getHeightAndNormal(float x,
|
|
|
|
|
float y,
|
|
|
|
|
float & height,
|
|
|
|
|
Vector3D & normal) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TerrainProperty::getSurface(const Point3D & pos, int & material)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
Task::Task(LocatedEntity & owner) : m_refCount(0), m_serialno(0),
|
|
|
|
|
m_obsolete(false),
|
|
|
|
|
m_progress(-1), m_rate(-1),
|
|
|
|
|
m_owner(owner), m_script(0)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
Task::~Task()
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void Task::initTask(const Operation & op, OpVector & res)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void Task::operation(const Operation & op, OpVector & res)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void Task::irrelevant()
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
TasksProperty::TasksProperty() : PropertyBase(per_ephem), m_task(0)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TasksProperty::get(Element & val) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2011-02-28 00:28:25 +00:00
|
|
|
return 0;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void TasksProperty::set(const Element & val)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-07 23:03:25 +00:00
|
|
|
TasksProperty * TasksProperty::copy() const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
int TasksProperty::startTask(Task *, LocatedEntity *, const Operation &, OpVector &)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
int TasksProperty::updateTask(LocatedEntity *, OpVector &)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
return 0;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
int TasksProperty::clearTask(LocatedEntity *, OpVector &)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
return 0;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
void TasksProperty::stopTask(LocatedEntity *, OpVector &)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
void TasksProperty::TickOperation(LocatedEntity *, const Operation &, OpVector &)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
void TasksProperty::UseOperation(LocatedEntity *, const Operation &, OpVector &)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
HandlerResult TasksProperty::operation(LocatedEntity *, const Operation &, OpVector &)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2013-01-03 23:17:51 +00:00
|
|
|
return OPERATION_IGNORED;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
ContainsProperty::ContainsProperty(LocatedEntitySet & data) :
|
|
|
|
|
PropertyBase(per_ephem), m_data(data)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ContainsProperty::get(Element & e) const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ContainsProperty::set(const Element & e)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ContainsProperty::add(const std::string & s,
|
|
|
|
|
const Atlas::Objects::Entity::RootEntity & ent) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-07 23:03:25 +00:00
|
|
|
ContainsProperty * ContainsProperty::copy() const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
StatusProperty::StatusProperty()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-08 00:19:23 +00:00
|
|
|
StatusProperty * StatusProperty::copy() const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
void StatusProperty::apply(LocatedEntity * owner)
|
2012-12-21 22:45:12 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BBoxProperty::BBoxProperty()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
void BBoxProperty::apply(LocatedEntity * ent)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
int BBoxProperty::get(Element & val) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2011-09-29 17:36:26 +01:00
|
|
|
return -1;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void BBoxProperty::set(const Element & val)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BBoxProperty::add(const std::string & key,
|
|
|
|
|
MapType & map) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BBoxProperty::add(const std::string & key,
|
|
|
|
|
const RootEntity & ent) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-07 23:03:25 +00:00
|
|
|
BBoxProperty * BBoxProperty::copy() const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-18 19:21:46 +00:00
|
|
|
ExternalMind::ExternalMind(LocatedEntity & e) : Router(e.getId(), e.getIntId()),
|
2012-12-21 22:45:12 +00:00
|
|
|
m_external(0),
|
|
|
|
|
m_entity(e),
|
|
|
|
|
m_lossTime(0.)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ExternalMind::~ExternalMind()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExternalMind::externalOperation(const Operation & op, Link &)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExternalMind::linkUp(Link * c)
|
|
|
|
|
{
|
|
|
|
|
m_external = c;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExternalMind::operation(const Operation & op, OpVector & res)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ArithmeticKit::~ArithmeticKit()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-18 19:27:37 +00:00
|
|
|
Motion::Motion(LocatedEntity & body) : m_entity(body), m_serialno(0),
|
2012-12-21 22:45:12 +00:00
|
|
|
m_collision(false)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Motion::~Motion()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float Motion::checkCollisions()
|
|
|
|
|
{
|
|
|
|
|
return consts::move_tick;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Motion::resolveCollision()
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Motion::setMode(const std::string & mode)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Motion::adjustPostion()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Operation * Motion::genUpdateOperation()
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2011-02-28 00:28:25 +00:00
|
|
|
return 0;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
Operation * Motion::genMoveOperation()
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
Pedestrian::Pedestrian(LocatedEntity & body) : Movement(body)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
Pedestrian::~Pedestrian()
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
double Pedestrian::getTickAddition(const Point3D & coordinates,
|
|
|
|
|
const Vector3D & velocity) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
return consts::basic_tick;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
int Pedestrian::getUpdatedLocation(Location & return_location)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
return 1;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
Operation Pedestrian::generateMove(const Location & new_location)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
Atlas::Objects::Operation::Move moveOp;
|
|
|
|
|
return moveOp;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
Movement::Movement(LocatedEntity & body) : m_body(body),
|
2012-12-21 22:45:12 +00:00
|
|
|
m_serialno(0)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
Movement::~Movement()
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
bool Movement::updateNeeded(const Location & location) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
2010-03-22 16:59:58 +00:00
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void Movement::reset()
|
|
|
|
|
{
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
PythonArithmeticFactory::PythonArithmeticFactory(const std::string & package,
|
|
|
|
|
const std::string & name) :
|
|
|
|
|
PythonClass(package,
|
|
|
|
|
name,
|
|
|
|
|
0)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
PythonArithmeticFactory::~PythonArithmeticFactory()
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
int PythonArithmeticFactory::setup()
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
return 0;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
ArithmeticScript * PythonArithmeticFactory::newScript(LocatedEntity * owner)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
2010-03-22 16:59:58 +00:00
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
PythonClass::PythonClass(const std::string & package,
|
|
|
|
|
const std::string & type,
|
|
|
|
|
struct _typeobject * base)
|
|
|
|
|
{
|
|
|
|
|
}
|
2010-03-22 16:59:58 +00:00
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
PythonClass::~PythonClass()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if 0
|
2010-03-22 16:59:58 +00:00
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
int timeoffset = 0;
|
|
|
|
|
|
|
|
|
|
namespace consts {
|
|
|
|
|
const char * rootWorldId = "0";
|
|
|
|
|
const long rootWorldIntId = 0L;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace Atlas { namespace Objects { namespace Operation {
|
|
|
|
|
int TICK_NO = -1;
|
|
|
|
|
}}}
|
|
|
|
|
|
|
|
|
|
SoftProperty::SoftProperty()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SoftProperty::SoftProperty(const Element & data) :
|
|
|
|
|
PropertyBase(0), m_data(data)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int SoftProperty::get(Element & val) const
|
|
|
|
|
{
|
|
|
|
|
val = m_data;
|
|
|
|
|
return 0;
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
void SoftProperty::set(const Element & val)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
2012-12-21 22:45:12 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-07 23:03:25 +00:00
|
|
|
SoftProperty * SoftProperty::copy() const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
PropertyBase::PropertyBase(unsigned int flags) : m_flags(flags)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PropertyBase::~PropertyBase()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-13 00:45:36 +00:00
|
|
|
void PropertyBase::install(LocatedEntity *, const std::string & name)
|
2012-12-21 22:45:12 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
void PropertyBase::apply(LocatedEntity *)
|
2012-12-21 22:45:12 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PropertyBase::add(const std::string & s,
|
|
|
|
|
MapType & ent) const
|
|
|
|
|
{
|
|
|
|
|
get(ent[s]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PropertyBase::add(const std::string & s,
|
|
|
|
|
const Atlas::Objects::Entity::RootEntity & ent) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
HandlerResult PropertyBase::operation(LocatedEntity *,
|
2013-01-03 23:17:51 +00:00
|
|
|
const Operation &,
|
|
|
|
|
OpVector &)
|
|
|
|
|
{
|
|
|
|
|
return OPERATION_IGNORED;
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
template<>
|
|
|
|
|
void Property<int>::set(const Element & e)
|
|
|
|
|
{
|
|
|
|
|
if (e.isInt()) {
|
|
|
|
|
this->m_data = e.asInt();
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
2012-12-21 22:45:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<>
|
|
|
|
|
void Property<double>::set(const Element & e)
|
|
|
|
|
{
|
|
|
|
|
if (e.isNum()) {
|
|
|
|
|
this->m_data = e.asNum();
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
2012-12-21 22:45:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<>
|
|
|
|
|
void Property<std::string>::set(const Element & e)
|
|
|
|
|
{
|
|
|
|
|
if (e.isString()) {
|
|
|
|
|
this->m_data = e.String();
|
2010-03-22 16:59:58 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
template class Property<int>;
|
|
|
|
|
template class Property<double>;
|
|
|
|
|
template class Property<std::string>;
|
|
|
|
|
|
|
|
|
|
Router::Router(const std::string & id, long intId) : m_id(id),
|
|
|
|
|
m_intId(intId)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-21 22:45:12 +00:00
|
|
|
Router::~Router()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Router::addToMessage(MapType & omap) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Router::addToEntity(const RootEntity & ent) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long integerId(const std::string & id)
|
|
|
|
|
{
|
|
|
|
|
long intId = strtol(id.c_str(), 0, 10);
|
|
|
|
|
if (intId == 0 && id != "0") {
|
|
|
|
|
intId = -1L;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return intId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void log(LogLevel lvl, const std::string & msg)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static long idGenerator = 0;
|
|
|
|
|
|
|
|
|
|
long newId(std::string & id)
|
|
|
|
|
{
|
|
|
|
|
static char buf[32];
|
|
|
|
|
long new_id = ++idGenerator;
|
|
|
|
|
sprintf(buf, "%ld", new_id);
|
|
|
|
|
id = buf;
|
|
|
|
|
assert(!id.empty());
|
|
|
|
|
return new_id;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
BaseWorld::BaseWorld(LocatedEntity & gw) : m_gameWorld(gw)
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BaseWorld::~BaseWorld()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
LocatedEntity * BaseWorld::getEntity(const std::string & id) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
long intId = integerId(id);
|
|
|
|
|
|
|
|
|
|
EntityDict::const_iterator I = m_eobjects.find(intId);
|
|
|
|
|
if (I != m_eobjects.end()) {
|
|
|
|
|
assert(I->second != 0);
|
|
|
|
|
return I->second;
|
|
|
|
|
} else {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
LocatedEntity * BaseWorld::getEntity(long id) const
|
2010-03-22 16:59:58 +00:00
|
|
|
{
|
|
|
|
|
EntityDict::const_iterator I = m_eobjects.find(id);
|
|
|
|
|
if (I != m_eobjects.end()) {
|
|
|
|
|
assert(I->second != 0);
|
|
|
|
|
return I->second;
|
|
|
|
|
} else {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Inheritance * Inheritance::m_instance = NULL;
|
|
|
|
|
|
2012-09-18 08:49:50 +01:00
|
|
|
Inheritance::Inheritance() : noClass(0)
|
2010-03-22 16:59:58 +00: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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VariableBase::~VariableBase()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
Variable<T>::Variable(const T & variable) : m_variable(variable)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
Variable<T>::~Variable()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
void Variable<T>::send(std::ostream & o)
|
|
|
|
|
{
|
|
|
|
|
o << m_variable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template class Variable<int>;
|
|
|
|
|
|
|
|
|
|
Monitors * Monitors::m_instance = NULL;
|
|
|
|
|
|
|
|
|
|
Monitors::Monitors()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Monitors::~Monitors()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Monitors * Monitors::instance()
|
|
|
|
|
{
|
|
|
|
|
if (m_instance == NULL) {
|
|
|
|
|
m_instance = new Monitors();
|
|
|
|
|
}
|
|
|
|
|
return m_instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Monitors::watch(const::std::string & name, VariableBase * monitor)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
#endif // 0
|