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

Comparing deliantra/server/random_maps/exit.C (file contents):
Revision 1.44 by root, Wed Jun 30 01:32:57 2010 UTC vs.
Revision 1.45 by root, Fri Jul 2 15:03:57 2010 UTC

25#include <global.h> 25#include <global.h>
26#include <random_map.h> 26#include <random_map.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 layout. 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. */
32static void 32static void
33find_in_layout (int mode, char target, int *fx, int *fy, char **layout, random_map_params *RP) 33find_in_layout (int mode, char target, int *fx, int *fy, char **maze, random_map_params *RP)
34{ 34{
35 int M; 35 int M;
36 int i, j; 36 int i, j;
37 37
38 *fx = -1; 38 *fx = -1;
52 case 1: 52 case 1:
53 /* search from top left down/right */ 53 /* search from top left down/right */
54 for (i = 1; i < RP->Xsize; i++) 54 for (i = 1; i < RP->Xsize; i++)
55 for (j = 1; j < RP->Ysize; j++) 55 for (j = 1; j < RP->Ysize; j++)
56 { 56 {
57 if (layout[i][j] == target) 57 if (maze[i][j] == target)
58 { 58 {
59 *fx = i; 59 *fx = i;
60 *fy = j; 60 *fy = j;
61 return; 61 return;
62 } 62 }
66 case 2: 66 case 2:
67 /* Search from top right down/left */ 67 /* Search from top right down/left */
68 for (i = RP->Xsize - 2; i > 0; i--) 68 for (i = RP->Xsize - 2; i > 0; i--)
69 for (j = 1; j < RP->Ysize - 1; j++) 69 for (j = 1; j < RP->Ysize - 1; j++)
70 { 70 {
71 if (layout[i][j] == target) 71 if (maze[i][j] == target)
72 { 72 {
73 *fx = i; 73 *fx = i;
74 *fy = j; 74 *fy = j;
75 return; 75 return;
76 } 76 }
80 case 3: 80 case 3:
81 /* search from bottom-left up-right */ 81 /* search from bottom-left up-right */
82 for (i = 1; i < RP->Xsize - 1; i++) 82 for (i = 1; i < RP->Xsize - 1; i++)
83 for (j = RP->Ysize - 2; j > 0; j--) 83 for (j = RP->Ysize - 2; j > 0; j--)
84 { 84 {
85 if (layout[i][j] == target) 85 if (maze[i][j] == target)
86 { 86 {
87 *fx = i; 87 *fx = i;
88 *fy = j; 88 *fy = j;
89 return; 89 return;
90 } 90 }
94 case 4: 94 case 4:
95 /* search from bottom-right up-left */ 95 /* search from bottom-right up-left */
96 for (i = RP->Xsize - 2; i > 0; i--) 96 for (i = RP->Xsize - 2; i > 0; i--)
97 for (j = RP->Ysize - 2; j > 0; j--) 97 for (j = RP->Ysize - 2; j > 0; j--)
98 { 98 {
99 if (layout[i][j] == target) 99 if (maze[i][j] == target)
100 { 100 {
101 *fx = i; 101 *fx = i;
102 *fy = j; 102 *fy = j;
103 return; 103 return;
104 } 104 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines