summary refs log tree commit diff stats
path: root/tools/mapedit/src
diff options
context:
space:
mode:
Diffstat (limited to 'tools/mapedit/src')
-rw-r--r--tools/mapedit/src/frame.cpp14
-rw-r--r--tools/mapedit/src/frame.h2
-rw-r--r--tools/mapedit/src/world.cpp7
-rw-r--r--tools/mapedit/src/world.h2
4 files changed, 22 insertions, 3 deletions
diff --git a/tools/mapedit/src/frame.cpp b/tools/mapedit/src/frame.cpp index 934e0f8..94be15e 100644 --- a/tools/mapedit/src/frame.cpp +++ b/tools/mapedit/src/frame.cpp
@@ -265,7 +265,13 @@ void MapeditFrame::OnOpen(wxCommandEvent&)
265 return; 265 return;
266 } 266 }
267 267
268 OpenWorld(openFileDialog.GetPath().ToStdString()); 268 if (OpenWorld(openFileDialog.GetPath().ToStdString()))
269 {
270 if (world->getEmpty())
271 {
272 Close(true);
273 }
274 }
269} 275}
270 276
271void MapeditFrame::OnSave(wxCommandEvent&) 277void MapeditFrame::OnSave(wxCommandEvent&)
@@ -429,17 +435,21 @@ void MapeditFrame::NewWorld()
429 LaunchWindow(std::unique_ptr<World>(new World())); 435 LaunchWindow(std::unique_ptr<World>(new World()));
430} 436}
431 437
432void MapeditFrame::OpenWorld(std::string filename) 438bool MapeditFrame::OpenWorld(std::string filename)
433{ 439{
434 try 440 try
435 { 441 {
436 auto world = std::unique_ptr<World>(new World(filename)); 442 auto world = std::unique_ptr<World>(new World(filename));
437 443
438 LaunchWindow(std::move(world)); 444 LaunchWindow(std::move(world));
445
446 return true;
439 } catch (std::exception& ex) 447 } catch (std::exception& ex)
440 { 448 {
441 wxMessageBox(ex.what(), "Error loading world", wxOK | wxCENTRE | wxICON_ERROR); 449 wxMessageBox(ex.what(), "Error loading world", wxOK | wxCENTRE | wxICON_ERROR);
442 } 450 }
451
452 return false;
443} 453}
444 454
445void MapeditFrame::LaunchWindow(std::unique_ptr<World> world) 455void MapeditFrame::LaunchWindow(std::unique_ptr<World> world)
diff --git a/tools/mapedit/src/frame.h b/tools/mapedit/src/frame.h index 4844485..6085eb2 100644 --- a/tools/mapedit/src/frame.h +++ b/tools/mapedit/src/frame.h
@@ -33,7 +33,7 @@ class MapeditFrame : public wxFrame {
33 void MapDirtyDidChange(bool dirty); 33 void MapDirtyDidChange(bool dirty);
34 34
35 static void NewWorld(); 35 static void NewWorld();
36 static void OpenWorld(std::string filename); 36 static bool OpenWorld(std::string filename);
37 37
38 std::list<wxWindow*>::iterator closer; 38 std::list<wxWindow*>::iterator closer;
39 39
diff --git a/tools/mapedit/src/world.cpp b/tools/mapedit/src/world.cpp index f7b541d..c30f76c 100644 --- a/tools/mapedit/src/world.cpp +++ b/tools/mapedit/src/world.cpp
@@ -9,6 +9,7 @@ World::World()
9 newMap(); 9 newMap();
10 10
11 rootChildren.push_back(0); 11 rootChildren.push_back(0);
12 empty = true;
12} 13}
13 14
14World::World(std::string filename) 15World::World(std::string filename)
@@ -170,6 +171,7 @@ std::shared_ptr<Map> World::getMap(int id) const
170 171
171void World::setDirty(bool dirty) 172void World::setDirty(bool dirty)
172{ 173{
174 if (dirty) empty = false;
173 this->dirty = dirty; 175 this->dirty = dirty;
174 parent->MapDirtyDidChange(dirty); 176 parent->MapDirtyDidChange(dirty);
175} 177}
@@ -372,3 +374,8 @@ void World::setLastMap(Map* map)
372{ 374{
373 lastmap = map->getID(); 375 lastmap = map->getID();
374} 376}
377
378bool World::getEmpty() const
379{
380 return empty;
381}
diff --git a/tools/mapedit/src/world.h b/tools/mapedit/src/world.h index c30f4b4..a2b5235 100644 --- a/tools/mapedit/src/world.h +++ b/tools/mapedit/src/world.h
@@ -32,6 +32,7 @@ class World {
32 void setLastMap(Map* map); 32 void setLastMap(Map* map);
33 std::list<std::shared_ptr<Map>> getRootMaps() const; 33 std::list<std::shared_ptr<Map>> getRootMaps() const;
34 const std::map<int, std::shared_ptr<Map>> getMaps() const; 34 const std::map<int, std::shared_ptr<Map>> getMaps() const;
35 bool getEmpty() const;
35 36
36 private: 37 private:
37 MapeditFrame* parent; 38 MapeditFrame* parent;
@@ -41,6 +42,7 @@ class World {
41 std::string filename; 42 std::string filename;
42 int lastmap = 0; 43 int lastmap = 0;
43 std::list<int> rootChildren; 44 std::list<int> rootChildren;
45 bool empty = false;
44}; 46};
45 47
46#endif 48#endif
on, add final pillars randomization' href='/witness-tutorializer/commit/Source/Randomizer.cpp?id=d99313f4e4fdf5103c5f149e2d54dbf6e4fcc3f2'>d99313f ^
e762e48 ^
ecc14a3 ^
d99313f ^
1cad987 ^
d99313f ^
1cad987 ^
d99313f ^
1cad987 ^
d99313f ^
ecc14a3 ^
d99313f ^

ecc14a3 ^
d99313f ^

1cad987 ^







3f16a3e ^

d99313f ^

2270169 ^
d99313f ^
4edd6ab ^
1cad987 ^
4edd6ab ^
1cad987 ^
8020f95 ^
d99313f ^

e762e48 ^


1cad987 ^
d99313f ^
1cad987 ^
d99313f ^
1cad987 ^
3f16a3e ^

d99313f ^
4edd6ab ^

d99313f ^


e762e48 ^
1cad987 ^
3f16a3e ^

d99313f ^





e762e48 ^
d99313f ^

e762e48 ^
1cad987 ^
d99313f ^
3f16a3e ^
d99313f ^


d99313f ^
e762e48 ^

1cad987 ^
d99313f ^
3f16a3e ^
d99313f ^
4edd6ab ^
4edd6ab ^
d99313f ^
eb42060 ^
53bf008 ^
4edd6ab ^
0d728e6 ^


1cad987 ^
0d728e6 ^





e762e48 ^

1cad987 ^
0d728e6 ^
1cad987 ^

0d728e6 ^
1cad987 ^

38475fd ^


eb42060 ^
5f99f9e ^




e762e48 ^
1cad987 ^










e762e48 ^
1cad987 ^
e762e48 ^
1cad987 ^










e762e48 ^
1cad987 ^

e762e48 ^
1cad987 ^

53bf008 ^
1cad987 ^




















53bf008 ^






1cad987 ^





1cad987 ^





















1cad987 ^







































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365