Changeset 120 for trunk/Database.pas
- Timestamp:
- Feb 3, 2018, 5:03:31 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Database.pas
r45 r120 652 652 {$IFNDEF SCR} if x = 1 then 653 653 v := pi / 2 { first wave goes horizontal } 654 else {$ENDIF} v := Random * 2 * pi;654 else {$ENDIF} v := DelphiRandom * 2 * pi; 655 655 sa[x] := sin(v) / lx; 656 656 ca[x] := cos(v) / ly; … … 786 786 begin 787 787 inc(AreaCount[xBlock, yBlock]); 788 if Random(AreaCount[xBlock, yBlock]) = 0 then788 if DelphiRandom(AreaCount[xBlock, yBlock]) = 0 then 789 789 RareByArea[xBlock, yBlock] := Loc0 790 790 end … … 857 857 begin 858 858 inc(Cnt); 859 if Random(Cnt) = 0 then859 if DelphiRandom(Cnt) = 0 then 860 860 begin 861 861 xworst := x; … … 908 908 begin 909 909 inc(Cnt); 910 if Random(Cnt) = 0 then910 if DelphiRandom(Cnt) = 0 then 911 911 begin 912 912 iBest := i; … … 996 996 p := Zone[z0, i] * (1 - ZPlus) + Zone[z0 + 1, i] * ZPlus; 997 997 { weight between zones z0 and z0+1 } 998 if Random * p0 < p then998 if DelphiRandom * p0 < p then 999 999 begin 1000 1000 RndLow := i; … … 1136 1136 if plus > MapSize then 1137 1137 plus := MapSize; 1138 Loc0 := Random(MapSize);1138 Loc0 := DelphiRandom(MapSize); 1139 1139 for n := 0 to plus - 1 do 1140 1140 begin … … 1147 1147 1148 1148 for Loc0 := 0 to MapSize - 1 do 1149 if (RealMap[Loc0] = fGrass) and ( Random(100) < ShRandHills) then1149 if (RealMap[Loc0] = fGrass) and (DelphiRandom(100) < ShRandHills) then 1150 1150 RealMap[Loc0] := RealMap[Loc0] or fHills; 1151 1151 … … 1156 1156 for n := 0 to unification * MapSize div 100 do 1157 1157 begin 1158 y := Random(ly);1159 if abs(y - (ly shr 1)) > ly div 4 + Random(ly * hotunification div 100) then1158 y := DelphiRandom(ly); 1159 if abs(y - (ly shr 1)) > ly div 4 + DelphiRandom(ly * hotunification div 100) then 1160 1160 if y < ly shr 1 then 1161 1161 y := ly shr 1 - y 1162 1162 else 1163 1163 y := 3 * ly shr 1 - y; 1164 Loc0 := lx * y + Random(lx);1164 Loc0 := lx * y + DelphiRandom(lx); 1165 1165 if RealMap[Loc0] and fTerrain = fGrass then 1166 1166 begin 1167 Dir := Random(4);1167 Dir := DelphiRandom(4); 1168 1168 Loc1 := dLoc(Loc0, Dir and 1 * 2 - 1, Dir shr 1 * 2 - 1); 1169 1169 if (Loc1 >= 0) and (RealMap[Loc1] and fTerrain = fGrass) then … … 1198 1198 if RealMap[Loc0] and fTerrain = fGrass then 1199 1199 begin // change grassland to swamp 1200 if Random(100) < ShSwamp then1200 if DelphiRandom(100) < ShSwamp then 1201 1201 RealMap[Loc0] := RealMap[Loc0] and not fTerrain or fSwamp; 1202 1202 end; … … 1373 1373 end; 1374 1374 FillChar(nCityLoc, SizeOf(nCityLoc), 0); 1375 Loc := Random(MapSize);1375 Loc := DelphiRandom(MapSize); 1376 1376 for i := 0 to MapSize - 1 do 1377 1377 begin … … 1414 1414 begin // for all start continents 1415 1415 if sccount[c] = 1 then 1416 StartLoc0[p1] := CityLoc[c, Random(nCityLoc[c])]1416 StartLoc0[p1] := CityLoc[c, DelphiRandom(nCityLoc[c])] 1417 1417 else 1418 1418 begin … … 1431 1431 if nRest = 0 then 1432 1432 Break; 1433 j := Random(nRest);1433 j := DelphiRandom(nRest); 1434 1434 TestStartLoc[i] := RestLoc[j]; 1435 1435 RestLoc[j] := RestLoc[nRest - 1]; … … 1494 1494 if (Loc1 >= 0) and (Loc1 < MapSize) and 1495 1495 (RealMap[Loc1] and fDeadLands = 0) then 1496 if IsGoodTile(Loc1) and ( Random(CntGood) < MinGood - CntGoodGrass + 1)1496 if IsGoodTile(Loc1) and (DelphiRandom(CntGood) < MinGood - CntGoodGrass + 1) 1497 1497 then 1498 1498 begin … … 1504 1504 RealMap[Loc1] := RealMap[Loc1] and not fTerrain or fPrairie 1505 1505 else if (RealMap[Loc1] and fTerrain in [fPrairie, fTundra, fSwamp]) 1506 and ( Random(2) = 0) then1506 and (DelphiRandom(2) = 0) then 1507 1507 RealMap[Loc1] := RealMap[Loc1] and not fTerrain or fForest; 1508 1508 end; … … 1526 1526 while i > 0 do 1527 1527 begin 1528 j := Random(nIrrLoc);1528 j := DelphiRandom(nIrrLoc); 1529 1529 RealMap[IrrLoc[j]] := RealMap[IrrLoc[j]] or tiIrrigation; 1530 1530 IrrLoc[j] := IrrLoc[nIrrLoc - 1]; … … 1539 1539 begin 1540 1540 repeat 1541 i := Random(nAlive) + 11541 i := DelphiRandom(nAlive) + 1 1542 1542 until StartLoc0[i] >= 0; 1543 1543 StartLoc[p1] := StartLoc0[i]; … … 1580 1580 begin 1581 1581 inc(n); 1582 if Random(n) = 0 then1582 if DelphiRandom(n) = 0 then 1583 1583 StartLoc2[p1] := Loc1; 1584 1584 end; … … 1637 1637 imax := nPrefStartLoc0; 1638 1638 end; 1639 i := Random(imax + 1);1639 i := DelphiRandom(imax + 1); 1640 1640 StartLoc[p1] := StartLoc0[i]; 1641 1641 StartLoc2[p1] := StartLoc0[i]; … … 1657 1657 { !!!for Loc1:=0 to MapSize-1 do 1658 1658 if RealMap[Loc1] and fterrain>=fGrass then 1659 if random(3)=0 then RealMap[Loc1]:=RealMap[Loc1] or fRoad1660 else if random(3)=0 then RealMap[Loc1]:=RealMap[Loc1] or fRR;1659 if Delphirandom(3)=0 then RealMap[Loc1]:=RealMap[Loc1] or fRoad 1660 else if Delphirandom(3)=0 then RealMap[Loc1]:=RealMap[Loc1] or fRR; 1661 1661 {random Road and Railroad } 1662 1662 { !!!for Loc1:=0 to MapSize-1 do 1663 if (RealMap[Loc1] and fterrain>=fGrass) and ( random(20)=0) then1663 if (RealMap[Loc1] and fterrain>=fGrass) and (Delphirandom(20)=0) then 1664 1664 RealMap[Loc1]:=RealMap[Loc1] or fPoll; } 1665 1665 … … 1782 1782 procedure InitRandomGame; 1783 1783 begin 1784 RandSeed := RND;1784 DelphiRandSeed := RND; 1785 1785 CalculatePrimitive; 1786 1786 CreateElevation; … … 1792 1792 procedure InitMapGame(Human: integer); 1793 1793 begin 1794 RandSeed := RND;1794 DelphiRandSeed := RND; 1795 1795 FindContinents; 1796 1796 PredefinedStartPositions(Human); … … 2770 2770 i, dx, dy, dxMax, dyMax, Loc, NewOwner: integer; 2771 2771 begin 2772 if OriginLoc = -1 then 2773 raise Exception.Create('Location error'); 2772 2774 i := 0; 2773 2775 dyMax := 0;
Note:
See TracChangeset
for help on using the changeset viewer.