}
};
+static struct XY xy_directions[] =
+{
+ { -1, 0 },
+ { +1, 0 },
+ { 0, -1 },
+ { 0, +1 }
+};
+
// ----------------------------------------------------------------------------
// functions
static int getClosedTube(int x, int y)
{
- static int xy[4][2] =
- {
- { -1, 0 },
- { +1, 0 },
- { 0, -1 },
- { 0, +1 }
- };
+ struct XY *xy = xy_directions;
int element_old = IntelliDrawBuffer[x][y];
int direction_old = getOpenDirectionFromTube(element_old);
int direction_new = MV_NONE;
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int xx = x + xy[i][0];
- int yy = y + xy[i][1];
+ int xx = x + xy[i].x;
+ int yy = y + xy[i].y;
int dir = MV_DIR_FROM_BIT(i);
int dir_opposite = MV_DIR_OPPOSITE(dir);
static int getClosedBelt(int x, int y)
{
- static int xy[4][2] =
- {
- { -1, 0 },
- { +1, 0 },
- { 0, -1 },
- { 0, +1 }
- };
+ struct XY *xy = xy_directions;
int element_old = IntelliDrawBuffer[x][y];
int nr = getBeltNrFromBeltElement(element_old);
int direction_old = getOpenDirectionFromBelt(element_old);
for (i = MV_BIT_LEFT; i <= MV_BIT_RIGHT; i++)
{
- int xx = x + xy[i][0];
- int yy = y + xy[i][1];
+ int xx = x + xy[i].x;
+ int yy = y + xy[i].y;
int dir = MV_DIR_FROM_BIT(i);
int dir_opposite = MV_DIR_OPPOSITE(dir);
static int getClosedPool(int x, int y)
{
- static int xy[4][2] =
- {
- { -1, 0 },
- { +1, 0 },
- { 0, -1 },
- { 0, +1 }
- };
+ struct XY *xy = xy_directions;
int element_old = IntelliDrawBuffer[x][y];
int direction_old = getOpenDirectionFromPool(element_old);
int direction_new = MV_NONE;
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int xx = x + xy[i][0];
- int yy = y + xy[i][1];
+ int xx = x + xy[i].x;
+ int yy = y + xy[i].y;
int dir = MV_DIR_FROM_BIT(i);
int dir_opposite = MV_DIR_OPPOSITE(dir);
static int getClosedPillar(int x, int y)
{
- static int xy[4][2] =
- {
- { -1, 0 },
- { +1, 0 },
- { 0, -1 },
- { 0, +1 }
- };
+ struct XY *xy = xy_directions;
int element_old = IntelliDrawBuffer[x][y];
int direction_old = getOpenDirectionFromPillar(element_old);
int direction_new = MV_NONE;
for (i = MV_BIT_UP; i <= MV_BIT_DOWN; i++)
{
- int xx = x + xy[i][0];
- int yy = y + xy[i][1];
+ int xx = x + xy[i].x;
+ int yy = y + xy[i].y;
int dir = MV_DIR_FROM_BIT(i);
int dir_opposite = MV_DIR_OPPOSITE(dir);
static int getClosedSteel2(int x, int y)
{
- static int xy[4][2] =
- {
- { -1, 0 },
- { +1, 0 },
- { 0, -1 },
- { 0, +1 }
- };
+ struct XY *xy = xy_directions;
int element_old = IntelliDrawBuffer[x][y];
int direction_old = getOpenDirectionFromSteel2(element_old);
int direction_new = MV_NONE;
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int xx = x + xy[i][0];
- int yy = y + xy[i][1];
+ int xx = x + xy[i].x;
+ int yy = y + xy[i].y;
int dir = MV_DIR_FROM_BIT(i);
int dir_opposite = MV_DIR_OPPOSITE(dir);
static int getClosedChip(int x, int y)
{
- static int xy[4][2] =
- {
- { -1, 0 },
- { +1, 0 },
- { 0, -1 },
- { 0, +1 }
- };
+ struct XY *xy = xy_directions;
int element_old = IntelliDrawBuffer[x][y];
int direction_old = getOpenDirectionFromChip(element_old);
int direction_new = MV_NONE;
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int xx = x + xy[i][0];
- int yy = y + xy[i][1];
+ int xx = x + xy[i].x;
+ int yy = y + xy[i].y;
int dir = MV_DIR_FROM_BIT(i);
int dir_opposite = MV_DIR_OPPOSITE(dir);
static void SetElementIntelliDraw(int x, int y, int new_element,
boolean change_level, int button)
{
- static int xy[4][2] =
- {
- { -1, 0 },
- { +1, 0 },
- { 0, -1 },
- { 0, +1 }
- };
+ struct XY *xy = xy_directions;
static int last_x = -1;
static int last_y = -1;
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int xx = x + xy[i][0];
- int yy = y + xy[i][1];
+ int xx = x + xy[i].x;
+ int yy = y + xy[i].y;
if (last_x == xx && last_y == yy && IN_LEV_FIELD(last_x, last_y) &&
IS_TUBE(IntelliDrawBuffer[last_x][last_y]))
for (i = MV_BIT_LEFT; i <= MV_BIT_RIGHT; i++)
{
- int xx = x + xy[i][0];
- int yy = y + xy[i][1];
+ int xx = x + xy[i].x;
+ int yy = y + xy[i].y;
if (last_x == xx && last_y == yy && IN_LEV_FIELD(last_x, last_y) &&
IS_BELT(IntelliDrawBuffer[last_x][last_y]))
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int xx = x + xy[i][0];
- int yy = y + xy[i][1];
+ int xx = x + xy[i].x;
+ int yy = y + xy[i].y;
if (last_x == xx && last_y == yy && IN_LEV_FIELD(last_x, last_y) &&
IS_ACID_POOL_OR_ACID(IntelliDrawBuffer[last_x][last_y]))
for (i = MV_BIT_UP; i <= MV_BIT_DOWN; i++)
{
- int xx = x + xy[i][0];
- int yy = y + xy[i][1];
+ int xx = x + xy[i].x;
+ int yy = y + xy[i].y;
if (last_x == xx && last_y == yy && IN_LEV_FIELD(last_x, last_y) &&
IS_EMC_PILLAR(IntelliDrawBuffer[last_x][last_y]))
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int xx = x + xy[i][0];
- int yy = y + xy[i][1];
+ int xx = x + xy[i].x;
+ int yy = y + xy[i].y;
if (last_x == xx && last_y == yy && IN_LEV_FIELD(last_x, last_y) &&
IS_DC_STEELWALL_2(IntelliDrawBuffer[last_x][last_y]))
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int xx = x + xy[i][0];
- int yy = y + xy[i][1];
+ int xx = x + xy[i].x;
+ int yy = y + xy[i].y;
if (last_x == xx && last_y == yy && IN_LEV_FIELD(last_x, last_y) &&
IS_SP_CHIP(IntelliDrawBuffer[last_x][last_y]))
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int xx = x + xy[i][0];
- int yy = y + xy[i][1];
+ int xx = x + xy[i].x;
+ int yy = y + xy[i].y;
if (last_x == xx && last_y == yy && IN_LEV_FIELD(last_x, last_y) &&
IS_IN_GROUP_EL(IntelliDrawBuffer[last_x][last_y], new_element))