Changeset 187 for trunk/Start.pas
- Timestamp:
- May 6, 2020, 9:54:34 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Start.pas
r185 r187 32 32 33 33 TStartTab = (tbMain, tbMap, tbNew, tbPrevious); 34 TMiniMode = (mmNone, mmPicture, mmMultiPlayer);35 34 TMainAction = (maConfig, maManual, maCredits, maAIDev, maWeb, maNone); 36 35 TMainActionSet = set of TMainAction; 37 36 38 37 TMapArray = array[0 .. lxmax * lymax - 1] of Byte; 38 39 TMiniMode = (mmNone, mmPicture, mmMultiPlayer); 40 41 { TMiniMap } 42 43 TMiniMap = class 44 const 45 MaxWidthMapLogo = 96; 46 MaxHeightMapLogo = 96; 47 var 48 Bitmap: TBitmap; { game world sample preview } 49 Size: TPoint; 50 Colors: array [0 .. 11, 0 .. 1] of TColor; 51 Mode: TMiniMode; 52 procedure LoadFromLogFile(FileName: string; var LastTurn: Integer); 53 procedure LoadFromMapFile(FileName: string; var nMapLandTiles, nMapStartPositions: Integer); 54 procedure PaintRandom(Brightness, StartLandMass, WorldSize: Integer); 55 procedure PaintFile(SaveMap: TMapArray); 56 constructor Create; 57 destructor Destroy; override; 58 end; 39 59 40 60 { TStartDlg } … … 98 118 AutoDiff: Integer; 99 119 MultiControl: Integer; 100 MiniSize: TPoint;101 120 Page: TStartPage; 102 121 ShowTab: TStartTab; … … 115 134 FormerGames: TStringList; 116 135 Maps: TStringList; 117 LogoBuffer, Mini: TBitmap; { game world sample preview } 118 MiniColors: array [0 .. 11, 0 .. 1] of TColor; 136 LogoBuffer: TBitmap; 119 137 // BookDate: string; 120 138 PlayerSlots: TPlayerSlots; 121 MiniMode: TMiniMode;122 139 ActionsOffered: TMainActionSet; 123 140 SelectedAction: TMainAction; … … 125 142 Tracking: Boolean; 126 143 DefaultAI: string; 144 MiniMap: TMiniMap; 127 145 procedure DrawAction(y, IconIndex: integer; HeaderItem, TextItem: string); 128 146 procedure InitPopup(PlayerIndex: Integer); 129 147 procedure OfferBrain(Brain: TBrain; FixedLines: Integer); 130 procedure PaintFileMini(SaveMap: TMapArray);131 148 procedure PaintInfo; 132 149 procedure ChangePage(NewPage: TStartPage); 133 150 procedure ChangeTab(NewTab: TStartTab); 134 procedure PaintRandomMini(Brightness: integer);135 151 procedure UnlistBackupFile(FileName: string); 136 152 procedure SmartInvalidate(x0, y0, x1, y1: integer; … … 160 176 DefaultWorldTiles=4200; } 161 177 MaxWorldSize = 6; 162 WorldSizes: array [0 .. MaxWorldSize - 1] of TPoint = ((X: 30; Y:46), 163 (X: 40; Y:52), (X: 50; Y:60), (X: 60; Y:70), (X: 75; Y:82), (X: 100; Y:96)); 178 WorldSizes: array [0 .. MaxWorldSize - 1] of TPoint = ((X: 30; Y: 46), 179 (X: 40; Y: 52), (X: 50; Y: 60), (X: 60; Y: 70), (X: 75; Y: 82), 180 (X: 100; Y: 96)); 164 181 DefaultWorldTiles = 4150; 165 182 DefaultWorldSize = 3; … … 197 214 TabHeight = 40; 198 215 199 MaxWidthMapLogo = 96;200 MaxHeightMapLogo = 96;201 202 216 InitAlive: array [1 .. nPl] of integer = (1, 1 + 2, 1 + 2 + 32, 203 217 1 + 2 + 8 + 128, 1 + 2 + 8 + 32 + 128, 1 + 2 + 8 + 16 + 64 + 128, … … 210 224 EnemyAutoDiff: array [1 .. 5] of integer = (4, 3, 2, 1, 1); 211 225 226 { TMiniMap } 227 228 constructor TMiniMap.Create; 229 var 230 X, Y: Integer; 231 begin 232 Bitmap := TBitmap.Create; 233 234 for X := 0 to 11 do 235 for Y := 0 to 1 do 236 Colors[x, y] := GrExt[HGrSystem].Data.Canvas.Pixels[66 + x, 67 + y]; 237 end; 238 239 destructor TMiniMap.Destroy; 240 begin 241 FreeAndNil(Bitmap); 242 inherited Destroy; 243 end; 244 245 procedure TMiniMap.LoadFromLogFile(FileName: string; var LastTurn: Integer); 246 var 247 SaveMap: TMapArray; 248 y: Integer; 249 Dummy: Integer; 250 FileLandMass: integer; 251 LogFile: file; 252 s: string[255]; 253 MapRow: array [0 .. lxmax - 1] of Cardinal; 254 begin 255 AssignFile(LogFile, FileName); 256 try 257 Reset(LogFile, 4); 258 BlockRead(LogFile, s[1], 2); { file id } 259 BlockRead(LogFile, Dummy, 1); { format id } 260 if Dummy >= $000E01 then 261 BlockRead(LogFile, Dummy, 1); { item stored since 0.14.1 } 262 BlockRead(LogFile, Size.X, 1); 263 BlockRead(LogFile, Size.Y, 1); 264 BlockRead(LogFile, FileLandMass, 1); 265 if FileLandMass = 0 then 266 for y := 0 to Size.Y - 1 do 267 BlockRead(LogFile, MapRow, Size.X); 268 BlockRead(LogFile, Dummy, 1); 269 BlockRead(LogFile, Dummy, 1); 270 BlockRead(LogFile, LastTurn, 1); 271 BlockRead(LogFile, SaveMap, 1); 272 if SaveMap[0] = $80 then 273 Mode := mmMultiPlayer 274 else 275 Mode := mmPicture; 276 if Mode = mmPicture then 277 BlockRead(LogFile, SaveMap[4], (Size.X * Size.Y - 1) div 4); 278 CloseFile(LogFile); 279 except 280 CloseFile(LogFile); 281 LastTurn := 0; 282 Size := WorldSizes[DefaultWorldSize]; 283 Mode := mmNone; 284 end; 285 PaintFile(SaveMap); 286 end; 287 288 procedure TMiniMap.LoadFromMapFile(FileName: string; var nMapLandTiles, nMapStartPositions: Integer); 289 var 290 x, y, lxFile, lyFile: integer; 291 MapFile: file; 292 s: string[255]; 293 MapRow: array [0 .. lxmax - 1] of Cardinal; 294 ImageFileName: string; 295 begin 296 ImageFileName := Copy(FileName, 1, Length(FileName) - Length(CevoMapExt)) + '.png'; 297 Mode := mmPicture; 298 if LoadGraphicFile(Bitmap, ImageFileName, gfNoError) then 299 begin 300 if Bitmap.width div 2 > MaxWidthMapLogo then 301 Bitmap.width := MaxWidthMapLogo * 2; 302 if Bitmap.height > MaxHeightMapLogo then 303 Bitmap.height := MaxHeightMapLogo; 304 Size.X := Bitmap.width div 2; 305 Size.Y := Bitmap.height; 306 end 307 else 308 begin 309 Mode := mmNone; 310 Size.X := MaxWidthMapLogo; 311 Size.Y := MaxHeightMapLogo; 312 end; 313 314 AssignFile(MapFile, FileName); 315 try 316 Reset(MapFile, 4); 317 BlockRead(MapFile, s[1], 2); { file id } 318 BlockRead(MapFile, x, 1); { format id } 319 BlockRead(MapFile, x, 1); // MaxTurn 320 BlockRead(MapFile, lxFile, 1); 321 BlockRead(MapFile, lyFile, 1); 322 nMapLandTiles := 0; 323 nMapStartPositions := 0; 324 for y := 0 to lyFile - 1 do begin 325 BlockRead(MapFile, MapRow, lxFile); 326 for x := 0 to lxFile - 1 do 327 begin 328 if (MapRow[x] and fTerrain) in [fGrass, fPrairie, fTundra, fSwamp, 329 fForest, fHills] then 330 inc(nMapLandTiles); 331 if MapRow[x] and (fPrefStartPos or fStartPos) <> 0 then 332 inc(nMapStartPositions); 333 end 334 end; 335 if nMapStartPositions > nPl then 336 nMapStartPositions := nPl; 337 CloseFile(MapFile); 338 except 339 CloseFile(MapFile); 340 end; 341 end; 342 343 procedure TMiniMap.PaintRandom(Brightness, StartLandMass, WorldSize: Integer); 344 var 345 i, x, y, xm, cm: Integer; 346 MiniPixel: TPixelPointer; 347 Map: ^TTileList; 348 begin 349 Map := PreviewMap(StartLandMass); 350 Size := WorldSizes[WorldSize]; 351 352 Bitmap.PixelFormat := pf24bit; 353 Bitmap.SetSize(Size.X * 2, Size.Y); 354 Bitmap.BeginUpdate; 355 MiniPixel.Init(Bitmap); 356 for y := 0 to Size.Y - 1 do begin 357 for x := 0 to Size.X - 1 do begin 358 for i := 0 to 1 do begin 359 xm := (x * 2 + i + y and 1) mod (Size.X * 2); 360 MiniPixel.SetX(xm); 361 cm := Colors 362 [Map[x * lxmax div Size.X + lxmax * 363 ((y * (lymax - 1) + Size.Y div 2) div (Size.Y - 1))] and 364 fTerrain, i]; 365 MiniPixel.Pixel^.B := ((cm shr 16) and $FF) * Brightness div 3; 366 MiniPixel.Pixel^.G := ((cm shr 8) and $FF) * Brightness div 3; 367 MiniPixel.Pixel^.R := ((cm shr 0) and $FF) * Brightness div 3; 368 end; 369 end; 370 MiniPixel.NextLine; 371 end; 372 Bitmap.EndUpdate; 373 end; 374 375 procedure TMiniMap.PaintFile(SaveMap: TMapArray); 376 var 377 i, x, y, xm, cm, Tile, OwnColor, EnemyColor: integer; 378 MiniPixel: TPixelPointer; 379 PrevMiniPixel: TPixelPointer; 380 begin 381 OwnColor := GrExt[HGrSystem].Data.Canvas.Pixels[95, 67]; 382 EnemyColor := GrExt[HGrSystem].Data.Canvas.Pixels[96, 67]; 383 Bitmap.PixelFormat := pf24bit; 384 Bitmap.SetSize(Size.X * 2, Size.Y); 385 if Mode = mmPicture then begin 386 Bitmap.BeginUpdate; 387 MiniPixel.Init(Bitmap); 388 PrevMiniPixel.Init(Bitmap, 0, -1); 389 for y := 0 to Size.Y - 1 do begin 390 for x := 0 to Size.X - 1 do begin 391 for i := 0 to 1 do begin 392 xm := (x * 2 + i + y and 1) mod (Size.X * 2); 393 MiniPixel.SetX(xm); 394 Tile := SaveMap[x + Size.X * y]; 395 if Tile and fTerrain = fUNKNOWN then 396 cm := $000000 397 else if Tile and smCity <> 0 then 398 begin 399 if Tile and smOwned <> 0 then 400 cm := OwnColor 401 else 402 cm := EnemyColor; 403 if y > 0 then begin 404 // 2x2 city dot covers two lines 405 PrevMiniPixel.SetX(xm); 406 PrevMiniPixel.Pixel^.B := cm shr 16; 407 PrevMiniPixel.Pixel^.G:= cm shr 8 and $FF; 408 PrevMiniPixel.Pixel^.R := cm and $FF; 409 end; 410 end 411 else if (i = 0) and (Tile and smUnit <> 0) then 412 if Tile and smOwned <> 0 then 413 cm := OwnColor 414 else cm := EnemyColor 415 else 416 cm := Colors[Tile and fTerrain, i]; 417 MiniPixel.Pixel^.B := (cm shr 16) and $ff; 418 MiniPixel.Pixel^.G := (cm shr 8) and $ff; 419 MiniPixel.Pixel^.R := (cm shr 0) and $ff; 420 end; 421 end; 422 MiniPixel.NextLine; 423 PrevMiniPixel.NextLine; 424 end; 425 Bitmap.EndUpdate; 426 end; 427 end; 428 429 { TStartDlg } 212 430 213 431 procedure TStartDlg.FormCreate(Sender: TObject); 214 432 var 215 x, y,i: Integer;433 x, i: Integer; 216 434 r0, r1: HRgn; 217 435 Location: TPoint; … … 362 580 LogoBuffer.Canvas.FillRect(0, 0, LogoBuffer.Width, LogoBuffer.Height); 363 581 364 Mini := TBitmap.Create; 365 for x := 0 to 11 do 366 for y := 0 to 1 do 367 MiniColors[x, y] := GrExt[HGrSystem].Data.Canvas.Pixels[66 + x, 67 + y]; 582 MiniMap := TMiniMap.Create; 368 583 InitButtons; 369 584 … … 386 601 FreeAndNil(FormerGames); 387 602 FreeAndNil(Maps); 388 FreeAndNil(Mini);389 603 FreeAndNil(EmptyPicture); 390 604 FreeAndNil(LogoBuffer); 391 605 FreeAndNil(PlayerSlots); 606 FreeAndNil(MiniMap); 392 607 end; 393 608 … … 825 1040 BtnFrame(Canvas, ReplayBtn.BoundsRect, MainTexture); 826 1041 827 if not (Page in [pgMain, pgNoLoad]) then828 begin 829 xMini := x0Mini - Mini Size.X;830 yMini := y0Mini - Mini Size.Y div 2;831 Frame(Canvas, xMini, yMini, xMini + 3 + Mini Size.X * 2,832 yMini + 3 + Mini Size.Y, MainTexture.clBevelLight,1042 if not (Page in [pgMain, pgNoLoad]) then 1043 begin 1044 xMini := x0Mini - MiniMap.Size.X; 1045 yMini := y0Mini - MiniMap.Size.Y div 2; 1046 Frame(Canvas, xMini, yMini, xMini + 3 + MiniMap.Size.X * 2, 1047 yMini + 3 + MiniMap.Size.Y, MainTexture.clBevelLight, 833 1048 MainTexture.clBevelShade); 834 Frame(Canvas, xMini + 1, yMini + 1, xMini + 2 + Mini Size.X * 2,835 yMini + 2 + Mini Size.Y, MainTexture.clBevelShade,1049 Frame(Canvas, xMini + 1, yMini + 1, xMini + 2 + MiniMap.Size.X * 2, 1050 yMini + 2 + MiniMap.Size.Y, MainTexture.clBevelShade, 836 1051 MainTexture.clBevelLight); 837 1052 end; 838 1053 s := ''; 839 if MiniM ode = mmPicture then840 begin 841 BitBlt(Canvas.Handle, xMini + 2, yMini + 2, Mini Size.X * 2, MiniSize.Y,842 Mini .Canvas.Handle, 0, 0, SRCCOPY);1054 if MiniMap.Mode = mmPicture then 1055 begin 1056 BitBlt(Canvas.Handle, xMini + 2, yMini + 2, MiniMap.Size.X * 2, MiniMap.Size.Y, 1057 MiniMap.Bitmap.Canvas.Handle, 0, 0, SRCCOPY); 843 1058 if Page = pgStartRandom then 844 1059 s := Phrases.Lookup('RANMAP') 845 1060 end 846 else if MiniM ode = mmMultiPlayer then1061 else if MiniMap.Mode = mmMultiPlayer then 847 1062 s := Phrases.Lookup('MPMAP') 848 1063 else if Page = pgStartMap then … … 1026 1241 end; 1027 1242 1028 procedure TStartDlg.PaintRandomMini(Brightness: integer);1029 var1030 i, x, y, xm, cm: integer;1031 MiniPixel: TPixelPointer;1032 Map: ^TTileList;1033 begin1034 Map := PreviewMap(StartLandMass);1035 MiniSize := WorldSizes[WorldSize];1036 1037 Mini.PixelFormat := pf24bit;1038 Mini.SetSize(MiniSize.X * 2, MiniSize.Y);1039 Mini.BeginUpdate;1040 MiniPixel.Init(Mini);1041 for y := 0 to MiniSize.Y - 1 do begin1042 for x := 0 to MiniSize.X - 1 do begin1043 for i := 0 to 1 do begin1044 xm := (x * 2 + i + y and 1) mod (MiniSize.X * 2);1045 MiniPixel.SetX(xm);1046 cm := MiniColors1047 [Map[x * lxmax div MiniSize.X + lxmax *1048 ((y * (lymax - 1) + MiniSize.Y div 2) div (MiniSize.Y - 1))] and1049 fTerrain, i];1050 MiniPixel.Pixel^.B := ((cm shr 16) and $FF) * Brightness div 3;1051 MiniPixel.Pixel^.G := ((cm shr 8) and $FF) * Brightness div 3;1052 MiniPixel.Pixel^.R := ((cm shr 0) and $FF) * Brightness div 3;1053 end;1054 end;1055 MiniPixel.NextLine;1056 end;1057 Mini.EndUpdate;1058 end;1059 1060 procedure TStartDlg.PaintFileMini(SaveMap: TMapArray);1061 var1062 i, x, y, xm, cm, Tile, OwnColor, EnemyColor: integer;1063 MiniPixel, PrevMiniPixel: TPixelPointer;1064 begin1065 OwnColor := GrExt[HGrSystem].Data.Canvas.Pixels[95, 67];1066 EnemyColor := GrExt[HGrSystem].Data.Canvas.Pixels[96, 67];1067 Mini.PixelFormat := pf24bit;1068 Mini.SetSize(MiniSize.X * 2, MiniSize.Y);1069 if MiniMode = mmPicture then1070 begin1071 Mini.BeginUpdate;1072 MiniPixel.Init(Mini);1073 PrevMiniPixel.Init(Mini, 0, -1);1074 for y := 0 to MiniSize.Y - 1 do begin1075 for x := 0 to MiniSize.X - 1 do begin1076 for i := 0 to 1 do begin1077 xm := (x * 2 + i + y and 1) mod (MiniSize.X * 2);1078 MiniPixel.SetX(xm);1079 Tile := SaveMap[x + MiniSize.X * y];1080 if Tile and fTerrain = fUNKNOWN then1081 cm := $0000001082 else if Tile and smCity <> 0 then1083 begin1084 if Tile and smOwned <> 0 then1085 cm := OwnColor1086 else1087 cm := EnemyColor;1088 if y > 0 then begin1089 // 2x2 city dot covers two lines1090 PrevMiniPixel.SetX(xm);1091 PrevMiniPixel.Pixel^.B := cm shr 16;1092 PrevMiniPixel.Pixel^.G:= cm shr 8 and $FF;1093 PrevMiniPixel.Pixel^.R := cm and $FF;1094 end;1095 end1096 else if (i = 0) and (Tile and smUnit <> 0) then1097 if Tile and smOwned <> 0 then1098 cm := OwnColor1099 else1100 cm := EnemyColor1101 else1102 cm := MiniColors[Tile and fTerrain, i];1103 MiniPixel.Pixel^.B := cm shr 16;1104 MiniPixel.Pixel^.G:= cm shr 8 and $FF;1105 MiniPixel.Pixel^.R := cm and $FF;1106 end;1107 end;1108 MiniPixel.NextLine;1109 PrevMiniPixel.NextLine;1110 end;1111 Mini.EndUpdate;1112 end;1113 end;1114 1115 1243 procedure TStartDlg.PaintInfo; 1116 var1117 SaveMap: TMapArray;1118 x, y, Dummy, FileLandMass, lxFile, lyFile: integer;1119 LogFile, MapFile: file;1120 s: string[255];1121 MapRow: array [0 .. lxmax - 1] of Cardinal;1122 1244 begin 1123 1245 case Page of 1124 pgStartRandom: 1125 begin 1126 MiniMode := mmPicture; 1127 PaintRandomMini(3); 1128 end; 1129 pgNoLoad: 1130 begin 1131 MiniSize := WorldSizes[DefaultWorldSize]; 1132 MiniMode := mmNone; 1133 end; 1134 pgLoad: 1135 begin 1136 AssignFile(LogFile, GetSavedDir + DirectorySeparator + List.Items[List.ItemIndex] 1137 + CevoExt); 1138 try 1139 Reset(LogFile, 4); 1140 BlockRead(LogFile, s[1], 2); { file id } 1141 BlockRead(LogFile, Dummy, 1); { format id } 1142 if Dummy >= $000E01 then 1143 BlockRead(LogFile, Dummy, 1); { item stored since 0.14.1 } 1144 BlockRead(LogFile, MiniSize.X, 1); 1145 BlockRead(LogFile, MiniSize.Y, 1); 1146 BlockRead(LogFile, FileLandMass, 1); 1147 if FileLandMass = 0 then 1148 for y := 0 to MiniSize.Y - 1 do 1149 BlockRead(LogFile, MapRow, MiniSize.X); 1150 BlockRead(LogFile, Dummy, 1); 1151 BlockRead(LogFile, Dummy, 1); 1152 BlockRead(LogFile, LastTurn, 1); 1153 BlockRead(LogFile, SaveMap, 1); 1154 if SaveMap[0] = $80 then 1155 MiniMode := mmMultiPlayer 1156 else 1157 MiniMode := mmPicture; 1158 if MiniMode = mmPicture then 1159 BlockRead(LogFile, SaveMap[4], (MiniSize.X * MiniSize.Y - 1) div 4); 1160 CloseFile(LogFile); 1161 except 1162 CloseFile(LogFile); 1163 LastTurn := 0; 1164 MiniSize := WorldSizes[DefaultWorldSize]; 1165 MiniMode := mmNone; 1166 end; 1246 pgStartRandom: begin 1247 MiniMap.Mode := mmPicture; 1248 MiniMap.PaintRandom(3, StartLandMass, WorldSize); 1249 end; 1250 pgNoLoad: begin 1251 MiniMap.Mode := mmNone; 1252 MiniMap.Size := WorldSizes[DefaultWorldSize]; 1253 end; 1254 pgLoad: begin 1255 MiniMap.LoadFromLogFile(GetSavedDir + DirectorySeparator + 1256 List.Items[List.ItemIndex] + CevoExt, LastTurn); 1167 1257 // BookDate:=DateToStr(FileDateToDateTime(FileAge(FileName))); 1168 PaintFileMini(SaveMap); 1169 if not TurnValid then 1170 begin 1258 if not TurnValid then begin 1171 1259 LoadTurn := LastTurn; 1172 1260 SmartInvalidate(xTurnSlider - 2, y0Mini + 61, … … 1175 1263 TurnValid := True; 1176 1264 end; 1177 pgEditRandom: 1178 begin 1179 MapFileName := ''; 1180 MiniMode := mmPicture; 1181 PaintRandomMini(4); 1182 end; 1265 pgEditRandom: begin 1266 MapFileName := ''; 1267 MiniMap.Mode := mmPicture; 1268 MiniMap.PaintRandom(4, StartLandMass, WorldSize); 1269 end; 1183 1270 pgStartMap, pgEditMap: 1184 1271 begin 1185 MiniMode := mmPicture;1186 1272 if Page = pgEditMap then 1187 1273 MapFileName := List.Items[List.ItemIndex] + CevoMapExt; 1188 if LoadGraphicFile(Mini, GetMapsDir + DirectorySeparator + Copy(MapFileName, 1, 1189 Length(MapFileName) - 9) + '.png', gfNoError) then 1190 begin 1191 if Mini.width div 2 > MaxWidthMapLogo then 1192 Mini.width := MaxWidthMapLogo * 2; 1193 if Mini.height > MaxHeightMapLogo then 1194 Mini.height := MaxHeightMapLogo; 1195 MiniSize.X := Mini.width div 2; 1196 MiniSize.Y := Mini.height; 1197 end 1198 else 1199 begin 1200 MiniMode := mmNone; 1201 MiniSize.X := MaxWidthMapLogo; 1202 MiniSize.Y := MaxHeightMapLogo; 1203 end; 1204 1205 AssignFile(MapFile, GetMapsDir + DirectorySeparator + MapFileName); 1206 try 1207 Reset(MapFile, 4); 1208 BlockRead(MapFile, s[1], 2); { file id } 1209 BlockRead(MapFile, x, 1); { format id } 1210 BlockRead(MapFile, x, 1); // MaxTurn 1211 BlockRead(MapFile, lxFile, 1); 1212 BlockRead(MapFile, lyFile, 1); 1213 nMapLandTiles := 0; 1214 nMapStartPositions := 0; 1215 for y := 0 to lyFile - 1 do 1216 begin 1217 BlockRead(MapFile, MapRow, lxFile); 1218 for x := 0 to lxFile - 1 do 1219 begin 1220 if (MapRow[x] and fTerrain) in [fGrass, fPrairie, fTundra, fSwamp, 1221 fForest, fHills] then 1222 inc(nMapLandTiles); 1223 if MapRow[x] and (fPrefStartPos or fStartPos) <> 0 then 1224 inc(nMapStartPositions); 1225 end 1226 end; 1227 if nMapStartPositions > nPl then 1228 nMapStartPositions := nPl; 1229 CloseFile(MapFile); 1230 except 1231 CloseFile(MapFile); 1232 end; 1274 MiniMap.LoadFromMapFile(GetMapsDir + DirectorySeparator + MapFileName, nMapLandTiles, nMapStartPositions); 1233 1275 if Page = pgEditMap then 1234 1276 SmartInvalidate(x0Mini - 112, y0Mini + 61, x0Mini + 112, y0Mini + 91); … … 1541 1583 Controls[i].Visible := Controls[i].Tag and (256 shl Integer(Page)) <> 0; 1542 1584 if Page = pgLoad then 1543 ReplayBtn.Visible := MiniM ode <> mmMultiPlayer;1585 ReplayBtn.Visible := MiniMap.Mode <> mmMultiPlayer; 1544 1586 List.Invalidate; 1545 1587 SmartInvalidate(0, 0, ClientWidth, ClientHeight, invalidateTab0); … … 1746 1788 PaintInfo; 1747 1789 if Page = pgLoad then 1748 ReplayBtn.Visible := MiniM ode <> mmMultiPlayer;1790 ReplayBtn.Visible := MiniMap.Mode <> mmMultiPlayer; 1749 1791 end; 1750 1792 … … 1858 1900 PaintInfo; 1859 1901 if Page = pgLoad then 1860 ReplayBtn.Visible := MiniM ode <> mmMultiPlayer;1902 ReplayBtn.Visible := MiniMap.Mode <> mmMultiPlayer; 1861 1903 end; 1862 1904 end; … … 2030 2072 end; 2031 2073 2074 2032 2075 end.
Note:
See TracChangeset
for help on using the changeset viewer.