#pragma once
#include "entity.h"

class Connection : public Entity
{
public:
	Entity* from;
	Entity* to;
	float connectionLength;
	bool constraining; // If true, constrain distance between entities to connection length; otherwise, stretch connection

private:
	int cmp(const Connection* other) const;

public:
	bool potentialDuplicate;

	Connection(scene::ISceneManager* smgr, Entity* from, Entity* to, bool constraining=true);
	virtual void stretchBetweenNodes();
	virtual void setTo(Entity* newTo);
	virtual void startConstraining();
	virtual void update();
	virtual void updateRotation();
	virtual ~Connection();

	virtual bool duplicateOf(Connection* other);

	virtual bool operator<(const Connection* other) const;
	virtual bool operator<=(const Connection* other) const;
	virtual bool operator>(const Connection* other) const;
	virtual bool operator>=(const Connection* other) const;
};
