ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/layout.C
(Generate patch)

Comparing deliantra/server/random_maps/layout.C (file contents):
Revision 1.8 by root, Fri Jul 2 15:43:37 2010 UTC vs.
Revision 1.24 by root, Mon Jul 5 00:07:21 2010 UTC

23 23
24#include <global.h> 24#include <global.h>
25#include <random_map.h> 25#include <random_map.h>
26#include <rproto.h> 26#include <rproto.h>
27 27
28void noinline
28layout::layout (int w, int h) 29layout::alloc (int w, int h)
29: w(w), h(h)
30{ 30{
31 assert (sizeof (cell) == 1); 31 assert (sizeof (cell) == 1);
32
33 this->w = w;
34 this->h = h;
32 35
33 // we store the layout in a single contiguous memory layout 36 // we store the layout in a single contiguous memory layout
34 // first part consists of pointers to each column, followed 37 // first part consists of pointers to each column, followed
35 // by the actual columns (not rows!) 38 // by the actual columns (not rows!)
36 int size = (sizeof (cell *) + sizeof (cell) * h) * w; 39 size = (sizeof (cell *) + sizeof (cell) * h) * w;
37
38 data = (cell **)salloc<char> (size); 40 data = (cell **)salloc<char> (size);
39 41
40 cell *p = (cell *)(data + w); 42 cell *p = (cell *)(data + w);
41 43
42 for (int x = w; x--; ) 44 for (int x = 0; x < w; ++x)
43 data [x] = p + x * h; 45 data [x] = p + x * h;
44} 46}
45 47
48layout::layout (int w, int h)
49{
50 alloc (w, h);
51}
52
53layout::layout (layout &copy)
54{
55 alloc (copy.w, copy.h);
56
57 memcpy (data [0], copy.data [0], sizeof (cell) * h * w);
58}
59
60layout::layout (layout &orig, int x1, int y1, int x2, int y2)
61{
62 w = x2 - x1;
63 h = y2 - y1;
64
65 // we only allocate space for the pointers
66 size = sizeof (cell *) * w;
67 data = (cell **)salloc<char> (size);
68
69 // and now we point back into the original layout
70 for (int x = 0; x < w; ++x)
71 data [x] = orig.data [x + x1] + y1;
72}
73
46layout::~layout () 74layout::~layout ()
47{ 75{
48 int size = (sizeof (cell *) + sizeof (cell) * h) * w;
49
50 sfree ((char *)data, size); 76 sfree ((char *)data, size);
51} 77}
52 78
53void 79void noinline
54layout::fill (char fill) 80layout::fill (char fill)
55{ 81{
56 memset (data [0], fill, w * h); 82 //memset (data [0], fill, w * h); // only when contiguous :/
83 fill_rect (0, 0, w, h, fill);
57} 84}
58 85
59void 86void noinline
87layout::replace (char from, char to)
88{
89 for (int x = 0; x < w; ++x)
90 for (int y = 0; y < h; ++y)
91 if (data [x][y] == from)
92 data [x][y] = to;
93}
94
95void noinline
60layout::rect (int x1, int y1, int x2, int y2, char fill) 96layout::rect (int x1, int y1, int x2, int y2, char fill)
97{
98 --x2;
99
100 memset (data [x1] + y1, fill, y2 - y1);
101 memset (data [x2] + y1, fill, y2 - y1);
102
103 while (++x1 < x2)
104 data [x1][y1] = data [x1][y2 - 1] = fill;
105}
106
107void noinline
108layout::fill_rect (int x1, int y1, int x2, int y2, char fill)
61{ 109{
62 for (; x1 < x2; ++x1) 110 for (; x1 < x2; ++x1)
63 memset (data [x1] + y1, fill, y2 - y1); 111 memset (data [x1] + y1, fill, y2 - y1);
64} 112}
65 113
66void layout::border (char fill)
67{
68 for (int i = 0; i < w; i++) data [i][0] = data [i][h - 1] = fill;
69 for (int j = 0; j < h; j++) data [0][j] = data [w - 1][j] = fill;
70}
71
72void 114void
115layout::border (char fill)
116{
117 rect (0, 0, w, h, fill);
118}
119
120void noinline
73layout::fill_rand (int percent) 121layout::fill_rand (int percent)
74{ 122{
75 percent = lerp (percent, 0, 100, 0, 256); 123 percent = lerp (percent, 0, 100, 0, 256);
76 124
77 for (int x = w - 1; --x > 0; ) 125 for (int x = 0; x < w; ++x)
78 for (int y = h - 1; --y > 0; ) 126 for (int y = 0; y < h; ++y)
79 data [x][y] = rmg_rndm (256) > percent ? 0 : '#'; 127 data [x][y] = rmg_rndm (256) > percent ? 0 : '#';
80} 128}
81 129
82///////////////////////////////////////////////////////////////////////////// 130/////////////////////////////////////////////////////////////////////////////
83 131
84// erode by cellular automata 132// erode by cellular automata
85void 133void noinline
86layout::erode_1_2 (int c1, int c2, int repeat) 134layout::erode_1_2 (int c1, int c2, int repeat)
87{ 135{
88 layout neu (w, h); 136 layout neu (w, h);
89 137
90 while (repeat--) 138 while (repeat--)
156///////////////////////////////////////////////////////////////////////////// 204/////////////////////////////////////////////////////////////////////////////
157// isolation remover - ensures single connected area 205// isolation remover - ensures single connected area
158 206
159typedef fixed_stack<point> pointlist; 207typedef fixed_stack<point> pointlist;
160 208
161static noinline void 209static void noinline
162push_flood_fill (layout &dist, pointlist &seeds, int x, int y) 210push_flood_fill (layout &dist, pointlist &seeds, int x, int y)
163{ 211{
164 if (dist [x][y]) 212 if (dist [x][y])
165 return; 213 return;
166 214
177 ++y; 225 ++y;
178 } 226 }
179 227
180 while (--y >= y0) 228 while (--y >= y0)
181 { 229 {
182 if (x > 0) push_flood_fill (dist, seeds, x - 1, y); 230 if (x > 0 && !dist [x - 1][y]) push_flood_fill (dist, seeds, x - 1, y);
183 if (x < dist.w - 1) push_flood_fill (dist, seeds, x + 1, y); 231 if (x < dist.w - 1 && !dist [x + 1][y]) push_flood_fill (dist, seeds, x + 1, y);
184 } 232 }
185} 233}
186 234
187static inline void 235static void inline
188make_tunnel (layout &dist, pointlist &seeds, int x, int y, U8 d) 236make_tunnel (layout &dist, pointlist &seeds, int x, int y, U8 d, int perturb)
189{ 237{
190 for (;;) 238 for (;;)
191 { 239 {
240 point neigh[4];
241 int ncnt = 0;
242
243 d += perturb > 1;
244
192 if (x > 1 && U8 (dist [x - 1][y]) < d && dist [x - 1][y] > 1) 245 if (x > 0 && U8 (dist [x - 1][y]) < d && dist [x - 1][y] > 1) neigh [ncnt++] = point (x - 1, y);
193 --x;
194 else if (x < dist.w - 2 && U8 (dist [x + 1][y]) < d && dist [x + 1][y] > 1) 246 if (x < dist.w - 1 && U8 (dist [x + 1][y]) < d && dist [x + 1][y] > 1) neigh [ncnt++] = point (x + 1, y);
195 ++x;
196 else if (y > 1 && U8 (dist [x][y - 1]) < d && dist [x][y - 1] > 1) 247 if (y > 0 && U8 (dist [x][y - 1]) < d && dist [x][y - 1] > 1) neigh [ncnt++] = point (x, y - 1);
197 --y;
198 else if (y < dist.h - 2 && U8 (dist [x][y + 1]) < d && dist [x][y + 1] > 1) 248 if (y < dist.h - 1 && U8 (dist [x][y + 1]) < d && dist [x][y + 1] > 1) neigh [ncnt++] = point (x, y + 1);
199 ++y; 249
200 else 250 if (!ncnt)
201 break; 251 return;
252
253 point p = neigh [perturb ? rmg_rndm (ncnt) : 0];
254
255 seeds.push (p);
256
257 x = p.x;
258 y = p.y;
202 259
203 d = dist [x][y]; 260 d = dist [x][y];
204 dist [x][y] = 1; 261 dist [x][y] = 1;
205 seeds.push (point (x, y));
206 } 262 }
207} 263}
208 264
209static void inline 265static void inline
210maybe_push (layout &dist, pointlist &seeds, int x, int y, U8 d) 266maybe_push (layout &dist, pointlist &seeds, int x, int y, U8 d)
217 return; 273 return;
218 274
219 seeds.push (point (x, y)); 275 seeds.push (point (x, y));
220} 276}
221 277
222void 278// isolation remover, works on a "distance" map
223layout::isolation_remover (bool dirty) 279// the map must be initialised with 0 == rooms, 255 = walls
280static void noinline
281isolation_remover (layout &dist, unsigned int perturb = 2)
224{ 282{
225 layout dist (w, h);
226
227 // dist contains 283 // dist contains
228 // 0 == invisited rooms 284 // 0 == invisited rooms
229 // 1 == visited rooms 285 // 1 == visited rooms
230 // 2+ shortest distance to random near room 286 // 2+ shortest distance to random near room
231 287
232 // phase 1, initialise dist array, find seed 288 clamp_it (perturb, 0, 2);
289
290 // phase 1, find seed
233 int cnt = 0; 291 int cnt = 0;
234 int x, y; 292 int x, y;
235 293
236 for (int i = 0; i < w; ++i) 294 for (int i = 0; i < dist.w; ++i)
237 for (int j = 0; j < h; ++j) 295 for (int j = 0; j < dist.h; ++j)
238 { 296 if (!dist [i][j] && !rmg_rndm (++cnt))
239 if (data [i][j] == '#')
240 dist [i][j] = U8 (255);
241 else
242 {
243 dist [i][j] = 0;
244 if (!rmg_rndm (++cnt))
245 x = i, y = j; 297 x = i, y = j;
246 }
247 }
248 298
249 if (!cnt) 299 if (!cnt)
250 { 300 {
251 // map is completely massive, this is not good, 301 // map is completely massive, this is not good,
252 // so make it empty instead. 302 // so make it empty instead.
253 clear (); 303 dist.fill (1);
254 border ();
255 return; 304 return;
256 } 305 }
257 306
258 fixed_stack<point> seeds (w * h * 5); 307 fixed_stack<point> seeds (dist.w * dist.h * 5);
259 308
260 // found first free space - picking the first one gives 309 // found first free space - picking the first one gives
261 // us a slight bias for tunnels, but usually you won't 310 // us a slight bias for tunnels, but usually you won't
262 // notice that in-game 311 // notice that in-game
263 seeds.push (point (x, y)); 312 seeds.push (point (x, y));
275 y = p.y; 324 y = p.y;
276 325
277 if (!dist [x][y]) 326 if (!dist [x][y])
278 { 327 {
279 // found new isolated area, make tunnel 328 // found new isolated area, make tunnel
280 if (!dirty)
281 push_flood_fill (dist, seeds, x, y); 329 push_flood_fill (dist, seeds, x, y);
282
283 make_tunnel (dist, seeds, x, y, 255); 330 make_tunnel (dist, seeds, x, y, 254, perturb);
284
285 if (dirty)
286 push_flood_fill (dist, seeds, x, y);
287 } 331 }
288 else 332 else
289 { 333 {
290 // nothing here, continue to expand 334 // nothing here, continue to expand
291 U8 d = U8 (dist [x][y]) + 1; 335 U8 d = U8 (dist [x][y]) + 1;
294 if (x > 0) maybe_push (dist, seeds, x - 1, y, d); 338 if (x > 0) maybe_push (dist, seeds, x - 1, y, d);
295 if (y < dist.h - 1) maybe_push (dist, seeds, x, y + 1, d); 339 if (y < dist.h - 1) maybe_push (dist, seeds, x, y + 1, d);
296 if (y > 0) maybe_push (dist, seeds, x, y - 1, d); 340 if (y > 0) maybe_push (dist, seeds, x, y - 1, d);
297 } 341 }
298 } 342 }
343}
344
345void
346layout::isolation_remover (int perturb)
347{
348 layout dist (w - 2, h - 2); // map without border
349
350 for (int x = 1; x < w - 1; ++x)
351 for (int y = 1; y < h - 1; ++y)
352 dist [x - 1][y - 1] = data [x][y] == '#' ? U8 (255) : 0;
353
354 ::isolation_remover (dist, perturb);
299 355
300 // now copy the tunnels over 356 // now copy the tunnels over
301 for (int x = 0; x < w; ++x) 357 for (int x = 1; x < w - 1; ++x)
302 for (int y = 0; y < h; ++y) 358 for (int y = 1; y < h - 1; ++y)
303 if (data [x][y] == '#' && dist [x][y] == 1) 359 if (data [x][y] == '#' && dist [x - 1][y - 1] == 1)
304 data [x][y] = 0; 360 data [x][y] = 0;
305}
306
307/////////////////////////////////////////////////////////////////////////////
308
309// inspired mostly by http://www.jimrandomh.org/misc/caves.txt
310void
311layout::gen_cave (int subtype)
312{
313 switch (subtype)
314 {
315 // a rough cave
316 case 0:
317 fill_rand (rmg_rndm (80, 95));
318 break;
319
320 // corridors
321 case 1:
322 fill_rand (rmg_rndm (5, 40));
323 erode_1_2 (5, 2, 10);
324 erode_1_2 (5, -1, 10);
325 erode_1_2 (5, 2, 1);
326 break;
327
328 // somewhat open, roundish
329 case 2:
330 fill_rand (45);
331 erode_1_2 (5, 0, 5);
332 erode_1_2 (5, 1, 1);
333 break;
334
335 // wide open, some room-like structures
336 case 3:
337 fill_rand (45);
338 erode_1_2 (5, 2, 4);
339 erode_1_2 (5, -1, 3);
340 break;
341 }
342
343 border ();
344 isolation_remover ();
345} 361}
346 362
347///////////////////////////////////////////////////////////////////////////// 363/////////////////////////////////////////////////////////////////////////////
348 364
349//+GPL 365//+GPL
351/* puts doors at appropriate locations in a maze. */ 367/* puts doors at appropriate locations in a maze. */
352void 368void
353layout::doorify () 369layout::doorify ()
354{ 370{
355 int ndoors = w * h / 60; /* reasonable number of doors. */ 371 int ndoors = w * h / 60; /* reasonable number of doors. */
356 int doorlocs = 0; /* # of available doorlocations */
357 372
358 uint16 *doorlist_x = salloc<uint16> (w * h); 373 coroapi::cede_to_tick ();
359 uint16 *doorlist_y = salloc<uint16> (w * h); 374
375 fixed_stack<point> doorloc (w * h);
360 376
361 /* make a list of possible door locations */ 377 /* make a list of possible door locations */
362 for (int i = 1; i < w - 1; i++) 378 for (int i = 1; i < w - 1; i++)
363 for (int j = 1; j < h - 1; j++) 379 for (int j = 1; j < h - 1; j++)
364 { 380 {
365 int sindex = surround_flag (*this, i, j); 381 int sindex = surround_flag (*this, i, j);
366 382
367 if (sindex == 3 || sindex == 12) /* these are possible door sindex */ 383 if (sindex == 3 || sindex == 12) /* these are possible door sindex */
368 { 384 doorloc.push (point (i, j));
369 doorlist_x [doorlocs] = i;
370 doorlist_y [doorlocs] = j;
371 doorlocs++;
372 }
373 } 385 }
374 386
375 while (ndoors > 0 && doorlocs > 0) 387 while (ndoors && doorloc.size)
376 { 388 {
377 int di = rmg_rndm (doorlocs); 389 point p = doorloc.remove (rmg_rndm (doorloc.size));
378 int i = doorlist_x [di]; 390
379 int j = doorlist_y [di];
380 int sindex = surround_flag (*this, i, j); 391 int sindex = surround_flag (*this, p.x, p.y);
381 392
382 if (sindex == 3 || sindex == 12) /* these are possible door sindex */ 393 if (sindex == 3 || sindex == 12) /* these are possible door sindex */
383 { 394 {
384 data [i][j] = 'D'; 395 data [p.x][p.y] = 'D';
385 ndoors--; 396 --ndoors;
386 } 397 }
387
388 /* reduce the size of the list */
389 doorlocs--;
390 doorlist_x[di] = doorlist_x [doorlocs];
391 doorlist_y[di] = doorlist_y [doorlocs];
392 } 398 }
393
394 sfree (doorlist_x, w * h);
395 sfree (doorlist_y, w * h);
396} 399}
397 400
398/* takes a map and makes it symmetric: adjusts Xsize and 401/* takes a map and makes it symmetric: adjusts Xsize and
399 * Ysize to produce a symmetric map. 402 * Ysize to produce a symmetric map.
400 */ 403 */
458//-GPL 461//-GPL
459 462
460void 463void
461layout::rotate (int rotation) 464layout::rotate (int rotation)
462{ 465{
466 coroapi::cede_to_tick ();
467
463 switch (rotation & 3) 468 switch (rotation & 3)
464 { 469 {
465 case 2: /* a reflection */ 470 case 2: /* a reflection */
466 { 471 {
467 layout new_layout (w, h); 472 layout new_layout (w, h);
619{ 624{
620 layout new_layout (w * 2 - 1, h * 2 - 1); 625 layout new_layout (w * 2 - 1, h * 2 - 1);
621 626
622 new_layout.clear (); 627 new_layout.clear ();
623 628
629 coroapi::cede_to_tick ();
630
624 for (int i = 0; i < w; i++) 631 for (int i = 0; i < w; i++)
625 for (int j = 0; j < h; j++) 632 for (int j = 0; j < h; j++)
626 switch (data [i][j]) 633 switch (data [i][j])
627 { 634 {
628 case '#': expand_wall (new_layout, i, j, *this); break; 635 case '#': expand_wall (new_layout, i, j, *this); break;
710 717
711 return -1; 718 return -1;
712} 719}
713 720
714int 721int
715make_wall (char **maze, int x, int y, int dir) 722make_wall (layout &maze, int x, int y, int dir)
716{ 723{
717 maze[x][y] = 'D'; /* mark a door */ 724 maze[x][y] = 'D'; /* mark a door */
718 725
719 switch (dir) 726 switch (dir)
720 { 727 {
737 744
738void 745void
739layout::roomify () 746layout::roomify ()
740{ 747{
741 int tries = w * h / 30; 748 int tries = w * h / 30;
749
750 coroapi::cede_to_tick ();
742 751
743 for (int ti = 0; ti < tries; ti++) 752 for (int ti = 0; ti < tries; ti++)
744 { 753 {
745 /* starting location for looking at creating a door */ 754 /* starting location for looking at creating a door */
746 int dx = rmg_rndm (w); 755 int dx = rmg_rndm (w);
769 else 778 else
770 make_wall (*this, dx, dy, 1); 779 make_wall (*this, dx, dy, 1);
771 } 780 }
772} 781}
773 782
783//-GPL
784
774///////////////////////////////////////////////////////////////////////////// 785/////////////////////////////////////////////////////////////////////////////
786
787// inspired mostly by http://www.jimrandomh.org/misc/caves.txt
788void
789layout::gen_cave (int subtype)
790{
791 switch (subtype)
792 {
793 // a rough cave
794 case 0:
795 fill_rand (rmg_rndm (85, 97));
796 break;
797
798 // corridors
799 case 1:
800 fill_rand (rmg_rndm (5, 40));
801 erode_1_2 (5, 2, 10);
802 erode_1_2 (5, -1, 10);
803 erode_1_2 (5, 2, 1);
804 break;
805
806 // somewhat open, some room-like structures
807 case 2:
808 fill_rand (45);
809 erode_1_2 (5, 2, 4);
810 erode_1_2 (5, -1, 3);
811 break;
812
813 // wide open, roundish
814 case 3:
815 fill_rand (45);
816 erode_1_2 (5, 0, 5);
817 erode_1_2 (5, 1, 1);
818 break;
819 }
820
821 border ();
822 isolation_remover (1);
823}
824
825void
826layout::gen_castle ()
827{
828 fill ('#');
829
830 for (int n = w * h / 30 + 1; n--; )
831 {
832 int rw = rmg_rndm (6, 10);
833 int rh = rmg_rndm (6, 10);
834
835 if (rw > w || rh > h)
836 continue;
837
838 int rx = rmg_rndm (0, w - rw);
839 int ry = rmg_rndm (0, h - rh);
840
841 rect (rx, ry, rx + rw, ry + rh, '#');
842 fill_rect (rx + 1, ry + 1, rx + rw - 1, ry + rh - 1, 0);
843 }
844
845 border ();
846 isolation_remover (0);
847}
848
849static void
850gen_mixed_ (layout &maze, random_map_params *RP)
851{
852 if (maze.w > maze.h && maze.w > 16)
853 {
854 int m = rmg_rndm (8, maze.w - 8);
855
856 layout m1 (maze, 0, 0, m , maze.h); gen_mixed_ (m1, RP);
857 layout m2 (maze, m, 0, maze.w, maze.h); gen_mixed_ (m2, RP);
858 }
859 else if (maze.h > 16)
860 {
861 int m = rmg_rndm (8, maze.h - 8);
862
863 layout m1 (maze, 0, 0, maze.w, m ); gen_mixed_ (m1, RP);
864 layout m2 (maze, 0, m, maze.w, maze.h); gen_mixed_ (m2, RP);
865 }
866 else
867 {
868 RP->map_layout_style = rmg_rndm (NROFLAYOUTS - 2) + 1;
869
870 if (RP->map_layout_style == LAYOUT_MULTIPLE)
871 ++RP->map_layout_style;
872
873 maze.generate (RP);
874 }
875
876 coroapi::cede_to_tick ();
877}
878
879// recursive subdivision with random sublayouts
880static void
881gen_mixed (layout &maze, random_map_params *RP)
882{
883 random_map_params &rp = *new random_map_params (RP);
884 gen_mixed_ (maze, &rp);
885 delete &rp;
886
887 maze.border ();
888
889 // exits currently do not work so well, as they
890 // are currently often found together, so nuke entrances
891 maze.replace ('<', ' ');
892
893 maze.isolation_remover (0);
894}
895
896//+GPL
775 897
776/* function selects the maze function and gives it whatever 898/* function selects the maze function and gives it whatever
777 arguments it needs. */ 899 arguments it needs. */
778void 900void
779layout::generate (random_map_params *RP) 901layout::generate (random_map_params *RP)
839 if (rmg_rndm (2)) 961 if (rmg_rndm (2))
840 doorify (); 962 doorify ();
841 963
842 break; 964 break;
843 965
966 case LAYOUT_CASTLE:
967 gen_castle ();
968
969 if (rmg_rndm (2))
970 doorify ();
971
972 break;
973
974 case LAYOUT_MULTIPLE:
975 gen_mixed (*this, RP);
976 break;
977
844 default: 978 default:
845 abort (); 979 abort ();
846 } 980 }
981}
847 982
848 /* rotate the maze randomly */ 983//-GPL
849 rotate (rmg_rndm (4));
850
851 symmetrize (RP->symmetry_used);
852 984
853#if 0 985#if 0
854 print ();//D 986static void
855#endif 987gen_village (layout &maze)
988{
989 maze.clear ();
990 maze.border ();
856 991
857 if (RP->expand2x) 992 for (int n = maze.w * maze.h / 200 + 1; n--; )
858 expand2x (); 993 {
859} 994 int rw = rmg_rndm (6, 10);
995 int rh = rmg_rndm (6, 10);
860 996
861//-GPL 997 int rx = rmg_rndm (2, maze.w - rw - 2);
998 int ry = rmg_rndm (2, maze.h - rh - 2);
862 999
863#if 0 1000 maze.rect (rx, ry, rx + rw, ry + rh, '#');
1001 }
1002
1003 maze.border ();
1004 maze.isolation_remover (2);
1005}
1006
864static struct demo 1007static struct demo
865{ 1008{
866 demo () 1009 demo ()
867 { 1010 {
868 rmg_rndm.seed (time (0)); 1011 rmg_rndm.seed (time (0));
869 1012
870 for(int i=1;i<10;i) 1013 for(int i=1;i<100;i++)
871 { 1014 {
872 layout maze (10, 10); 1015 layout maze (40, 30);
873 maze.fill_rand (90); 1016 gen_village (maze);
874 maze.border ();
875 maze.isolation_remover ();
876 maze.doorify (); 1017 maze.doorify ();
877 maze.symmetrize (rmg_rndm (2, 4));
878 maze.rotate (rmg_rndm (4));
879 maze.expand2x ();
880 maze.print (); 1018 maze.print ();
1019 exit(0);
881 } 1020 }
882 1021
883 exit (1); 1022 exit (1);
884 } 1023 }
885} demo; 1024} demo;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines