changeset 584:a2dde16ddc62

* Fixed the location segfault of the genericrenderer. fixes[ticket:446]
author helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
date Sun, 08 Aug 2010 11:49:09 +0000
parents 47b49b9b0c0a
children c2de5aafe788
files engine/core/view/renderers/genericrenderer.cpp engine/core/view/renderers/genericrenderer.h engine/core/view/renderers/genericrenderer.i
diffstat 3 files changed, 44 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/engine/core/view/renderers/genericrenderer.cpp	Sat Aug 07 16:36:35 2010 +0000
+++ b/engine/core/view/renderers/genericrenderer.cpp	Sun Aug 08 11:49:09 2010 +0000
@@ -49,13 +49,13 @@
 namespace FIFE {
 	static Logger _log(LM_VIEWVIEW);
 
-	GenericRendererNode::GenericRendererNode(Instance* attached_instance, Location* relative_location, Layer* relative_layer, const Point &relative_point):
+	GenericRendererNode::GenericRendererNode(Instance* attached_instance, const Location &relative_location, Layer* relative_layer, const Point &relative_point):
 		m_instance(attached_instance),
 		m_location(relative_location),
 		m_layer(relative_layer),
 		m_point(relative_point) {
 	}
-	GenericRendererNode::GenericRendererNode(Instance* attached_instance, Location* relative_location, const Point &relative_point):
+	GenericRendererNode::GenericRendererNode(Instance* attached_instance, const Location &relative_location, const Point &relative_point):
 		m_instance(attached_instance),
 		m_location(relative_location),
 		m_layer(NULL),
@@ -73,13 +73,13 @@
 		m_layer(NULL),
 		m_point(relative_point) {
 	}
-	GenericRendererNode::GenericRendererNode(Location* attached_location, Layer* relative_layer, const Point &relative_point):
+	GenericRendererNode::GenericRendererNode(const Location &attached_location, Layer* relative_layer, const Point &relative_point):
 		m_instance(NULL),
 		m_location(attached_location),
 		m_layer(relative_layer),
 		m_point(relative_point) {
 	}
-	GenericRendererNode::GenericRendererNode(Location* attached_location, const Point &relative_point):
+	GenericRendererNode::GenericRendererNode(const Location &attached_location, const Point &relative_point):
 		m_instance(NULL),
 		m_location(attached_location),
 		m_layer(NULL),
@@ -100,12 +100,12 @@
 	GenericRendererNode::~GenericRendererNode() {
 	}
 
-	void GenericRendererNode::setAttached(Instance* attached_instance, Location* relative_location, const Point &relative_point) {
+	void GenericRendererNode::setAttached(Instance* attached_instance, const Location &relative_location, const Point &relative_point) {
 		m_instance = attached_instance;
 		m_location = relative_location;
 		m_point = relative_point;
 	}
-	void GenericRendererNode::setAttached(Instance* attached_instance, Location* relative_location) {
+	void GenericRendererNode::setAttached(Instance* attached_instance, const Location &relative_location) {
 		m_instance = attached_instance;
 		m_location = relative_location;
 	}
@@ -116,12 +116,12 @@
 	void GenericRendererNode::setAttached(Instance* attached_instance) {
 		m_instance = attached_instance;
 	}
-	void GenericRendererNode::setAttached(Location* attached_location, const Point &relative_point) {
+	void GenericRendererNode::setAttached(const Location &attached_location, const Point &relative_point) {
 		m_instance = NULL;
 		m_location = attached_location;
 		m_point = relative_point;
 	}
-	void GenericRendererNode::setAttached(Location* attached_location) {
+	void GenericRendererNode::setAttached(const Location &attached_location) {
 		m_instance = NULL;
 		m_location = attached_location;
 	}
@@ -134,13 +134,13 @@
 		m_point = attached_point;
 	}
 
-	void GenericRendererNode::setRelative(Location* relative_location) {
+	void GenericRendererNode::setRelative(const Location &relative_location) {
 		if(m_instance == NULL) {
 			throw NotSupported("No instance attached.");
 		}
 		m_location = relative_location;
 	}
-	void GenericRendererNode::setRelative(Location* relative_location, Point relative_point) {
+	void GenericRendererNode::setRelative(const Location &relative_location, Point relative_point) {
 		if(m_instance == NULL) {
 			throw NotSupported("No instance attached.");
 		}
@@ -160,7 +160,7 @@
 		}
 		return m_instance;
 	}
-	Location* GenericRendererNode::getAttachedLocation() {
+	Location GenericRendererNode::getAttachedLocation() {
 		if(m_instance != NULL || m_location == NULL) {
 			throw NotSupported("No location attached.");
 		}
@@ -179,7 +179,7 @@
 		return m_point;
 	}
 
-	Location* GenericRendererNode::getOffsetLocation() {
+	Location GenericRendererNode::getOffsetLocation() {
 		if(m_instance == NULL || m_location == NULL) {
 			throw NotSupported("No location as offset used.");
 		}
@@ -195,7 +195,7 @@
 	Instance* GenericRendererNode::getInstance() {
 		return m_instance;
 	}
-	Location* GenericRendererNode::getLocation() {
+	Location GenericRendererNode::getLocation() {
 		return m_location;
 	}
 	Layer* GenericRendererNode::getLayer() {
@@ -212,15 +212,15 @@
 				m_layer = m_instance->getLocation().getLayer();
 			}
 			if(m_location != NULL) {
-				p = cam->toScreenCoordinates(m_instance->getLocationRef().getMapCoordinates() + m_location->getMapCoordinates());
+				p = cam->toScreenCoordinates(m_instance->getLocationRef().getMapCoordinates() + m_location.getMapCoordinates());
 			} else {
 				p = cam->toScreenCoordinates(m_instance->getLocation().getMapCoordinates());
 			}
 		} else if(m_location != NULL) {
 			if(m_layer == NULL) {
-				m_layer = m_location->getLayer();
+				m_layer = m_location.getLayer();
 			}
-			p = cam->toScreenCoordinates(m_location->getMapCoordinates());
+			p = cam->toScreenCoordinates(m_location.getMapCoordinates());
 		} else if(m_layer == NULL) {
 			const std::list<Layer*>& layers = cam->getRenderer("GenericRenderer")->getActiveLayers();
 			std::list<Layer*>::const_reverse_iterator layer_it = layers.rbegin();
--- a/engine/core/view/renderers/genericrenderer.h	Sat Aug 07 16:36:35 2010 +0000
+++ b/engine/core/view/renderers/genericrenderer.h	Sun Aug 08 11:49:09 2010 +0000
@@ -40,46 +40,46 @@
 
 	class GenericRendererNode {
 	public:
-		GenericRendererNode(Instance* attached_instance, Location* relative_location, Layer* relative_layer, const Point &relative_point = Point(0,0));
-		GenericRendererNode(Instance* attached_instance, Location* relative_location, const Point &relative_point = Point(0,0));
+		GenericRendererNode(Instance* attached_instance, const Location &relative_location, Layer* relative_layer, const Point &relative_point = Point(0,0));
+		GenericRendererNode(Instance* attached_instance, const Location &relative_location, const Point &relative_point = Point(0,0));
 		GenericRendererNode(Instance* attached_instance, Layer* relative_layer, const Point &relative_point = Point(0,0));
 		GenericRendererNode(Instance* attached_instance, const Point &relative_point = Point(0,0));
-		GenericRendererNode(Location* attached_location, Layer* relative_layer, const Point &relative_point = Point(0,0));
-		GenericRendererNode(Location* attached_location, const Point &relative_point = Point(0,0));
+		GenericRendererNode(const Location &attached_location, Layer* relative_layer, const Point &relative_point = Point(0,0));
+		GenericRendererNode(const Location &attached_location, const Point &relative_point = Point(0,0));
 		GenericRendererNode(Layer* attached_layer, const Point &relative_point = Point(0,0));
 		GenericRendererNode(const Point &attached_point);
 		~GenericRendererNode();
 		
-		void setAttached(Instance* attached_instance, Location* relative_location, const Point &relative_point);
-		void setAttached(Instance* attached_instance, Location* relative_location);
+		void setAttached(Instance* attached_instance, const Location &relative_location, const Point &relative_point);
+		void setAttached(Instance* attached_instance, const Location &relative_location);
 		void setAttached(Instance* attached_instance, const Point &relative_point);
 		void setAttached(Instance* attached_instance);
-		void setAttached(Location* attached_location, const Point &relative_point);
-		void setAttached(Location* attached_location);
+		void setAttached(const Location &attached_location, const Point &relative_point);
+		void setAttached(const Location &attached_location);
 		void setAttached(Layer* attached_layer);
 		void setAttached(const Point &attached_point);
 		
-		void setRelative(Location* relative_location);
-		void setRelative(Location* relative_location, Point relative_point);
+		void setRelative(const Location &relative_location);
+		void setRelative(const Location &relative_location, Point relative_point);
 		void setRelative(const Point &relative_point);
 		
 		Instance* getAttachedInstance();
-		Location* getAttachedLocation();
+		Location getAttachedLocation();
 		Layer* getAttachedLayer();
 		Point getAttachedPoint();
 		
-		Location* getOffsetLocation();
+		Location getOffsetLocation();
 		Point getOffsetPoint();
 		
 		Instance* getInstance();
-		Location* getLocation();
+		Location getLocation();
 		Layer* getLayer();
 		Point getPoint();
 
 		Point getCalculatedPoint(Camera* cam, Layer* layer);
 	private:
 		Instance* m_instance;
-		Location* m_location;
+		Location m_location;
 		Layer* m_layer;
 		Point m_point;
 	};
--- a/engine/core/view/renderers/genericrenderer.i	Sat Aug 07 16:36:35 2010 +0000
+++ b/engine/core/view/renderers/genericrenderer.i	Sun Aug 08 11:49:09 2010 +0000
@@ -29,46 +29,46 @@
 	
 	class GenericRendererNode {
 	public:
-		GenericRendererNode(Instance* attached_instance, Location* relative_location, Layer* relative_layer, const Point &relative_point = Point(0,0));
-		GenericRendererNode(Instance* attached_instance, Location* relative_location, const Point &relative_point = Point(0,0));
+		GenericRendererNode(Instance* attached_instance, const Location &relative_location, Layer* relative_layer, const Point &relative_point = Point(0,0));
+		GenericRendererNode(Instance* attached_instance, const Location &relative_location, const Point &relative_point = Point(0,0));
 		GenericRendererNode(Instance* attached_instance, Layer* relative_layer, const Point &relative_point = Point(0,0));
 		GenericRendererNode(Instance* attached_instance, const Point &relative_point = Point(0,0));
-		GenericRendererNode(Location* attached_location, Layer* relative_layer, const Point &relative_point = Point(0,0));
-		GenericRendererNode(Location* attached_location, const Point &relative_point = Point(0,0));
+		GenericRendererNode(const Location &attached_location, Layer* relative_layer, const Point &relative_point = Point(0,0));
+		GenericRendererNode(const Location &attached_location, const Point &relative_point = Point(0,0));
 		GenericRendererNode(Layer* attached_layer, const Point &relative_point = Point(0,0));
 		GenericRendererNode(const Point &attached_point);
 		~GenericRendererNode();
 		
-		void setAttached(Instance* attached_instance, Location* relative_location, const Point &relative_point);
-		void setAttached(Instance* attached_instance, Location* relative_location);
+		void setAttached(Instance* attached_instance, const Location &relative_location, const Point &relative_point);
+		void setAttached(Instance* attached_instance, const Location &relative_location);
 		void setAttached(Instance* attached_instance, const Point &relative_point);
 		void setAttached(Instance* attached_instance);
-		void setAttached(Location* attached_location, const Point &relative_point);
-		void setAttached(Location* attached_location);
+		void setAttached(const Location &attached_location, const Point &relative_point);
+		void setAttached(const Location &attached_location);
 		void setAttached(Layer* attached_layer);
 		void setAttached(const Point &attached_point);
 		
-		void setRelative(Location* relative_location);
-		void setRelative(Location* relative_location, Point relative_point);
+		void setRelative(const Location &relative_location);
+		void setRelative(const Location &relative_location, Point relative_point);
 		void setRelative(const Point &relative_point);
 		
 		Instance* getAttachedInstance();
-		Location* getAttachedLocation();
+		Location getAttachedLocation();
 		Layer* getAttachedLayer();
 		Point getAttachedPoint();
 		
-		Location* getOffsetLocation();
+		Location getOffsetLocation();
 		Point getOffsetPoint();
 		
 		Instance* getInstance();
-		Location* getLocation();
+		Location getLocation();
 		Layer* getLayer();
 		Point getPoint();
 
 		Point getCalculatedPoint(Camera* cam, Layer* layer);
 	private:
 		Instance* m_instance;
-		Location* m_location;
+		Location m_location;
 		Layer* m_layer;
 		Point m_point;
 	};