cyphesis/rulesets/Line.cpp
Al Riddoch aabc3f2f4b 2002-12-01 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp: Fix very long standing moving bug, which
	  sometimes caused big jumps in character position.

	* rulesets/Area.cpp, rulesets/Character.cpp, rulesets/Entity.cpp,
	  rulesets/Entity.cpp, rulesets/Entity.h, rulesets/Line.cpp,
	  rulesets/Plant.cpp, rulesets/Thing.cpp: Add in the hooks required
	  to inform persistance system when changes have taken place.
2002-12-01 22:54:12 +00:00

57 lines
1.6 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) 2002 Alistair Riddoch
#include "Line.h"
#include <common/type_utils.h>
#include <common/debug.h>
static const bool debug_flag = true;
Line::Line()
{
// Default to a 0.1m cube
location.bBox = BBox(Vector3D(0.1, 0.1, 0.1));
}
Line::~Line()
{
}
const Fragment Line::get(const std::string & aname) const
{
if (aname == "start_intersections") {
return idListAsObject(startIntersections);
} else if (aname == "end_intersections") {
return idListAsObject(endIntersections);
} else if (aname == "coords") {
return coordListAsObject(coords);
}
return Thing::get(aname);
}
void Line::set(const std::string & aname, const Fragment & attr)
{
debug( std::cout << "Setting " << aname << " in line" << std::endl
<< std::flush;);
if ((aname == "start_intersections") && attr.IsList()) {
startIntersections = idListFromAtlas(attr);
update_flags != a_line;
} else if ((aname == "end_intersections") && attr.IsList()) {
startIntersections = idListFromAtlas(attr);
update_flags != a_line;
} else if ((aname == "coords") && attr.IsList()) {
coords = coordListFromAtlas(attr);
update_flags != a_line;
} else {
Thing::set(aname, attr);
}
}
void Line::addToObject(Fragment::MapType & omap) const
{
omap["start_intersections"] = idListAsObject(startIntersections);
omap["end_intersections"] = idListAsObject(endIntersections);
omap["coords"] = coordListAsObject(coords);
}