summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--res/maps.xml10
-rw-r--r--res/maps.xsd2
-rw-r--r--tools/mapedit/src/map.cpp14
-rw-r--r--tools/mapedit/src/map.h4
-rw-r--r--tools/mapedit/src/object.cpp15
-rw-r--r--tools/mapedit/src/object.h8
-rw-r--r--tools/mapedit/src/widget.cpp7
-rw-r--r--tools/mapedit/src/world.cpp20
8 files changed, 70 insertions, 10 deletions
diff --git a/res/maps.xml b/res/maps.xml index c561912..81fe743 100644 --- a/res/maps.xml +++ b/res/maps.xml
@@ -1,5 +1,5 @@
1<?xml version="1.0" encoding="ISO-8859-1"?> 1<?xml version="1.0" encoding="ISO-8859-1"?>
2<world nextmap="6" lastmap="0" startx="203" starty="44" startmap="0"><root>0</root><map id="0" expanded="true" title="Everything Is Embarrassing"><environment type="0">0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,20,0,0,0,0,0,0,0,18,9,8,10,8,11,8,10,10,8,11,8,9,10,21,0, 2<world nextmap="6" lastmap="1" startx="203" starty="44" startmap="0"><root>0</root><map id="0" expanded="true" title="Everything Is Embarrassing" nextObject="0"><environment type="0">0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,20,0,0,0,0,0,0,0,18,9,8,10,8,11,8,10,10,8,11,8,9,10,21,0,
30,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,8,8,17,0,0,0,0,0,0,0,0,0,0,0,0,0,22,21, 30,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,8,8,17,0,0,0,0,0,0,0,0,0,0,0,0,0,22,21,
40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,8,8,8,8,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12, 40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,8,8,8,8,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,
50,19,0,0,0,0,0,0,0,0,0,0,0,18,8,8,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12, 50,19,0,0,0,0,0,0,0,0,0,0,0,18,8,8,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,
@@ -23,7 +23,7 @@
230,0,0,0,24,3,1,2,1,1,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,27,1,3,2,26,0,0,0,0,0,0, 230,0,0,0,24,3,1,2,1,1,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,27,1,3,2,26,0,0,0,0,0,0,
241,2,3,1,25,0,0,0,0,0,20,0,0,0,0,0,0,19,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,27,1,2,2,4,3,1, 241,2,3,1,25,0,0,0,0,0,20,0,0,0,0,0,0,19,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,27,1,2,2,4,3,1,
250,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0, 250,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,
26</environment><adjacent dir="left" type="warp" map="1"/><child>1</child><child>4</child><child>5</child></map><map id="1" expanded="false" title="It's A Trap!"><environment type="0">0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 26</environment><adjacent dir="left" type="warp" map="1"/><child>1</child><child>4</child><child>5</child></map><map id="1" expanded="false" title="It's A Trap!" nextObject="2"><environment type="0">0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
270,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0, 270,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,
280,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0, 280,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,
290,0,0,0,0,0,0,19,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 290,0,0,0,0,0,0,19,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -47,7 +47,7 @@
470,0,0,27,2,2,3,3,3,4,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 470,0,0,27,2,2,3,3,3,4,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
480,20,0,0,0,0,0,19,0,0,27,1,1,1,2,2,2,26,0,0,0,0,0,0,0,0,0,0,24,4,2,2,1,3,2,2,1,2,2,3, 480,20,0,0,0,0,0,19,0,0,27,1,1,1,2,2,2,26,0,0,0,0,0,0,0,0,0,0,24,4,2,2,1,3,2,2,1,2,2,3,
490,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,19,0,0,0,0,0, 490,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,19,0,0,0,0,0,
50</environment><entity type="checkpoint" x="262" y="156"/><adjacent dir="right" type="warp" map="0"/><adjacent dir="down" type="warp" map="4"/></map><map id="4" expanded="false" title="The Visitors"><environment type="0">0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0, 50</environment><entity type="checkpoint" x="262" y="156" index="0"/><entity type="checkpoint" x="76" y="141" index="1"/><adjacent dir="right" type="warp" map="0"/><adjacent dir="down" type="warp" map="4"/></map><map id="4" expanded="false" title="The Visitors" nextObject="0"><environment type="0">0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,
510,0,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,13,0,0,0,0,0,0,20,0,0,0,0, 510,0,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,13,0,0,0,0,0,0,20,0,0,0,0,
520,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0, 520,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,
530,0,0,0,19,0,0,0,0,0,0,0,0,0,20,0,0,15,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0, 530,0,0,0,19,0,0,0,0,0,0,0,0,0,20,0,0,15,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,
@@ -71,7 +71,7 @@
710,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0, 710,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,
720,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,15,0,0,0,0,0,0,0,0,0,0,13,0,0,0,0,0,0,0,0,0,0,0, 720,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,15,0,0,0,0,0,0,0,0,0,0,13,0,0,0,0,0,0,0,0,0,0,0,
730,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0, 730,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,
74</environment><adjacent dir="up" type="warp" map="1"/><adjacent dir="down" type="warp" map="5"/></map><map id="5" expanded="false" title="Now Is The Hour"><environment type="0">0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,13,0,0,0,0,0,0,0,0,0,0,0, 74</environment><adjacent dir="up" type="warp" map="1"/><adjacent dir="down" type="warp" map="5"/></map><map id="5" expanded="false" title="Now Is The Hour" nextObject="1"><environment type="0">0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,13,0,0,0,0,0,0,0,0,0,0,0,
750,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,13,0,0,0,0,0,0,0,0,0,0,0, 750,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,13,0,0,0,0,0,0,0,0,0,0,0,
760,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,13,0,0,0,20,0,0,0,0,0,0,0, 760,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,13,0,0,0,20,0,0,0,0,0,0,0,
770,0,0,19,0,0,0,0,0,0,0,0,19,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,19,0,0,0,0,0, 770,0,0,19,0,0,0,0,0,0,0,0,19,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,19,0,0,0,0,0,
@@ -95,4 +95,4 @@
952,2,2,2,2,2,26,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,12,0,0,0,0,0,0,0,0,0, 952,2,2,2,2,2,26,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,12,0,0,0,0,0,0,0,0,0,
960,0,0,0,0,0,27,1,3,4,2,1,3,2,1,1,2,4,1,1,1,3,1,1,4,2,1,3,4,1,25,19,0,0,0,0,0,0,0,0, 960,0,0,0,0,0,27,1,3,4,2,1,3,2,1,1,2,4,1,1,1,3,1,1,4,2,1,3,4,1,25,19,0,0,0,0,0,0,0,0,
970,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 970,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
98</environment><entity type="movplat" x="98" y="145"><item id="dir">1</item><item id="len">90</item><item id="speed">30</item></entity><adjacent dir="up" type="warp" map="4"/></map></world> 98</environment><entity type="movplat" x="98" y="145" index="0"><item id="dir">1</item><item id="len">90</item><item id="speed">30</item></entity><adjacent dir="up" type="warp" map="4"/></map></world>
diff --git a/res/maps.xsd b/res/maps.xsd index 9d36fab..64fd21f 100644 --- a/res/maps.xsd +++ b/res/maps.xsd
@@ -54,6 +54,7 @@
54 <xs:attribute name="type" type="xs:string" use="required" /> 54 <xs:attribute name="type" type="xs:string" use="required" />
55 <xs:attribute name="x" type="xs:integer" use="required" /> 55 <xs:attribute name="x" type="xs:integer" use="required" />
56 <xs:attribute name="y" type="xs:integer" use="required" /> 56 <xs:attribute name="y" type="xs:integer" use="required" />
57 <xs:attribute name="index" type="xs:integer" use="required" />
57 </xs:complexType> 58 </xs:complexType>
58 </xs:element> 59 </xs:element>
59 60
@@ -77,6 +78,7 @@
77 </xs:restriction> 78 </xs:restriction>
78 </xs:simpleType> 79 </xs:simpleType>
79 </xs:attribute> 80 </xs:attribute>
81 <xs:attribute name="nextObject" type="xs:integer" use="required" />
80 </xs:complexType> 82 </xs:complexType>
81 </xs:element> 83 </xs:element>
82 </xs:sequence> 84 </xs:sequence>
diff --git a/tools/mapedit/src/map.cpp b/tools/mapedit/src/map.cpp index a099e29..7e6c3c0 100644 --- a/tools/mapedit/src/map.cpp +++ b/tools/mapedit/src/map.cpp
@@ -188,6 +188,11 @@ const Map::Adjacent& Map::getAdjacent(MoveDir direction) const
188 } 188 }
189} 189}
190 190
191size_t Map::getNextObjectIndex() const
192{
193 return nextObjectIndex;
194}
195
191void Map::setTitle(std::string title, bool dirty) 196void Map::setTitle(std::string title, bool dirty)
192{ 197{
193 this->title = title; 198 this->title = title;
@@ -271,3 +276,12 @@ void Map::setAdjacent(MoveDir direction, MoveType type, int map, bool dirty)
271 } 276 }
272} 277}
273 278
279size_t Map::getAndIncrementNextObjectIndex()
280{
281 return nextObjectIndex++;
282}
283
284void Map::setNextObjectIndex(size_t v)
285{
286 nextObjectIndex = v;
287}
diff --git a/tools/mapedit/src/map.h b/tools/mapedit/src/map.h index 9c14218..1ae905f 100644 --- a/tools/mapedit/src/map.h +++ b/tools/mapedit/src/map.h
@@ -89,6 +89,7 @@ class Map {
89 bool getHidden() const; 89 bool getHidden() const;
90 const std::map<MoveDir, Adjacent>& getAdjacents() const; 90 const std::map<MoveDir, Adjacent>& getAdjacents() const;
91 const Adjacent& getAdjacent(MoveDir direction) const; 91 const Adjacent& getAdjacent(MoveDir direction) const;
92 size_t getNextObjectIndex() const;
92 93
93 void setTitle(std::string title, bool dirty = true); 94 void setTitle(std::string title, bool dirty = true);
94 void setTileAt(int x, int y, int tile, bool dirty = true); 95 void setTileAt(int x, int y, int tile, bool dirty = true);
@@ -100,6 +101,8 @@ class Map {
100 void setExpanded(bool exp); 101 void setExpanded(bool exp);
101 void setHidden(bool hid); 102 void setHidden(bool hid);
102 void setAdjacent(MoveDir direction, MoveType type, int map = -1, bool dirty = true); 103 void setAdjacent(MoveDir direction, MoveType type, int map = -1, bool dirty = true);
104 size_t getAndIncrementNextObjectIndex();
105 void setNextObjectIndex(size_t v);
103 106
104 private: 107 private:
105 int id; 108 int id;
@@ -113,6 +116,7 @@ class Map {
113 bool hidden = false; 116 bool hidden = false;
114 std::map<MoveDir, Adjacent> adjacents; 117 std::map<MoveDir, Adjacent> adjacents;
115 const Adjacent defaultAdjacent {}; 118 const Adjacent defaultAdjacent {};
119 size_t nextObjectIndex = 0;
116}; 120};
117 121
118class MapPtrCtr : public wxTreeItemData { 122class MapPtrCtr : public wxTreeItemData {
diff --git a/tools/mapedit/src/object.cpp b/tools/mapedit/src/object.cpp index 8ed29af..aeb8fc1 100644 --- a/tools/mapedit/src/object.cpp +++ b/tools/mapedit/src/object.cpp
@@ -184,9 +184,15 @@ bool MapObject::operator!=(const MapObject& other) const
184 return id != other.id; 184 return id != other.id;
185} 185}
186 186
187MapObjectEntry::MapObjectEntry(const MapObject& object, int posx, int posy) : object(object) 187MapObjectEntry::MapObjectEntry(
188 const MapObject& object,
189 int posx,
190 int posy,
191 size_t index) :
192 object(object),
193 position(std::make_pair(posx, posy)),
194 index(index)
188{ 195{
189 position = std::make_pair(posx, posy);
190} 196}
191 197
192const MapObject& MapObjectEntry::getObject() const 198const MapObject& MapObjectEntry::getObject() const
@@ -209,6 +215,11 @@ const std::map<std::string, MapObjectEntry::Item>& MapObjectEntry::getItems() co
209 return items; 215 return items;
210} 216}
211 217
218size_t MapObjectEntry::getIndex() const
219{
220 return index;
221}
222
212void MapObjectEntry::addItem(std::string id, Item& item) 223void MapObjectEntry::addItem(std::string id, Item& item)
213{ 224{
214 items[id] = item; 225 items[id] = item;
diff --git a/tools/mapedit/src/object.h b/tools/mapedit/src/object.h index a870a2e..a87fa96 100644 --- a/tools/mapedit/src/object.h +++ b/tools/mapedit/src/object.h
@@ -67,7 +67,11 @@ class MapObject {
67 67
68class MapObjectEntry { 68class MapObjectEntry {
69 public: 69 public:
70 MapObjectEntry(const MapObject& object, int posx, int posy); 70 MapObjectEntry(
71 const MapObject& object,
72 int posx,
73 int posy,
74 size_t index);
71 75
72 struct Item { 76 struct Item {
73 MapObject::Input::Type type; 77 MapObject::Input::Type type;
@@ -78,6 +82,7 @@ class MapObjectEntry {
78 std::pair<int, int> getPosition() const; 82 std::pair<int, int> getPosition() const;
79 Item& getItem(std::string str); 83 Item& getItem(std::string str);
80 const std::map<std::string, Item>& getItems() const; 84 const std::map<std::string, Item>& getItems() const;
85 size_t getIndex() const;
81 86
82 void setPosition(int x, int y); 87 void setPosition(int x, int y);
83 void addItem(std::string id, Item& item); 88 void addItem(std::string id, Item& item);
@@ -89,6 +94,7 @@ class MapObjectEntry {
89 const MapObject& object; 94 const MapObject& object;
90 std::pair<int, int> position; 95 std::pair<int, int> position;
91 std::map<std::string, Item> items; 96 std::map<std::string, Item> items;
97 size_t index;
92}; 98};
93 99
94class VariableChoiceValidator : public wxValidator { 100class VariableChoiceValidator : public wxValidator {
diff --git a/tools/mapedit/src/widget.cpp b/tools/mapedit/src/widget.cpp index 8d74b39..85838e6 100644 --- a/tools/mapedit/src/widget.cpp +++ b/tools/mapedit/src/widget.cpp
@@ -256,7 +256,12 @@ void MapeditWidget::OnClick(wxMouseEvent& event)
256 int x = (event.GetPosition().x + vX - EDITOR_SPACING_X*scale) / scale - (addingEntity->getWidth() / 2); 256 int x = (event.GetPosition().x + vX - EDITOR_SPACING_X*scale) / scale - (addingEntity->getWidth() / 2);
257 int y = (event.GetPosition().y + vY - EDITOR_SPACING_Y*scale) / scale - (addingEntity->getHeight() / 2); 257 int y = (event.GetPosition().y + vY - EDITOR_SPACING_Y*scale) / scale - (addingEntity->getHeight() / 2);
258 258
259 auto data = std::make_shared<MapObjectEntry>(*addingEntity, x, y); 259 auto data = std::make_shared<MapObjectEntry>(
260 *addingEntity,
261 x,
262 y,
263 map->getAndIncrementNextObjectIndex());
264
260 frame->commitAction(std::make_shared<Undoable>("Add " + addingEntity->getName(), [=] () { 265 frame->commitAction(std::make_shared<Undoable>("Add " + addingEntity->getName(), [=] () {
261 map->addObject(data); 266 map->addObject(data);
262 267
diff --git a/tools/mapedit/src/world.cpp b/tools/mapedit/src/world.cpp index 79f5a58..9983731 100644 --- a/tools/mapedit/src/world.cpp +++ b/tools/mapedit/src/world.cpp
@@ -94,6 +94,11 @@ World::World(std::string filename)
94 map->setTitle((char*) titleKey, false); 94 map->setTitle((char*) titleKey, false);
95 xmlFree(titleKey); 95 xmlFree(titleKey);
96 96
97 xmlChar* noiKey = xmlGetProp(node, (xmlChar*) "nextObject");
98 if (noiKey == 0) throw MapLoadException("map missing nextObject attribute");
99 map->setNextObjectIndex(atoi((char*) noiKey));
100 xmlFree(noiKey);
101
97 for (xmlNodePtr mapNode = node->xmlChildrenNode; mapNode != NULL; mapNode = mapNode->next) 102 for (xmlNodePtr mapNode = node->xmlChildrenNode; mapNode != NULL; mapNode = mapNode->next)
98 { 103 {
99 if (!xmlStrcmp(mapNode->name, (const xmlChar*) "environment")) 104 if (!xmlStrcmp(mapNode->name, (const xmlChar*) "environment"))
@@ -125,7 +130,12 @@ World::World(std::string filename)
125 int ypos = atoi((char*) yKey); 130 int ypos = atoi((char*) yKey);
126 xmlFree(yKey); 131 xmlFree(yKey);
127 132
128 auto data = std::make_shared<MapObjectEntry>(obj, xpos, ypos); 133 xmlChar* indexKey = xmlGetProp(mapNode, (const xmlChar*) "index");
134 if (indexKey == 0) throw MapLoadException("entity missing index attribute");
135 int objIndex = atoi((char*) indexKey);
136 xmlFree(indexKey);
137
138 auto data = std::make_shared<MapObjectEntry>(obj, xpos, ypos, objIndex);
129 139
130 map->addObject(data, false); 140 map->addObject(data, false);
131 141
@@ -312,6 +322,10 @@ void World::save(std::string name, wxTreeCtrl* mapTree)
312 // title= 322 // title=
313 rc = xmlTextWriterWriteAttribute(writer, (xmlChar*) "title", (xmlChar*) map.getTitle().c_str()); 323 rc = xmlTextWriterWriteAttribute(writer, (xmlChar*) "title", (xmlChar*) map.getTitle().c_str());
314 if (rc < 0) throw MapWriteException(name); 324 if (rc < 0) throw MapWriteException(name);
325
326 // nextObject=
327 rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "nextObject", "%zu", map.getNextObjectIndex());
328 if (rc < 0) throw MapWriteException(name);
315 329
316 // <environment 330 // <environment
317 rc = xmlTextWriterStartElement(writer, (xmlChar*) "environment"); 331 rc = xmlTextWriterStartElement(writer, (xmlChar*) "environment");
@@ -358,6 +372,10 @@ void World::save(std::string name, wxTreeCtrl* mapTree)
358 rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "y", "%d", object->getPosition().second); 372 rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "y", "%d", object->getPosition().second);
359 if (rc < 0) throw MapWriteException(name); 373 if (rc < 0) throw MapWriteException(name);
360 374
375 // index=
376 rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "index", "%zu", object->getIndex());
377 if (rc < 0) throw MapWriteException(name);
378
361 for (auto item : object->getItems()) 379 for (auto item : object->getItems())
362 { 380 {
363 // <item 381 // <item