Merge branch custom-entity-crash-fix. patched
authorachurch
Sun, 03 Apr 2011 03:05:13 +0900
branchpatched
changeset 665 966b75b0e1fa
parent 663 a4103c11bc5b (current diff)
parent 664 0306e3085534 (diff)
child 666 7f003f515faa
child 668 45b329ff7d2b
Merge branch custom-entity-crash-fix.
Aquaria/Game.cpp
Aquaria/Game.h
--- a/Aquaria/Game.cpp	Sun Apr 03 02:49:18 2011 +0900
+++ b/Aquaria/Game.cpp	Sun Apr 03 03:05:13 2011 +0900
@@ -2718,7 +2718,7 @@
 	if (createSaveData)
 	{
 		int idx = dsq->game->getIdxForEntityType(type);
-		entitySaveData.push_back(EntitySaveData(e, idx, usePos.x, usePos.y, rot, e->getGroupID(), e->getID()));
+		entitySaveData.push_back(EntitySaveData(e, idx, usePos.x, usePos.y, rot, e->getGroupID(), e->getID(), e->name));
 	}
 
 	addRenderObject(e, e->layer);
@@ -5645,8 +5645,8 @@
 
 			if (e->idx == -1)
 			{
-				if (!e->e->name.empty())
-					os << e->e->name << " ";
+				if (!e->name.empty())
+					os << e->name << " ";
 				else
 					os << "INVALID" << " ";
 			}
--- a/Aquaria/Game.h	Sun Apr 03 02:49:18 2011 +0900
+++ b/Aquaria/Game.h	Sun Apr 03 03:05:13 2011 +0900
@@ -606,9 +606,10 @@
 struct EntitySaveData
 {
 public:
-	EntitySaveData(Entity *e, int idx, int x, int y, int rot, int group, int id) : e(e), idx(idx), x(x), y(y), rot(rot), group(group), id(id) {}
+	EntitySaveData(Entity *e, int idx, int x, int y, int rot, int group, int id, const std::string &name) : e(e), idx(idx), x(x), y(y), rot(rot), group(group), id(id), name(name) {}
 	Entity *e;
 	int idx, x, y, rot, group, id;
+	std::string name;
 };
 
 class Game : public StateObject