Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. /*
  2. File: fn_castlingCheck.sqf
  3. Author: Stickie
  4. Edited by:
  5. Description:
  6. Handles all castling-related requirements.
  7. */
  8.  
  9. params [
  10. ["_board",objNull,[objNull]],
  11. ["_piece",objNull,[objNull]]
  12. ];
  13.  
  14. // If king has already moved, exit.
  15. if !(_piece getVariable "Chess_stillStartPos") exitWith {false};
  16.  
  17. // Figure out which rooks to verify
  18. _rooksToCheck = [];
  19. switch ((_piece getVariable "Chess_pieceName") select [1,1]) do {
  20. case "W":{
  21. _rooksToCheck = ["A1","H1"];
  22. };
  23. case "B":{
  24. _rooksToCheck = ["A8","H8"];
  25. };
  26. };
  27.  
  28. // Check if the rooks are still on starting positions.
  29. _rooksFound = [];
  30. {
  31. _GridPosNR = [_x] call ARM_Chess_fnc_gridPosToNr;
  32. _theRook = objNull;
  33. _theRook = ((_board getVariable "Chess_allPieces") select _GridPosNR);
  34. if !(_theRook isEqualTo objNull) then {
  35. _rooksFound pushBack _theRook;
  36. };
  37. } forEach _rooksToCheck;
  38.  
  39. if (count(_rooksFound) > 0) then {
  40.  
  41. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement