2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
|
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
|
-
+
+
+
+
|
// If a loop is found, call the handle_colliding function to determine what to do next.
// If there is no loop, allow the move to be retried later, trying objE's location next.
// Since there may be multiple objects in a location, which move in different directions,
// a variable "ch" mentions the next object to try, if it is VOIDLINK. If not, then once
// it reaches the end without finding a loop, it can try the next one, resetting ch to
// VOIDLINK. This will find not only loops, but also if there is a branch that is later
// merged; due to what this program needs to do, and how they will be dealt with after
// the potential loop is found, that isn't a problem.
// the potential loop is found, that isn't a problem. This algorithm also will not find
// some loops with multiple branches, but that is also OK, since the main handling of
// deferred movements will eventually try every object as an origin, and this will cause
// the loop to eventually be found.
static sqlite3_uint64 board[64]; // bit board for locations with possible collisions
Object*o=objects[obj];
Uint32 ch=VOIDLINK; // first object found in same place as other where it must be checked
Uint8 x=o->x;
Uint8 y=o->y;
Uint32 n,nn;
memset(board,0,sizeof(board));
|