- Timestamp:
- Jan 15, 2017, 5:04:32 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/Term.pas
r73 r74 3411 3411 with Reg do 3412 3412 try 3413 OpenKey( 'SOFTWARE\cevo\RegVer9', false);3413 OpenKey(AppRegistryKey, false); 3414 3414 if ValueExists('TileWidth') then xxt := ReadInteger('TileWidth') div 2 3415 3415 else xxt := 48; … … 3423 3423 else CityRepMask := Cardinal(not chPopIncrease and not chNoGrowthWarning and 3424 3424 not chCaptured); 3425 CloseKey;3426 3425 if OptionChecked and (7 shl 16) = 0 then 3427 3426 OptionChecked := OptionChecked or (1 shl 16); … … 7993 7992 with Reg do 7994 7993 try 7995 OpenKey( 'SOFTWARE\cevo\RegVer9', true);7994 OpenKey(AppRegistryKey, true); 7996 7995 WriteInteger('TileWidth', xxt * 2); 7997 7996 WriteInteger('TileHeight', yyt * 2); … … 7999 7998 WriteInteger('MapOptionChecked', MapOptionChecked); 8000 7999 WriteInteger('CityReport', integer(CityRepMask)); 8001 CloseKey;8002 8000 finally 8003 8001 Free; -
trunk/ScreenTools.pas
r73 r74 215 215 216 216 UniFont: array [TFontType] of TFont; 217 AppRegistryKey: string = '\SOFTWARE\C-evo'; 217 218 218 219 implementation … … 1516 1517 procedure UnitInit; 1517 1518 begin 1518 Reg := TRegistry. create;1519 Reg := TRegistry.Create; 1519 1520 with Reg do 1520 1521 try 1521 OpenKey( 'SOFTWARE\cevo\RegVer9', true);1522 OpenKey(AppRegistryKey, True); 1522 1523 if ValueExists('Gamma') then 1523 1524 Gamma := ReadInteger('Gamma') … … 1634 1635 with Reg do 1635 1636 try 1636 OpenKey( 'SOFTWARE\cevo\RegVer9', true);1637 OpenKey(AppRegistryKey, True); 1637 1638 WriteString('Locale', LocaleCode); 1639 WriteInteger('Gamma', Gamma); 1638 1640 finally 1639 1641 Free; -
trunk/Start.pas
r73 r74 186 186 r0, r1: HRgn; 187 187 Reg: TRegistry; 188 FirstStart: Boolean;189 188 Location: TPoint; 190 189 begin 191 190 Reg := TRegistry.Create; 192 FirstStart := not Reg.KeyExists('SOFTWARE\cevo\RegVer9\Start'); 193 194 if FirstStart then 195 with Reg do begin 191 with Reg do try 196 192 // initialize AI assignment 197 OpenKey('SOFTWARE\cevo\RegVer9\Start', true); 198 for I := 0 to nPlOffered - 1 do 199 begin 193 OpenKey(AppRegistryKey + '\AI', True); 194 for I := 0 to nPlOffered - 1 do begin 200 195 if i = 0 then s := ':StdIntf' 201 196 else s := 'StdAI'; 202 WriteString('Control' + IntToStr(i), s); 203 WriteInteger('Diff' + IntToStr(i), 2); 197 if not ValueExists('Control' + IntToStr(i)) then 198 WriteString('Control' + IntToStr(i), s); 199 if not ValueExists('Diff' + IntToStr(i)) then 200 WriteInteger('Diff' + IntToStr(i), 2); 204 201 end; 205 202 WriteInteger('MultiControl', 0); 206 CloseKey; 207 end; 208 209 with Reg do begin 210 OpenKey('SOFTWARE\cevo\RegVer9\Start', False); 203 204 OpenKey(AppRegistryKey, True); 211 205 if ValueExists('WorldSize') then WorldSize := Reg.ReadInteger('WorldSize') 212 206 else WorldSize := DefaultWorldSize; … … 221 215 if ValueExists('AutoDiff') then AutoDiff := Reg.ReadInteger('AutoDiff') 222 216 else AutoDiff := 1; 223 CloseKey; 224 end; 225 226 FullScreen := true; 227 with Reg do begin 228 OpenKey('SOFTWARE\cevo\RegVer9', False); 217 229 218 if ValueExists('ScreenMode') then 230 219 ScreenMode := ReadInteger('ScreenMode') … … 244 233 ResolutionFreq); 245 234 {$ENDIF} 246 CloseKey;247 end;248 Reg.Free;235 finally 236 Free; 237 end; 249 238 250 239 ActionsOffered := [maManual, maCredits, maWeb]; … … 891 880 892 881 Reg := TRegistry.Create; 893 Reg.OpenKey('SOFTWARE\cevo\RegVer9\Start', true); 894 if Reg.ValueExists('GameCount') then GameCount := Reg.ReadInteger('GameCount') 895 else GameCount := 0; 896 897 if (AutoDiff < 0) and (bixView[0] = bixNoTerm) then 898 FileName := 'Round' + IntToStr(GetProcessID()) 899 else 900 begin 901 inc(GameCount); 902 FileName := Format(Phrases.Lookup('GAME'), [GameCount]); 882 with Reg do 883 try 884 OpenKey(AppRegistryKey, true); 885 if ValueExists('GameCount') then GameCount := ReadInteger('GameCount') 886 else GameCount := 0; 887 888 if (AutoDiff < 0) and (bixView[0] = bixNoTerm) then 889 FileName := 'Round' + IntToStr(GetProcessID()) 890 else begin 891 inc(GameCount); 892 FileName := Format(Phrases.Lookup('GAME'), [GameCount]); 893 end; 894 895 // save settings and AI assignment 896 if Page = pgStartRandom then begin 897 WriteInteger('WorldSize', WorldSize); 898 WriteInteger('LandMass', StartLandMass); 899 900 OpenKey(AppRegistryKey + '\AI', True); 901 if AutoDiff < 0 then 902 for i := 0 to nPlOffered - 1 do begin 903 if bixView[i] = -1 then 904 Reg.WriteString('Control' + IntToStr(i), '') 905 else Reg.WriteString('Control' + IntToStr(i), 906 Brain[bixView[i]].FileName); 907 WriteInteger('Diff' + IntToStr(i), Difficulty[i]); 908 end; 909 WriteInteger('MultiControl', MultiControl); 910 end; 911 912 OpenKey(AppRegistryKey, True); 913 if AutoDiff > 0 then 914 begin 915 WriteString('DefaultAI', Brain[bixDefault].FileName); 916 SlotAvailable := 0; // bixView will be invalid hereafter 917 bixView[0] := bixTerm; 918 Difficulty[0] := PlayerAutoDiff[AutoDiff]; 919 for i := 1 to nPl - 1 do 920 if (Page = pgStartRandom) and (i <= AutoEnemies) or 921 (Page = pgStartMap) and (i < nMapStartPositions) then begin 922 if AutoDiff = 1 then bixView[i] := bixBeginner 923 else bixView[i] := bixDefault; 924 Difficulty[i] := EnemyAutoDiff[AutoDiff]; 925 end else bixView[i] := -1; 926 end else begin 927 for i := 6 to 8 do 928 if (bixView[0] <> bixNoTerm) and (MultiControl and (1 shl i) <> 0) 929 then begin 930 bixView[i + 3] := bixView[i]; 931 Difficulty[i + 3] := Difficulty[i]; 932 bixView[i + 6] := bixView[i]; 933 Difficulty[i + 6] := Difficulty[i]; 934 end else begin 935 bixView[i + 3] := -1; 936 bixView[i + 6] := -1; 937 end 938 end; 939 940 WriteInteger('AutoDiff', AutoDiff); 941 WriteInteger('AutoEnemies', AutoEnemies); 942 WriteInteger('MaxTurn', MaxTurn); 943 WriteInteger('GameCount', GameCount); 944 finally 945 Free; 903 946 end; 904 905 // save settings and AI assignment906 if Page = pgStartRandom then907 begin908 Reg.WriteInteger('WorldSize', WorldSize);909 Reg.WriteInteger('LandMass', StartLandMass);910 if AutoDiff < 0 then911 for i := 0 to nPlOffered - 1 do912 begin913 if bixView[i] = -1 then914 Reg.WriteString('Control' + IntToStr(i), '')915 else916 Reg.WriteString('Control' + IntToStr(i),917 Brain[bixView[i]].FileName);918 Reg.WriteInteger('Diff' + IntToStr(i), Difficulty[i]);919 end;920 Reg.WriteInteger('MultiControl', MultiControl);921 end;922 923 if AutoDiff > 0 then924 begin925 Reg.WriteString('DefaultAI', Brain[bixDefault].FileName);926 SlotAvailable := 0; // bixView will be invalid hereafter927 bixView[0] := bixTerm;928 Difficulty[0] := PlayerAutoDiff[AutoDiff];929 for i := 1 to nPl - 1 do930 if (Page = pgStartRandom) and (i <= AutoEnemies) or931 (Page = pgStartMap) and (i < nMapStartPositions) then932 begin933 if AutoDiff = 1 then934 bixView[i] := bixBeginner935 else936 bixView[i] := bixDefault;937 Difficulty[i] := EnemyAutoDiff[AutoDiff];938 end939 else940 bixView[i] := -1;941 end942 else943 begin944 for i := 6 to 8 do945 if (bixView[0] <> bixNoTerm) and (MultiControl and (1 shl i) <> 0)946 then947 begin948 bixView[i + 3] := bixView[i];949 Difficulty[i + 3] := Difficulty[i];950 bixView[i + 6] := bixView[i];951 Difficulty[i + 6] := Difficulty[i];952 end953 else954 begin955 bixView[i + 3] := -1;956 bixView[i + 6] := -1;957 end958 end;959 960 Reg.WriteInteger('AutoDiff', AutoDiff);961 Reg.WriteInteger('AutoEnemies', AutoEnemies);962 Reg.WriteInteger('MaxTurn', MaxTurn);963 Reg.WriteInteger('GameCount', GameCount);964 Reg.closekey;965 Reg.Free;966 947 967 948 StartNewGame(DataDir + 'Saved' + DirectorySeparator, FileName + '.cevo', MapFileName, … … 976 957 begin 977 958 Reg := TRegistry.Create; 978 Reg.OpenKey('SOFTWARE\cevo\RegVer9\Start', true); 979 if Reg.ValueExists('MapCount') then 980 MapCount := Reg.ReadInteger('MapCount') 981 else MapCount := 0; 982 inc(MapCount); 983 Reg.WriteInteger('MapCount', MapCount); 984 Reg.closekey; 985 Reg.Free; 959 with Reg do 960 try 961 OpenKey(AppRegistryKey, True); 962 if ValueExists('MapCount') then MapCount := ReadInteger('MapCount') 963 else MapCount := 0; 964 Inc(MapCount); 965 WriteInteger('MapCount', MapCount); 966 finally 967 Free; 968 end; 986 969 MapFileName := Format(Phrases.Lookup('MAP'), [MapCount]) + '.cevo map'; 987 970 EditMap(MapFileName, lxpre[WorldSize], lypre[WorldSize], StartLandMass); … … 1418 1401 begin // restore AI assignment of last start 1419 1402 Reg := TRegistry.Create; 1420 Reg.OpenKey('SOFTWARE\cevo\RegVer9\Start', false); 1421 for p1 := 0 to nPlOffered - 1 do 1422 begin 1423 bixView[p1] := -1; 1424 s := Reg.ReadString('Control' + IntToStr(p1)); 1425 Difficulty[p1] := Reg.ReadInteger('Diff' + IntToStr(p1)); 1426 if s <> '' then 1427 for j := 0 to nBrain - 1 do 1428 if AnsiCompareFileName(s, Brain[j].FileName) = 0 then 1429 bixView[p1] := j; 1403 with Reg do 1404 try 1405 OpenKey(AppRegistryKey + '\AI', True); 1406 for p1 := 0 to nPlOffered - 1 do begin 1407 bixView[p1] := -1; 1408 s := ReadString('Control' + IntToStr(p1)); 1409 Difficulty[p1] := ReadInteger('Diff' + IntToStr(p1)); 1410 if s <> '' then 1411 for j := 0 to nBrain - 1 do 1412 if AnsiCompareFileName(s, Brain[j].FileName) = 0 then 1413 bixView[p1] := j; 1414 end; 1415 MultiControl := Reg.ReadInteger('MultiControl'); 1416 finally 1417 Free; 1430 1418 end; 1431 MultiControl := Reg.ReadInteger('MultiControl');1432 Reg.closekey;1433 Reg.Free;1434 1419 end 1435 1420 else
Note:
See TracChangeset
for help on using the changeset viewer.