salix/db/routines/srt/procedures/moving_CollidingSet.sql

26 lines
682 B
MySQL
Raw Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `srt`.`moving_CollidingSet`()
BEGIN
UPDATE srt.moving
SET isColliding = FALSE;
UPDATE srt.moving m1
JOIN srt.buffer sf1 ON sf1.id = m1.bufferFromFk
JOIN srt.buffer st1 ON st1.id = m1.bufferToFk
JOIN srt.movingState ms1 ON ms1.id = m1.stateFk
JOIN srt.moving m2
JOIN srt.buffer sf2 ON sf2.id = m2.bufferFromFk
JOIN srt.buffer st2 ON st2.id = m2.bufferToFk
JOIN srt.movingState ms2 ON ms2.id = m2.stateFk
SET m1.isColliding = TRUE
WHERE NOT ms1.isInterfering
AND ms2.isInterfering
AND (sf1.stratus = st2.stratus
OR
st1.stratus = sf2.stratus )
;
END$$
DELIMITER ;