Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- File: fn_castlingCheck.sqf
- Author: Stickie
- Edited by:
- Description:
- Handles all castling-related requirements.
- */
- params [
- ["_board",objNull,[objNull]],
- ["_piece",objNull,[objNull]]
- ];
- // If king has already moved, exit.
- if !(_piece getVariable "Chess_stillStartPos") exitWith {false};
- // Figure out which rooks to verify
- _rooksToCheck = [];
- switch ((_piece getVariable "Chess_pieceName") select [1,1]) do {
- case "W":{
- _rooksToCheck = ["A1","H1"];
- };
- case "B":{
- _rooksToCheck = ["A8","H8"];
- };
- };
- // Check if the rooks are still on starting positions.
- _rooksFound = [];
- {
- _GridPosNR = [_x] call ARM_Chess_fnc_gridPosToNr;
- _theRook = objNull;
- _theRook = ((_board getVariable "Chess_allPieces") select _GridPosNR);
- if !(_theRook isEqualTo objNull) then {
- _rooksFound pushBack _theRook;
- };
- } forEach _rooksToCheck;
- if (count(_rooksFound) > 0) then {
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement