hedgewars/uLand.pas
branchwebgl
changeset 8444 75db7bb8dce8
parent 8330 aaefa587e277
parent 8370 0c79946e96f8
child 9127 e350500c4edb
equal deleted inserted replaced
8340:46a9fde631f4 8444:75db7bb8dce8
   521     SDL_FreeSurface(tmpsurf);
   521     SDL_FreeSurface(tmpsurf);
   522 tmpsurf:= nil;
   522 tmpsurf:= nil;
   523 end;
   523 end;
   524 
   524 
   525 procedure LoadMap;
   525 procedure LoadMap;
   526 var tmpsurf : PSDL_Surface;
   526 var tmpsurf: PSDL_Surface;
   527     s       : shortstring;
   527     mapName: shortstring = '';
   528     f       : textfile;
       
   529     mapName : shortstring = '';
       
   530 
       
   531 begin
   528 begin
   532 WriteLnToConsole('Loading land from file...');
   529 WriteLnToConsole('Loading land from file...');
   533 AddProgress;
   530 AddProgress;
   534 tmpsurf:= LoadDataImage(ptMapCurrent, 'map', ifAlpha or ifTransparent or ifIgnoreCaps);
   531 tmpsurf:= LoadDataImage(ptMapCurrent, 'map', ifAlpha or ifTransparent or ifIgnoreCaps);
   535 if tmpsurf = nil then
   532 if tmpsurf = nil then
   633     for y:= topY to topY + 5 do
   630     for y:= topY to topY + 5 do
   634         for x:= leftX to rightX do
   631         for x:= leftX to rightX do
   635             if Land[y, x] <> 0 then
   632             if Land[y, x] <> 0 then
   636                 begin
   633                 begin
   637                 inc(c);
   634                 inc(c);
   638                 if c > (LAND_WIDTH div 2) then // avoid accidental triggering
   635                 if c > LongWord((LAND_WIDTH div 2)) then // avoid accidental triggering
   639                     begin
   636                     begin
   640                     hasBorder:= true;
   637                     hasBorder:= true;
   641                     break;
   638                     break;
   642                     end;
   639                     end;
   643                 end;
   640                 end;