int main() { int ret = 0; Operation op; { Task * task; OpVector res; if (0) { task->TickOperation(op, res); } } Entity ent1("1", 1), ent2("2", 2); Character chr("3", 3); { Fell fell(chr, ent1, ent2); fell.nextTick(1.5); Atlas::Message::Element val; fell.getAttr("foo", val); assert(val.isNone()); fell.setAttr("foo", 1); fell.getAttr("foo", val); assert(val.isInt()); assert(!fell.obsolete()); OpVector res; assert(res.empty()); Atlas::Objects::Operation::Generic c; fell.initTask(c, res); assert(!res.empty()); fell.TickOperation(op, res); fell.irrelevant(); assert(fell.obsolete()); } return ret; }
int main() { int ret = 0; { Entity tlve("0", 0), ent("1", 1); ent.m_location.m_loc = &tlve; ent.m_location.m_pos = Point3D(1, 1, 0); ent.m_location.m_orientation = WFMath::Quaternion().identity(); Point3D relPos = relativePos(ent.m_location, ent.m_location); std::cout << "RelPos to self: " << relPos << std::endl << std::flush; relPos = relativePos(ent.m_location, tlve.m_location); std::cout << "RelPos ent -> tlve: " << relPos << std::endl << std::flush; relPos = relativePos(tlve.m_location, ent.m_location); std::cout << "RelPos tlve -> ent: " << relPos << std::endl << std::flush; ent.m_location.m_loc = 0; } { Entity tlve("0", 0), ent1("1", 1), ent2("2", 2); ent1.m_location.m_loc = &tlve; ent1.m_location.m_pos = Point3D(-1, 1, 0); ent1.m_location.m_orientation = WFMath::Quaternion().identity(); ent2.m_location.m_loc = &tlve; ent2.m_location.m_pos = Point3D(1, 1, 0); ent2.m_location.m_orientation = WFMath::Quaternion().identity(); Point3D relPos = relativePos(ent1.m_location, ent2.m_location); std::cout << "RelPos ent1 -> ent2: " << relPos << std::endl << std::flush; ent1.m_location.m_loc = 0; ent2.m_location.m_loc = 0; } { Entity tlve("0", 0), ent1("1", 1), ent2("2", 2), ent3("3", 3), ent4("4", 4); ent1.m_location.m_loc = &tlve; ent1.m_location.m_pos = Point3D(-1, 1, 0); ent1.m_location.m_orientation = WFMath::Quaternion().identity(); ent2.m_location.m_loc = &tlve; ent2.m_location.m_pos = Point3D(1, 1, 0); ent2.m_location.m_orientation = WFMath::Quaternion().identity(); ent3.m_location.m_loc = &ent1; ent3.m_location.m_pos = Point3D(-1, 1, 0); ent3.m_location.m_orientation = WFMath::Quaternion().identity(); ent4.m_location.m_loc = &ent2; ent4.m_location.m_pos = Point3D(1, 1, 0); ent4.m_location.m_orientation = WFMath::Quaternion().identity(); Point3D relPos = relativePos(ent3.m_location, ent4.m_location); std::cout << "RelPos ent3 -> ent4: " << relPos << std::endl << std::flush; ent1.m_location.m_loc = 0; ent2.m_location.m_loc = 0; ent3.m_location.m_loc = 0; ent4.m_location.m_loc = 0; } { Entity tlve("0", 0), ent1("1", 1), ent2("2", 2), ent3("3", 3), ent4("4", 4); ent1.m_location.m_loc = &tlve; ent1.m_location.m_pos = Point3D(-1, 1, 0); ent1.m_location.m_orientation = WFMath::Quaternion().identity(); ent2.m_location.m_loc = &tlve; ent2.m_location.m_pos = Point3D(1, 1, 0); ent2.m_location.m_orientation = WFMath::Quaternion().identity(); ent3.m_location.m_loc = &ent1; ent3.m_location.m_pos = Point3D(-1, 1, 0); ent3.m_location.m_orientation = WFMath::Quaternion(2, M_PI / 2.f); ent4.m_location.m_loc = &ent2; ent4.m_location.m_pos = Point3D(1, 1, 0); ent4.m_location.m_orientation = WFMath::Quaternion().identity(); Point3D relPos = relativePos(ent3.m_location, ent4.m_location); std::cout << "RelPos ent3 -> ent4: " << relPos << std::endl << std::flush; ent1.m_location.m_loc = 0; ent2.m_location.m_loc = 0; ent3.m_location.m_loc = 0; ent4.m_location.m_loc = 0; } { Entity tlve("0", 0), ent1("1", 1), ent2("2", 2), ent3("3", 3), ent4("4", 4); ent1.m_location.m_loc = &tlve; ent1.m_location.m_pos = Point3D(-1, 1, 0); ent1.m_location.m_orientation = WFMath::Quaternion().identity(); ent2.m_location.m_loc = &tlve; ent2.m_location.m_pos = Point3D(1, 1, 0); ent2.m_location.m_orientation = WFMath::Quaternion(2, -M_PI / 2.f); ent3.m_location.m_loc = &ent1; ent3.m_location.m_pos = Point3D(-1, 1, 0); ent3.m_location.m_orientation = WFMath::Quaternion(2, M_PI / 2.f); ent4.m_location.m_loc = &ent2; ent4.m_location.m_pos = Point3D(1, 1, 0); ent4.m_location.m_orientation = WFMath::Quaternion().identity(); Point3D relPos = relativePos(ent3.m_location, ent4.m_location); std::cout << "RelPos ent3 -> ent4: " << relPos << std::endl << std::flush; ent1.m_location.m_loc = 0; ent2.m_location.m_loc = 0; ent3.m_location.m_loc = 0; ent4.m_location.m_loc = 0; } { Entity tlve("0", 0), ent1("1", 1), ent2("2", 2), ent3("3", 3), ent4("4", 4); ent1.m_location.m_loc = &tlve; ent1.m_location.m_pos = Point3D(-1, 1, 0); ent1.m_location.m_orientation = WFMath::Quaternion(2, M_PI / 2.f); ent2.m_location.m_loc = &tlve; ent2.m_location.m_pos = Point3D(1, 1, 0); ent2.m_location.m_orientation = WFMath::Quaternion().identity(); ent3.m_location.m_loc = &ent1; ent3.m_location.m_pos = Point3D(-1, 1, 0); ent3.m_location.m_orientation = WFMath::Quaternion(2, M_PI / 2.f); ent4.m_location.m_loc = &ent2; ent4.m_location.m_pos = Point3D(1, 1, 0); ent4.m_location.m_orientation = WFMath::Quaternion().identity(); Point3D relPos = relativePos(ent3.m_location, ent4.m_location); Vector3D distance = distanceTo(ent3.m_location, ent4.m_location); std::cout << "RelPos ent3 -> ent4: " << relPos << " Distance ent3 -> ent4: " << distance << std::endl << std::flush; ent1.m_location.m_loc = 0; ent2.m_location.m_loc = 0; ent3.m_location.m_loc = 0; ent4.m_location.m_loc = 0; } { Entity tlve("0", 0), ent1("1", 1), ent2("2", 2); ent1.m_location.m_loc = &tlve; ent1.m_location.m_pos = Point3D(1, 1, 0); ent1.m_location.m_orientation = WFMath::Quaternion().identity(); ent2.m_location.m_loc = &ent1; ent2.m_location.m_pos = Point3D(0, 0, 0); ent2.m_location.m_orientation = WFMath::Quaternion().identity(); Vector3D distance = distanceTo(ent1.m_location, ent2.m_location); std::cout << "Distance ent1 -> ent2: " << distance << "," << distance.isValid() << std::endl << std::flush; assert(distance.isValid()); assert(distance == Vector3D(0,0,0)); ent1.m_location.m_loc = 0; ent2.m_location.m_loc = 0; } return ret; }