Changeset 361 for branches/highdpi/CmdList.pas
- Timestamp:
- Apr 9, 2021, 5:56:50 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/CmdList.pas
r303 r361 14 14 15 15 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; 20 21 end; 21 22 … … 72 73 end; 73 74 74 procedure TCmdList.Get(var Command, Player, Subject: integer; 75 var Data: pointer); 75 procedure TCmdList.Get(var Command, Player, Subject: integer; var Data: pointer); 76 76 var 77 DirCode, code: Cardinal; 77 DirCode: Cardinal; 78 Code: Cardinal; 78 79 begin 79 80 if FState.LoadMoveCode > 0 then … … 94 95 end; 95 96 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; 112 105 end; 113 106 Data := nil; … … 135 128 begin 136 129 FState.LoadMoveCode := code and $FF; 137 inc(FState.LoadPos) 130 inc(FState.LoadPos); 138 131 end 139 132 else … … 143 136 end; 144 137 Get(Command, Player, Subject, Data); 145 exit;138 Exit; 146 139 end; 147 140 … … 152 145 Data := @LogData[FState.LoadPos]; 153 146 inc(FState.LoadPos, Command and $F * 4); 154 end 155 end 147 end; 148 end; 156 149 end; 157 150 … … 164 157 inc(FState.LoadPos, 4); 165 158 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 170 161 Map1 := Cardinal((@LogData[FState.LoadPos])^); 171 162 inc(FState.LoadPos, 4); 172 163 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 175 165 if b0 * 32 + b1 < DataSize then 176 166 PData(Data)[b0 * 32 + b1] := Cardinal((@LogData[FState.LoadPos])^); … … 180 170 inc(b0); 181 171 Map0 := Map0 shr 1; 182 end 172 end; 183 173 end; 184 174 … … 190 180 begin // move command shortcut 191 181 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; 208 190 end; 209 191 if Subject = FState.LastMovingUnit then … … 231 213 begin 232 214 PutData(@FState.MoveCode, 3); 233 FState.MoveCode := code 215 FState.MoveCode := code; 234 216 end; 235 217 FState.LastMovingUnit := Subject; … … 306 288 code := Cardinal(Command - sExecute) shl 2 + Cardinal(Player) shl 16; 307 289 Cardinal((@LogData[FState.nLog])^) := code; 308 FState.nLog := MapPos 290 FState.nLog := MapPos; 309 291 end; 310 292 … … 329 311 PutData(@FState.MoveCode, 3); // Single M 330 312 FState.MoveCode := 0; 331 end 313 end; 332 314 end; 333 315 … … 346 328 CompleteMoveCode; 347 329 f.write(FState.nLog, 4); 348 f.write(LogData^, FState.nLog) 330 f.write(LogData^, FState.nLog); 349 331 end; 350 332 … … 355 337 f.write(FState.nLog, 4); 356 338 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); 358 340 end; 359 341 … … 370 352 result := (FState.LoadPos shr 8) * 999 div (FState.nLog shr 8) 371 353 else 372 result := FState.LoadPos * 999 div FState.nLog 354 result := FState.LoadPos * 999 div FState.nLog; 373 355 end; 374 356
Note:
See TracChangeset
for help on using the changeset viewer.