/[hegemonie]/hegemonie/MapEditor/MapRandom.m
ViewVC logotype

Diff of /hegemonie/MapEditor/MapRandom.m

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by gabby, Thu Jul 24 13:50:53 2003 UTC revision 1.2 by gabby, Wed Aug 6 16:25:20 2003 UTC
# Line 34  Line 34 
34              withHeigth: (int)height              withHeigth: (int)height
35            andMaxHeight: (int)maxHeight            andMaxHeight: (int)maxHeight
36  {  {
37      NSParameterAssert (far >= 0);
38    NSParameterAssert (height <= 255);    NSParameterAssert (height <= 255);
39    NSParameterAssert (height <= maxHeight);    NSParameterAssert (height <= maxHeight);
40    NSParameterAssert (height >= 0);    NSParameterAssert (height >= 0);
# Line 64  Line 65 
65  {  {
66    int height = ([heightField heightAtPosition: pos1]    int height = ([heightField heightAtPosition: pos1]
67                  + [heightField heightAtPosition: pos2]) / 2.0;                  + [heightField heightAtPosition: pos2]) / 2.0;
68    return [self _hazardWithFar: far  
69                     withHeigth: height    if (far > 2)
70                   andMaxHeight: maxHeight];      return [self _hazardWithFar: far
71                         withHeigth: height
72                       andMaxHeight: maxHeight];
73      else
74        return height;
75  }  }
76    
77  + (void) _generateFractaleGroundWithUpLeft: (map_coord_t)pos1  + (void) _generateFractaleGroundWithUpLeft: (map_coord_t)pos1
# Line 151  Line 156 
156        int height = (upMid + downMid + leftMid + rightMid) / 4;        int height = (upMid + downMid + leftMid + rightMid) / 4;
157        int far = (int)sqrt ((double)(SQUARE (xMid - pos1.x)        int far = (int)sqrt ((double)(SQUARE (xMid - pos1.x)
158                                      + SQUARE(zMid - pos1.z)));                                      + SQUARE(zMid - pos1.z)));
159        height = [self _hazardWithFar: far  
160                           withHeigth: height        if (far > 2)
161                         andMaxHeight: maxHeight];          height = [self _hazardWithFar: far
162                               withHeigth: height
163                             andMaxHeight: maxHeight];
164    
165        [heightField setHeightAtPosition: MakeMapCoord (xMid, zMid)        [heightField setHeightAtPosition: MakeMapCoord (xMid, zMid)
166                               toHeight: (u_int8_t)height];                               toHeight: (u_int8_t)height];

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26