Changeset 355


Ignore:
Timestamp:
Apr 7, 2021, 4:25:54 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/CmdList.pas

    r290 r355  
    1414
    1515  TCmdListState = record
    16     nLog, { used size of LogData in bytes }
    17     LoadPos, { position in LogData when loading a game }
    18     LastMovingUnit: integer;
    19     MoveCode, LoadMoveCode: Cardinal;
     16    nLog: Integer; { used size of LogData in bytes }
     17    LoadPos: Integer; { position in LogData when loading a game }
     18    LastMovingUnit: Integer;
     19    MoveCode: Cardinal;
     20    LoadMoveCode: Cardinal;
    2021  end;
    2122
     
    7273end;
    7374
    74 procedure TCmdList.Get(var Command, Player, Subject: integer;
    75   var Data: pointer);
     75procedure TCmdList.Get(var Command, Player, Subject: integer; var Data: pointer);
    7676var
    77   DirCode, code: Cardinal;
     77  DirCode: Cardinal;
     78  Code: Cardinal;
    7879begin
    7980  if FState.LoadMoveCode > 0 then
     
    9495    end;
    9596    case DirCode of
    96       0:
    97         Command := sMoveUnit + $090;
    98       1:
    99         Command := sMoveUnit + $0F0;
    100       2:
    101         Command := sMoveUnit + $390;
    102       3:
    103         Command := sMoveUnit + $3F0;
    104       4:
    105         Command := sMoveUnit + $020;
    106       5:
    107         Command := sMoveUnit + $060;
    108       6:
    109         Command := sMoveUnit + $100;
    110       7:
    111         Command := sMoveUnit + $300;
     97      0: Command := sMoveUnit + $090;
     98      1: Command := sMoveUnit + $0F0;
     99      2: Command := sMoveUnit + $390;
     100      3: Command := sMoveUnit + $3F0;
     101      4: Command := sMoveUnit + $020;
     102      5: Command := sMoveUnit + $060;
     103      6: Command := sMoveUnit + $100;
     104      7: Command := sMoveUnit + $300;
    112105    end;
    113106    Data := nil;
     
    135128      begin
    136129        FState.LoadMoveCode := code and $FF;
    137         inc(FState.LoadPos)
     130        inc(FState.LoadPos);
    138131      end
    139132      else
     
    143136      end;
    144137      Get(Command, Player, Subject, Data);
    145       exit;
     138      Exit;
    146139    end;
    147140
     
    152145      Data := @LogData[FState.LoadPos];
    153146      inc(FState.LoadPos, Command and $F * 4);
    154     end
    155   end
     147    end;
     148  end;
    156149end;
    157150
     
    164157  inc(FState.LoadPos, 4);
    165158  b0 := 0;
    166   while Map0 > 0 do
    167   begin
    168     if Map0 and 1 <> 0 then
    169     begin
     159  while Map0 > 0 do begin
     160    if Map0 and 1 <> 0 then begin
    170161      Map1 := Cardinal((@LogData[FState.LoadPos])^);
    171162      inc(FState.LoadPos, 4);
    172163      for b1 := 0 to 31 do
    173         if 1 shl b1 and Map1 <> 0 then
    174         begin
     164        if 1 shl b1 and Map1 <> 0 then begin
    175165          if b0 * 32 + b1 < DataSize then
    176166            PData(Data)[b0 * 32 + b1] := Cardinal((@LogData[FState.LoadPos])^);
     
    180170    inc(b0);
    181171    Map0 := Map0 shr 1;
    182   end
     172  end;
    183173end;
    184174
     
    190180  begin // move command shortcut
    191181    case Command of
    192       sMoveUnit + $090:
    193         DirCode := 0;
    194       sMoveUnit + $0F0:
    195         DirCode := 1;
    196       sMoveUnit + $390:
    197         DirCode := 2;
    198       sMoveUnit + $3F0:
    199         DirCode := 3;
    200       sMoveUnit + $020:
    201         DirCode := 4;
    202       sMoveUnit + $060:
    203         DirCode := 5;
    204       sMoveUnit + $100:
    205         DirCode := 6;
    206       sMoveUnit + $300:
    207         DirCode := 7;
     182      sMoveUnit + $090: DirCode := 0;
     183      sMoveUnit + $0F0: DirCode := 1;
     184      sMoveUnit + $390: DirCode := 2;
     185      sMoveUnit + $3F0: DirCode := 3;
     186      sMoveUnit + $020: DirCode := 4;
     187      sMoveUnit + $060: DirCode := 5;
     188      sMoveUnit + $100: DirCode := 6;
     189      sMoveUnit + $300: DirCode := 7;
    208190    end;
    209191    if Subject = FState.LastMovingUnit then
     
    231213    begin
    232214      PutData(@FState.MoveCode, 3);
    233       FState.MoveCode := code
     215      FState.MoveCode := code;
    234216    end;
    235217    FState.LastMovingUnit := Subject;
     
    306288  code := Cardinal(Command - sExecute) shl 2 + Cardinal(Player) shl 16;
    307289  Cardinal((@LogData[FState.nLog])^) := code;
    308   FState.nLog := MapPos
     290  FState.nLog := MapPos;
    309291end;
    310292
     
    329311      PutData(@FState.MoveCode, 3); // Single M
    330312    FState.MoveCode := 0;
    331   end
     313  end;
    332314end;
    333315
     
    346328  CompleteMoveCode;
    347329  f.write(FState.nLog, 4);
    348   f.write(LogData^, FState.nLog)
     330  f.write(LogData^, FState.nLog);
    349331end;
    350332
     
    355337  f.write(FState.nLog, 4);
    356338  f.Position := f.Position + OldState.nLog;
    357   f.write(LogData[OldState.nLog], FState.nLog - OldState.nLog)
     339  f.write(LogData[OldState.nLog], FState.nLog - OldState.nLog);
    358340end;
    359341
     
    370352    result := (FState.LoadPos shr 8) * 999 div (FState.nLog shr 8)
    371353  else
    372     result := FState.LoadPos * 999 div FState.nLog
     354    result := FState.LoadPos * 999 div FState.nLog;
    373355end;
    374356
  • trunk/GameServer.pas

    r339 r355  
    148148  CCData: array [0 .. 14] of integer;
    149149  bix: TBrains; { brain of the players }
    150   DevModelTurn, { turn of last call to sResetModel }
    151   OriginalDataVersion: array [0 .. nPl - 1] of integer;
     150  DevModelTurn: array [0 .. nPl - 1] of Integer; { turn of last call to sResetModel }
     151  OriginalDataVersion: array [0 .. nPl - 1] of Integer;
    152152  SavedTiles { , SavedResourceWeights } : array [0 .. ncmax - 1] of Cardinal;
    153153  SavedData: array [0 .. nPl - 1] of pointer;
  • trunk/Packages/CevoComponents/ButtonBase.pas

    r135 r355  
    8080    end;
    8181    if (Button = mbLeft) and (@ClickProc <> nil) then
    82       ClickProc(self)
     82      ClickProc(self);
    8383  end
    8484  else
     
    116116      if @DownChangedProc <> nil then
    117117        DownChangedProc(self);
    118     end
     118    end;
    119119end;
    120120
Note: See TracChangeset for help on using the changeset viewer.