Changeset 592 for trunk/AI Template


Ignore:
Timestamp:
Aug 10, 2024, 3:40:04 PM (4 months ago)
Author:
chronos
Message:
  • Fixed: Avoided more GTK2 chrashes.
  • Fixed: Build StdAI with O1 optimization level to avoid crash.
  • Modified: Code cleanup.
Location:
trunk/AI Template
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/AI Template/AI.pas

    r582 r592  
    185185          begin // tile is exploited, but not the city own tile -- check if improvable
    186186            RadiusLoc := Radius[V21];
    187             assert((RadiusLoc >= 0) and (RadiusLoc < MapSize));
     187            Assert((RadiusLoc >= 0) and (RadiusLoc < MapSize));
    188188            if (RadiusLoc >= 0) and (RadiusLoc < MapSize) then
    189189            begin
  • trunk/AI Template/CustomAI.pas

    r583 r592  
    687687  Result := True;
    688688  // always returns true so that it can be used like
    689   // "assert(DebugMessage(...));" -> not compiled in release build
     689  // "Assert(DebugMessage(...));" -> not compiled in release build
    690690end;
    691691
     
    696696  Result := True;
    697697  // always returns true so that it can be used like
    698   // "assert(SetDebugMap(...));" -> not compiled in release build
     698  // "Assert(SetDebugMap(...));" -> not compiled in release build
    699699end;
    700700
  • trunk/AI Template/ToolAI.pas

    r582 r592  
    293293procedure TToolAI.JobAssignment_AddUnit(uix: integer);
    294294begin
    295   assert(MyModel[MyUnit[uix].mix].Kind in [mkSettler, mkSlaves]);
     295  Assert(MyModel[MyUnit[uix].mix].Kind in [mkSettler, mkSlaves]);
    296296  JobLocOfSettler[uix] := ToAssign;
    297297end;
     
    598598  MoveCost, RecoverCost: integer;
    599599begin
    600   assert(((FromTile and fTerrain <= fMountains) or (FromTile and fTerrain = fUNKNOWN)) and
     600  Assert(((FromTile and fTerrain <= fMountains) or (FromTile and fTerrain = fUNKNOWN)) and
    601601    ((ToTile and fTerrain <= fMountains) or (ToTile and fTerrain = fUNKNOWN)));
    602602  // do not pass location codes for FromTile and ToTile!
     
    775775  end
    776776
    777   else {if MoveStyle<msSpy+$10000000 then}
     777  else {if MoveStyle < msSpy + $10000000 then}
    778778  begin // spies
    779779    if (ToTile + 1) and fTerrain < fGrass + 1 then
     
    834834  // todo: check exit condition, e.g. whether destination reached
    835835
    836   Reached[Loc]:=true;
     836  Reached[Loc]:=True;
    837837  V8_to_Loc(Loc, Adjacent);
    838838  for V8:=0 to 7 do
     
    844844          Pile.Put(NextLoc, NextTime+RecoverTurns*$1000);
    845845        csForbiddenTile:
    846           Reached[NextLoc]:=true; // don't check moving there again
     846          Reached[NextLoc]:=True; // don't check moving there again
    847847        csCheckTerritory:
    848848          if RO.Territory[NextLoc]=RO.Territory[Loc] then
     
    954954  i: integer;
    955955begin
    956   assert(not InitComplete); // call order violation!
     956  Assert(not InitComplete); // call order violation!
    957957  if Map[MyUnit[uix].Loc] and fTerrain < fGrass then exit;
    958958  for i := 0 to nTransportLoad - 1 do
    959     if uix = uixTransportLoad[i] then exit;
     959    if uix = uixTransportLoad[i] then Exit;
    960960  uixTransportLoad[nTransportLoad] := uix;
    961961  Inc(nTransportLoad);
     
    966966  MoveStyle: integer;
    967967begin
    968   assert(not InitComplete); // call order violation!
    969   assert(MyModel[MyUnit[uix].mix].Cap[mcSeaTrans] > 0);
     968  Assert(not InitComplete); // call order violation!
     969  Assert(MyModel[MyUnit[uix].mix].Cap[mcSeaTrans] > 0);
    970970  TransportAvailable[uix] := 1;
    971971  with MyModel[MyUnit[uix].mix] do
     
    983983procedure TToolAI.SeaTransport_AddDestination(Loc: integer);
    984984begin
    985   assert(not InitComplete); // call order violation!
     985  Assert(not InitComplete); // call order violation!
    986986  Pile.Put(Loc, $800);
    987987  HaveDestinations := True;
     
    993993  Adjacent: TVicinity8Loc;
    994994begin
    995   assert(not InitComplete); // call order violation!
     995  Assert(not InitComplete); // call order violation!
    996996  InitComplete := True;
    997997  if HaveDestinations then
     
    10401040  GroupComplete: array[0..lxmax * lymax - 1] of boolean;
    10411041begin
    1042   assert(InitComplete); // call order violation!
     1042  Assert(InitComplete); // call order violation!
    10431043
    10441044  if HaveDestinations and (nTransportLoad > 0) then
     
    10541054          if (abs(a) <= 1) and (abs(b) <= 1) then
    10551055          begin
    1056             assert((a <> 0) or (b <> 0));
     1056            Assert((a <> 0) or (b <> 0));
    10571057            Inc(GroupCount);
    10581058          end;
     
    10901090    for tuix := 0 to nTransportLoad - 1 do
    10911091    begin
    1092       assert(Map[MyUnit[uixTransportLoad[tuix]].Loc] and fTerrain >= fGrass);
     1092      Assert(Map[MyUnit[uixTransportLoad[tuix]].Loc] and fTerrain >= fGrass);
    10931093      f := Formation[MyUnit[uixTransportLoad[tuix]].Loc];
    10941094      if f >= 0 then Inc(Arrived[f]);
Note: See TracChangeset for help on using the changeset viewer.