Changeset 548 for trunk/Database.pas


Ignore:
Timestamp:
Apr 21, 2024, 10:57:18 AM (3 weeks ago)
Author:
chronos
Message:
  • Fixed: Bad unit drawing in battle dialog.
  • Modified: Code cleanup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Database.pas

    r531 r548  
    262262begin
    263263  c0 := TechFormula_M[diff] * (nTech + 4) *
    264     exp((nTech + 4) / TechFormula_D[diff]);
     264    Exp((nTech + 4) / TechFormula_D[diff]);
    265265  if c0 >= $10000000 then
    266266    Result := $10000000
    267267  else
    268     Result := trunc(c0);
     268    Result := Trunc(c0);
    269269end;
    270270
     
    652652    Result := 0;
    653653    for I := 1 to D do
    654       Result := Result + sin(f1[I] * ((X * 2 + Y and 1) * sa[I] + Y * 1.5 *
     654      Result := Result + Sin(f1[I] * ((X * 2 + Y and 1) * sa[I] + Y * 1.5 *
    655655        ca[I])) * f2[I];
    656656    { x values effectively multiplied with 2 to get 2 horizantal periods
     
    662662  begin
    663663{$IFNDEF SCR} if X = 1 then
    664       V := pi / 2 { first wave goes horizontal }
    665     else {$ENDIF} V := DelphiRandom * 2 * pi;
    666     sa[X] := sin(V) / lx;
    667     ca[X] := cos(V) / ly;
    668     f1[X] := 2 * pi * exp(Detail * (X - 1));
    669     f2[X] := exp(-X * Smooth);
     664      V := Pi / 2 { first wave goes horizontal }
     665    else {$ENDIF} V := DelphiRandom * 2 * Pi;
     666    sa[X] := Sin(V) / lx;
     667    ca[X] := Cos(V) / ly;
     668    f1[X] := 2 * Pi * Exp(Detail * (X - 1));
     669    f2[X] := Exp(-X * Smooth);
    670670  end;
    671671
     
    679679      if X * 2 < imerge then
    680680        V := (X * 2 * V + (imerge - X * 2) * Value(X + lx, Y)) / imerge;
    681       V := V - sqr(sqr(2 * Y / ly - 1)); { soft cut at poles }
     681      V := V - Sqr(Sqr(2 * Y / ly - 1)); { soft cut at poles }
    682682      if V > maxv then
    683683        maxv := V;
     
    705705      I := A;
    706706      A := B;
    707       B := I
     707      B := I;
    708708    end;
    709709    if A > B then
     
    763763// must be done after FindContinents
    764764var
    765   I, J, Cnt, X, Y, dx, dy, Loc0, Loc1, xworst, yworst, totalrare, RareMaxWater,
     765  I, J, Cnt, X, Y, dx, dy, Loc0, Loc1, xworst, yworst, TotalRare, RareMaxWater,
    766766    RareType, iBest, jbest, MinDist, xBlock, yBlock, V8: Integer;
    767767  AreaCount, RareByArea, RareAdjacent: array [0 .. 7, 0 .. 4] of Integer;
     
    804804        end;
    805805    end;
    806     totalrare := 0;
     806    TotalRare := 0;
    807807    for X := 0 to 7 do
    808808      for Y := 0 to 4 do
    809809        if AreaCount[X, Y] > 0 then
    810           Inc(totalrare);
     810          Inc(TotalRare);
    811811    Inc(RareMaxWater);
    812   until totalrare >= 12;
    813 
    814   while totalrare > 12 do
     812  until TotalRare >= 12;
     813
     814  while TotalRare > 12 do
    815815  begin // remove rarebyarea resources too close to each other
    816816    FillChar(RareAdjacent, SizeOf(RareAdjacent), 0);
     
    876876        end;
    877877    AreaCount[xworst, yworst] := 0;
    878     Dec(totalrare);
     878    Dec(TotalRare);
    879879  end;
    880880
Note: See TracChangeset for help on using the changeset viewer.