209 |
209 |
210 AddGirder:= bRes; |
210 AddGirder:= bRes; |
211 end; |
211 end; |
212 |
212 |
213 function CheckLand(rect: TSDL_Rect; dX, dY, Color: Longword): boolean; |
213 function CheckLand(rect: TSDL_Rect; dX, dY, Color: Longword): boolean; |
214 var i, tmpx, tmpy, bx, by: LongInt; |
214 var tmpx, tmpx2, tmpy, tmpy2, bx, by: LongInt; |
215 bRes: boolean = true; |
215 bRes: boolean = true; |
216 begin |
216 begin |
217 inc(rect.x, dX); |
217 inc(rect.x, dX); |
218 inc(rect.y, dY); |
218 inc(rect.y, dY); |
219 bx:= rect.x + rect.w; |
219 bx:= rect.x + rect.w; |
220 by:= rect.y + rect.h; |
220 by:= rect.y + rect.h; |
221 i:= 0; |
|
222 {$WARNINGS OFF} |
221 {$WARNINGS OFF} |
223 tmpx:= rect.x; |
222 tmpx:= rect.x; |
224 while (tmpx <= bx) and bRes do |
223 tmpx2:= bx; |
|
224 while (tmpx <= bx - rect.w div 2 - 1) and bRes do |
225 begin |
225 begin |
226 bRes:= (Land[rect.y, tmpx] = Color) and (Land[by, tmpx] = Color); |
226 bRes:= (Land[rect.y, tmpx] = Color) and (Land[by, tmpx] = Color) and |
227 inc(tmpx) |
227 (Land[rect.y, tmpx2] = Color) and (Land[by, tmpx2] = Color); |
|
228 inc(tmpx); |
|
229 dec(tmpx2) |
228 end; |
230 end; |
229 i:= 0; |
231 tmpy:= rect.y+1; |
230 tmpy:= rect.y; |
232 tmpy2:= by-1; |
231 while (tmpy <= by) and bRes do |
233 while (tmpy <= by - rect.h div 2 - 1) and bRes do |
232 begin |
234 begin |
233 bRes:= (Land[tmpy, rect.x] = Color) and (Land[tmpy, bx] = Color); |
235 bRes:= (Land[tmpy, rect.x] = Color) and (Land[tmpy, bx] = Color) and |
234 inc(tmpy) |
236 (Land[tmpy2, rect.x] = Color) and (Land[tmpy2, bx] = Color); |
|
237 inc(tmpy); |
|
238 dec(tmpy2) |
235 end; |
239 end; |
236 {$WARNINGS ON} |
240 {$WARNINGS ON} |
237 CheckLand:= bRes; |
241 CheckLand:= bRes; |
238 end; |
242 end; |
239 |
243 |