1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2001 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2001 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
… | |
… | |
21 | * |
21 | * |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
23 | */ |
23 | */ |
24 | |
24 | |
25 | #include <global.h> |
25 | #include <global.h> |
26 | #include <random_map.h> |
26 | #include <rmg.h> |
27 | #include <sproto.h> |
27 | #include <sproto.h> |
28 | #include <rproto.h> |
28 | #include <rproto.h> |
29 | |
29 | |
30 | /* find a character in the maze. fx and fy are pointers to |
30 | /* find a character in the maze. fx and fy are pointers to |
31 | where to find the char. fx,fy = -1 if not found. */ |
31 | where to find the char. fx,fy = -1 if not found. */ |
… | |
… | |
209 | else |
209 | else |
210 | upy = RP->Ysize - 2; |
210 | upy = RP->Ysize - 2; |
211 | |
211 | |
212 | /* find an empty place far from the center */ |
212 | /* find an empty place far from the center */ |
213 | if (upx == 1 && upy == 1) find_in_layout (1, 0, upx, upy, maze); |
213 | if (upx == 1 && upy == 1) find_in_layout (1, 0, upx, upy, maze); |
214 | else if (upx == 1 && upy > 1) find_in_layout (4, 0, upx, upy, maze); |
|
|
215 | else if (upx > 1 && upy == 1) find_in_layout (2, 0, upx, upy, maze); |
214 | else if (upx > 1 && upy == 1) find_in_layout (2, 0, upx, upy, maze); |
216 | else if (upx > 1 && upy > 1) find_in_layout (3, 0, upx, upy, maze); |
215 | else if (upx > 1 && upy > 1) find_in_layout (3, 0, upx, upy, maze); |
|
|
216 | else if (upx == 1 && upy > 1) find_in_layout (4, 0, upx, upy, maze); |
217 | } |
217 | } |
218 | |
218 | |
219 | /* no indication of where to place the exit, so just place it. */ |
219 | /* no indication of where to place the exit, so just place it. */ |
220 | if (upx == -1) |
220 | if (upx == -1) |
221 | find_in_layout (0, 0, upx, upy, maze); |
221 | find_in_layout (0, 0, upx, upy, maze); |
… | |
… | |
266 | else |
266 | else |
267 | downy = RP->Ysize - 2; |
267 | downy = RP->Ysize - 2; |
268 | |
268 | |
269 | /* find an empty place far from the entrance */ |
269 | /* find an empty place far from the entrance */ |
270 | if (downx == 1 && downy == 1) find_in_layout (1, 0, downx, downy, maze); |
270 | if (downx == 1 && downy == 1) find_in_layout (1, 0, downx, downy, maze); |
271 | else if (downx == 1 && downy > 1) find_in_layout (4, 0, downx, downy, maze); |
|
|
272 | else if (downx > 1 && downy == 1) find_in_layout (2, 0, downx, downy, maze); |
271 | else if (downx > 1 && downy == 1) find_in_layout (2, 0, downx, downy, maze); |
273 | else if (downx > 1 && downy > 1) find_in_layout (3, 0, downx, downy, maze); |
272 | else if (downx > 1 && downy > 1) find_in_layout (3, 0, downx, downy, maze); |
|
|
273 | else if (downx == 1 && downy > 1) find_in_layout (4, 0, downx, downy, maze); |
274 | } |
274 | } |
275 | |
275 | |
276 | /* no indication of where to place the down exit, so just place it */ |
276 | /* no indication of where to place the down exit, so just place it */ |
277 | if (downx == -1) |
277 | if (downx == -1) |
278 | find_in_layout (0, 0, downx, downy, maze); |
278 | find_in_layout (0, 0, downx, downy, maze); |