Ignore:
Timestamp:
May 9, 2020, 4:02:07 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved HighDPI branch. Imported new changes from trunk branch.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Database.pas

    r144 r210  
    1111const
    1212  // additional test flags
    13   FastContact = false; { extra small world with railroad everywhere }
     13  //{$DEFINE FastContact} { extra small world with railroad everywhere }
    1414
    1515  neumax = 4096;
     
    957957    end;
    958958    if (RealMap[Loc] xor Cardinal(OldTile)) and fTerrain <> 0 then
    959       result := true
     959      result := true;
    960960  end;
    961961end;
     
    991991    begin
    992992      z0 := 6 * y div ly;
    993       ZPlus := 6 * y / ly - z0
     993      ZPlus := 6 * y / ly - z0;
    994994    end
    995995    else
    996996    begin
    997997      z0 := 6 * (ly - 1 - y) div ly;
    998       ZPlus := 6 * (ly - 1 - y) / ly - z0
     998      ZPlus := 6 * (ly - 1 - y) / ly - z0;
    999999    end;
    10001000    p0 := 1;
     
    10061006      begin
    10071007        RndLow := i;
    1008         Break
    1009       end;
    1010       p0 := p0 - p
     1008        Break;
     1009      end;
     1010      p0 := p0 - p;
    10111011    end;
    10121012  end;
     
    10531053            Cost := 0;
    10541054          if Q.Put(Loc1, T + Cost shl 8 + 1) then
    1055             From[Loc1] := Loc
    1056         end
    1057       end
     1055            From[Loc1] := Loc;
     1056        end;
     1057      end;
    10581058    end;
    10591059    Loc1 := Loc;
     
    10751075        else if RealMap[Loc] and fTerrain >= fGrass then
    10761076          RealMap[Loc] := RealMap[Loc] or fRiver;
    1077       end
     1077      end;
    10781078    end
    10791079    else
    10801080      result := 0;
    1081     Q.Free
     1081    Q.Free;
    10821082  end;
    10831083
     
    14041404            CityLoc[c, nCityLoc[c]] := Loc;
    14051405            inc(nCityLoc[c])
    1406           end
    1407         end
     1406          end;
     1407        end;
    14081408      end;
    14091409      Loc := (Loc + 1) * primitive mod (MapSize + 1) - 1;
     
    15371537      IrrLoc[j] := IrrLoc[nIrrLoc - 1];
    15381538      dec(nIrrLoc);
    1539       dec(i)
     1539      dec(i);
    15401540    end;
    15411541  end;
     
    15901590            StartLoc2[p1] := Loc1;
    15911591        end;
    1592       end
     1592      end;
    15931593    end;
    15941594end; { StartPositions }
     
    16571657  i, p, p1, uix, Loc1: integer;
    16581658begin
    1659   if FastContact then { Railroad everywhere }
     1659  {$IFDEF FastContact}
     1660    { Railroad everywhere }
    16601661    for Loc1 := 0 to MapSize - 1 do
    16611662      if RealMap[Loc1] and fTerrain >= fGrass then
    16621663        RealMap[Loc1] := RealMap[Loc1] or fRR;
     1664  {$ENDIF}
    16631665
    16641666  { !!!for Loc1:=0 to MapSize-1 do
     
    17951797  StartPositions;
    17961798  InitGame;
    1797 end; { InitRandomGame }
     1799end;
    17981800
    17991801procedure InitMapGame(Human: integer);
     
    18031805  PredefinedStartPositions(Human);
    18041806  InitGame;
    1805 end; { InitMapGame }
     1807end;
    18061808
    18071809procedure ReleaseGame;
     
    18241826      FreeMem(RW[p1].MapObservedLast);
    18251827      FreeMem(RW[p1].Map);
    1826     end
     1828    end;
    18271829end;
    18281830
     
    19441946      begin
    19451947        result := eNoPreq;
    1946         exit
     1948        exit;
    19471949      end;
    19481950    end;
     
    19581960    begin
    19591961      result := eInvalid;
    1960       exit
     1962      exit;
    19611963    end; // no city found here
    19621964
     
    21142116          Det := TestDet;
    21152117          Cost := TestCost;
    2116         end
    2117       end
    2118     end
     2118        end;
     2119      end;
     2120    end;
    21192121  end;
    21202122end;
     
    21782180                UnitReport.ReportFlags := UnitReport.ReportFlags or urfDeployed;
    21792181          end;
    2180         end
     2182        end;
    21812183      end;
    21822184    end;
     
    23732375          end
    23742376          else
    2375             AddFlags := AddFlags or Map[Loc] and (fStealthUnit or fHiddenUnit)
    2376         end
     2377            AddFlags := AddFlags or Map[Loc] and (fStealthUnit or fHiddenUnit);
     2378        end;
    23772379    end; // if Mode>moLoading_Fast
    23782380
     
    24312433    ObserveLevel[Loc] := ObserveLevel[Loc] and not(3 shl (2 * pTell)) or
    24322434      Cardinal(Level) shl (2 * pTell);
    2433   end
     2435  end;
    24342436end; // DiscoverTile
    24352437
     
    24602462              result := DiscoverTile(Loc1, p, pTell, Level, EnableContact)
    24612463                or result;
    2462           end
     2464          end;
    24632465      end
    24642466      else
     
    24672469        if Level > OldLevel then
    24682470          result := DiscoverTile(Loc1, p, p, Level, EnableContact) or result;
    2469       end
     2471      end;
    24702472  end;
    24712473end;
     
    25002502              result := DiscoverTile(Loc1, p, pTell, Level, EnableContact)
    25012503                or result;
    2502           end
     2504          end;
    25032505      end
    25042506      else
     
    25072509        if Level > OldLevel then
    25082510          result := DiscoverTile(Loc1, p, p, Level, EnableContact) or result;
    2509       end
     2511      end;
    25102512    end;
    25112513    AdjacentFlags := AdjacentFlags shr 1;
     
    25702572            RW[pTell].EnemyCity[ecix].Loc := -1;
    25712573            RW[pTell].Map[Loc] := RW[pTell].Map[Loc] and not fCity
    2572           end
    2573         end
    2574       end
     2574          end;
     2575        end;
     2576      end;
    25752577    end;
    25762578end;
     
    25942596        RWemix[p, Occupant[Loc], unx.mix];
    25952597      inc(result);
    2596     end
    2597   end
     2598    end;
     2599  end;
    25982600end;
    25992601
     
    26552657            ClearFlags := ClearFlags or fOwnZoCUnit;
    26562658          RW[p].Map[Loc] := RW[p].Map[Loc] and not ClearFlags or AddFlags;
    2657         end
    2658       end
    2659     end
     2659        end;
     2660      end;
     2661    end;
    26602662end;
    26612663
     
    26912693            Tile1^ := Tile1^ or fInEnemyZoC;
    26922694            Break
    2693           end
    2694         end
    2695       end;
    2696     end
    2697   end
     2695          end;
     2696        end;
     2697      end;
     2698    end;
     2699  end;
    26982700end;
    26992701
     
    27212723          if (Loc1 >= 0) and (Loc1 < MapSize) then
    27222724            RW[p].Map[Loc1] := RW[p].Map[Loc1] or fInEnemyZoC
    2723         end
    2724       end
    2725     end
     2725        end;
     2726      end;
     2727    end;
    27262728end;
    27272729
     
    27402742  for Loc := 0 to MapSize - 1 do
    27412743    if PeacePlayer[RW[p].Territory[Loc]] then
    2742       RW[p].Map[Loc] := RW[p].Map[Loc] or fPeace
     2744      RW[p].Map[Loc] := RW[p].Map[Loc] or fPeace;
    27432745end;
    27442746
     
    27542756  p1: integer;
    27552757begin
    2756   assert(p >= 0); // no player's territory indicated by p=nPl
    2757   dec(TerritoryCount[RealMap[Loc] shr 27]);
    2758   inc(TerritoryCount[p]);
     2758  Assert(p >= 0); // no player's territory indicated by p=nPl
     2759  Dec(TerritoryCount[RealMap[Loc] shr 27]);
     2760  Inc(TerritoryCount[p]);
    27592761  RealMap[Loc] := RealMap[Loc] and not($F shl 27) or Cardinal(p) shl 27;
    27602762  if p = $F then
     
    27702772        else
    27712773          RW[p1].Map[Loc] := RW[p1].Map[Loc] and not fPeace;
    2772       end
     2774      end;
    27732775end;
    27742776
     
    27972799          ChangeTerritory(Loc, NewOwner);
    27982800        inc(i);
    2799       end
    2800   end
     2801      end;
     2802  end;
    28012803end;
    28022804
     
    28392841            then
    28402842              StolenDist[Loc1] := NewDist;
    2841           end
    2842         end
     2843          end;
     2844        end;
    28432845    end;
    28442846  end;
     
    28752877            Country[Loc1] := FormerCountry[Loc];
    28762878            Dist[Loc1] := NewDist;
    2877           end
    2878         end
    2879       end
     2879          end;
     2880        end;
     2881      end;
    28802882  end;
    28812883
     
    30263028    if RW[p].Model[mix].Flags and mdZOC <> 0 then
    30273029      ZoCMap[Loc] := 1;
    3028   end
     3030  end;
    30293031end;
    30303032
    30313033procedure CountLost(p, mix, Enemy: integer);
    30323034begin
    3033   inc(RW[p].Model[mix].Lost);
     3035  Inc(RW[p].Model[mix].Lost);
    30343036  TellAboutModel(Enemy, p, mix);
    3035   inc(Destroyed[Enemy, p, mix]);
     3037  Inc(Destroyed[Enemy, p, mix]);
    30363038end;
    30373039
     
    30643066    if Enemy >= 0 then
    30653067      CountLost(p, mix, Enemy);
    3066   end
    3067 end; { RemoveUnit }
     3068  end;
     3069end;
    30683070
    30693071procedure RemoveUnit_UpdateMap(p, uix: integer);
    30703072var
    3071   Loc0: integer;
     3073  Loc0: Integer;
    30723074begin
    30733075  Loc0 := RW[p].Un[uix].Loc;
     
    31383140    ChangeTerritory(Loc, p)
    31393141  end;
    3140 end; { FoundCity }
     3142end;
    31413143
    31423144procedure StealCity(p, cix: integer; SaveUnits: boolean);
     
    31783180        else
    31793181          RemoveUnit(p, uix1); // destroy supported units
    3180 end; // StealCity
     3182end;
    31813183
    31823184procedure DestroyCity(p, cix: integer; SaveUnits: boolean);
     
    31973199    RealMap[Loc] := RealMap[Loc] and not fCity;
    31983200    Loc := -1
    3199   end
    3200 end; // DestroyCity
     3201  end;
     3202end;
    32013203
    32023204procedure ChangeCityOwner(pOld, cixOld, pNew: integer);
     
    32753277    ChangeTerritory(Loc, pNew);
    32763278  end;
    3277 end; // ChangeCityOwner
     3279end;
    32783280
    32793281procedure CompleteJob(p, Loc, Job: integer);
     
    34113413      if RW[pAbout].Un[uix].Loc >= 0 then
    34123414        inc(UnCount[RW[pAbout].Un[uix].mix]);
    3413   end
     3415  end;
    34143416end;
    34153417
     
    34263428      begin
    34273429      end; }
    3428   end
     3430  end;
    34293431end;
    34303432
     
    34473449    rTarget.ResearchTech := rSender.ResearchTech;
    34483450    rTarget.ResearchDone := rSender.ResearchDone;
    3449     result := true
     3451    result := true;
    34503452  end;
    34513453  for i := 0 to nAdv - 1 do
     
    34533455    begin
    34543456      rTarget.Tech[i] := rSender.Tech[i];
    3455       result := true
    3456     end
     3457      result := true;
     3458    end;
    34573459end;
    34583460
     
    34743476    for mix := 0 to rTarget.nModelCounted - 1 do
    34753477      TellAboutModel(pTarget, pAbout, mix);
    3476     result := true
    3477   end
     3478    result := true;
     3479  end;
    34783480end;
    34793481
     
    34913493    MakeModelInfo(pTarget, i, RW[pTarget].Model[i], miTarget);
    34923494    if IsSameModel(miSender, miTarget) then
    3493       ok := false
     3495      ok := false;
    34943496  end;
    34953497  if ok then
     
    35093511    inc(Researched[pTarget]);
    35103512    TellAboutModel(pSender, pTarget, RW[pTarget].nModel - 1);
    3511   end
     3513  end;
    35123514end;
    35133515
     
    36623664            RecalcPeaceMap(pSender);
    36633665            RecalcPeaceMap(pTarget);
    3664           end
    3665         end
     3666          end;
     3667        end;
    36663668      end;
    36673669    opShipParts: // + number + part type shl 16
     
    36813683              RW[pSender].Ship[pTarget].Parts[i] := GShip[pTarget].Parts[i];
    36823684              RW[pTarget].Ship[pTarget].Parts[i] := GShip[pTarget].Parts[i];
    3683             end
    3684           end
     3685            end;
     3686          end;
    36853687        end
    36863688        else
     
    36953697          dec(RW[pSender].Money, Price - opMoney);
    36963698          inc(RW[pTarget].Money, Price - opMoney);
    3697         end
     3699        end;
    36983700      end
    36993701      else
     
    37103712          SeeTech(pTarget, Price - opTech);
    37113713          RW[pSender].EnemyReport[pTarget].Tech[Price - opTech] := tsSeen;
    3712         end
     3714        end;
    37133715      end
    37143716      else
     
    38073809      RecalcMapZoC(p);
    38083810      RecalcMapZoC(pWith);
    3809     end
     3811    end;
    38103812  end;
    38113813  if OldTreaty in [trPeace, trAlliance] then
     
    38133815    RecalcPeaceMap(p);
    38143816    RecalcPeaceMap(pWith);
    3815   end
     3817  end;
    38163818end;
    38173819
     
    38543856              if CopyMilReport(pCity, p, p1) then
    38553857                result := result or (2 shl (2 * p1));
    3856           end
     3858          end;
    38573859      end;
    38583860  end;
     
    39113913              if RW[p2].EnemyReport[p1].Tech[AgePreq[i]] < tsApplicable then
    39123914                RW[p2].EnemyReport[p1].Tech[AgePreq[i]] := tsCheat;
    3913       end
     3915      end;
    39143916    end;
    39153917
     
    39253927          GiveCivilReport(p, p1);
    39263928          GiveMilReport(p, p1);
    3927         end
    3928       end
     3929        end;
     3930      end;
    39293931  end;
    39303932end;
Note: See TracChangeset for help on using the changeset viewer.