Changeset 364 for trunk/Start.pas
- Timestamp:
- Apr 12, 2021, 11:55:20 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Start.pas
r363 r364 10 10 11 11 type 12 13 { TPlayerSlot } 14 12 15 TPlayerSlot = class 13 16 DiffUpBtn: TButtonC; … … 84 87 procedure AutoEnemyDownBtnClick(Sender: TObject); 85 88 procedure ReplayBtnClick(Sender: TObject); 86 public87 EmptyPicture: TBitmap;88 procedure UpdateFormerGames;89 procedure UpdateMaps;90 89 private 91 90 WorldSize: Integer; … … 134 133 procedure LoadAiBrainsPictures; 135 134 procedure UpdateInterface; 135 procedure ShowSettings; 136 public 137 EmptyPicture: TBitmap; 138 procedure UpdateFormerGames; 139 procedure UpdateMaps; 136 140 end; 137 141 … … 492 496 (Screen.Height - Height) div 2, Width, Height) 493 497 end; 498 end; 499 500 procedure TStartDlg.ShowSettings; 501 begin 502 SettingsDlg := TSettingsDlg.Create(nil); 503 if SettingsDlg.ShowModal = mrOk then begin 504 LoadAssets; 505 Invalidate; 506 UpdateInterface; 507 Background.UpdateInterface; 508 end; 509 FreeAndNil(SettingsDlg); 494 510 end; 495 511 … … 968 984 969 985 OpenKey(AppRegistryKey, True); 970 if AutoDiff > 0 then 971 begin 972 WriteString('DefaultAI', BrainDefault.FileName); 973 SlotAvailable := 0; // PlayerSlot will be invalid hereafter 974 PlayersBrain[0] := BrainTerm; 975 Difficulty[0] := PlayerAutoDiff[AutoDiff]; 976 for I := 1 to nPl - 1 do 977 if (Page = pgStartRandom) and (I <= AutoEnemies) or 978 (Page = pgStartMap) and (I < nMapStartPositions) then begin 979 if AutoDiff = 1 then PlayersBrain[I] := Brains.GetBeginner 980 else PlayersBrain[I] := BrainDefault; 981 Difficulty[I] := EnemyAutoDiff[AutoDiff]; 982 end else PlayersBrain[I] := nil; 983 end else begin 984 for I := 6 to 8 do 985 if (PlayersBrain[0].Kind <> btNoTerm) and (MultiControl and (1 shl I) <> 0) 986 then begin 987 PlayersBrain[I + 3] := PlayersBrain[I]; 988 Difficulty[I + 3] := Difficulty[I]; 989 PlayersBrain[I + 6] := PlayersBrain[I]; 990 Difficulty[I + 6] := Difficulty[I]; 991 end else begin 992 PlayersBrain[I + 3] := nil; 993 PlayersBrain[I + 6] := nil; 994 end; 986 if BrainDefault.Kind <> btNetworkClient then begin 987 if AutoDiff > 0 then begin 988 WriteString('DefaultAI', BrainDefault.FileName); 989 SlotAvailable := 0; // PlayerSlot will be invalid hereafter 990 PlayersBrain[0] := BrainTerm; 991 Difficulty[0] := PlayerAutoDiff[AutoDiff]; 992 for I := 1 to nPl - 1 do 993 if (Page = pgStartRandom) and (I <= AutoEnemies) or 994 (Page = pgStartMap) and (I < nMapStartPositions) then begin 995 if AutoDiff = 1 then PlayersBrain[I] := Brains.GetBeginner 996 else PlayersBrain[I] := BrainDefault; 997 Difficulty[I] := EnemyAutoDiff[AutoDiff]; 998 end else PlayersBrain[I] := nil; 999 end else begin 1000 for I := 6 to 8 do 1001 if (PlayersBrain[0].Kind <> btNoTerm) and (MultiControl and (1 shl I) <> 0) 1002 then begin 1003 PlayersBrain[I + 3] := PlayersBrain[I]; 1004 Difficulty[I + 3] := Difficulty[I]; 1005 PlayersBrain[I + 6] := PlayersBrain[I]; 1006 Difficulty[I + 6] := Difficulty[I]; 1007 end else begin 1008 PlayersBrain[I + 3] := nil; 1009 PlayersBrain[I + 6] := nil; 1010 end; 1011 end; 995 1012 end; 996 1013 … … 1162 1179 AIBrains: TBrains; 1163 1180 begin 1181 FixedLines := 0; 1164 1182 PlayerPopupIndex := PlayerIndex; 1165 1183 EmptyMenu(PopupMenu1.Items); 1166 1184 if PlayerPopupIndex < 0 then begin // select default AI 1167 FixedLines := 0; 1185 OfferBrain(BrainNetworkClient, FixedLines); 1186 Inc(FixedLines); 1187 1188 MenuItem := TMenuItem.Create(PopupMenu1); 1189 MenuItem.Caption := '-'; 1190 PopupMenu1.Items.Add(MenuItem); 1191 1192 Inc(FixedLines); 1168 1193 if Brains.GetKindCount(btAI) >= 2 then begin 1169 1194 OfferBrain(BrainRandom, FixedLines); … … 1177 1202 FreeAndNil(AIBrains); 1178 1203 end else begin 1179 FixedLines := 0;1180 1204 if PlayerPopupIndex > 0 then begin 1181 1205 OfferBrain(nil, FixedLines); … … 1189 1213 end; 1190 1214 if PlayerPopupIndex > 0 then begin 1215 OfferBrain(BrainNetworkServer, FixedLines); 1216 Inc(FixedLines); 1217 1191 1218 MenuItem := TMenuItem.Create(PopupMenu1); 1192 1219 MenuItem.Caption := '-'; … … 1267 1294 begin 1268 1295 PlayersBrain[0] := BrainSuperVirtual; 1269 Difficulty[0] := 0 1296 Difficulty[0] := 0; 1270 1297 end; 1271 1298 if PlayersBrain[0].Kind in [btNoTerm, btSuperVirtual] then … … 1424 1451 ChangeTab(TStartTab((x - TabOffset) div TabSize)); 1425 1452 end 1426 else if Page = pgMain then 1427 begin 1453 else if Page = pgMain then begin 1428 1454 case SelectedAction of 1429 maConfig: 1430 begin 1431 SettingsDlg := TSettingsDlg.Create(nil); 1432 if SettingsDlg.ShowModal = mrOk then begin 1433 LoadAssets; 1434 Invalidate; 1435 UpdateInterface; 1436 Background.UpdateInterface; 1437 end; 1438 FreeAndNil(SettingsDlg); 1439 end; 1440 maManual: 1441 DirectHelp(cStartHelp); 1442 maCredits: 1443 DirectHelp(cStartCredits); 1444 maAIDev: 1445 OpenDocument(HomeDir + AITemplateFileName); 1446 maWeb: 1447 OpenURL(CevoHomepage); 1455 maConfig: ShowSettings; 1456 maManual: DirectHelp(cStartHelp); 1457 maCredits: DirectHelp(cStartCredits); 1458 maAIDev: OpenDocument(HomeDir + AITemplateFileName); 1459 maWeb: OpenURL(CevoHomepage); 1448 1460 end; 1449 1461 end … … 1460 1472 else 1461 1473 PopupMenu1.Popup(left + xBrain[I] + 4, top + yBrain[I] + 4); 1462 end 1474 end; 1463 1475 end 1464 1476 else if (AutoDiff > 1) and ((Page = pgStartRandom) or (Page = pgStartMap)) and
Note:
See TracChangeset
for help on using the changeset viewer.