Skip to content

Commit 7ed92ce

Browse files
committed
stop looking for pointer to element of array
1 parent 4c657c6 commit 7ed92ce

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void getSize(int *x, int *y) {
4848
*y = w.ws_row;
4949
}
5050
#endif
51-
#define g(x, y, u, v, s) for (int j = 0, X = x, Y = y; j < v && Y + j < h - X / w && Y >= 0 && X >= 0; ++j) memcpy(&f[Y + j][X], &s[j * u], u)
51+
#define g(x, y, u, v, s) for (int j = 0, X = x, Y = y; j < v && Y + j < h - X / w && Y >= 0 && X >= 0; ++j) memcpy(&f[Y + j][X], s + j * u, u)
5252
#define l(x, y, w, h, a, b, c, d) !((x - a > c && x >= a) || (a - x > w && a >= x) || (y - b > d && y >= b) || (b - y > h && b >= y))
5353
#define f(x, y, z) p.y += z * d; strcpy(b, x); break
5454
int main() {
@@ -80,7 +80,7 @@ int main() {
8080
p.y = p.y < 2 ? 2 : p.y >= h - 3 ? h - 3 : p.y; // make sure the player is in the screen (vertically)
8181
for (int i = A - 1; i--;) {
8282
*f[h] = 0;
83-
struct V *e = &a[i], *z = &m[i];
83+
struct V *e = a + i, *z = m + i;
8484
e->x += d * z->x; // move the asteroid in the x direction
8585
e->y += d * z->y; // move the asteroid in the y direction
8686
e->x < 0 - 3 || e->x >= w + 3 || e->y >= h + 2 || g ? e->y = -rand() % h * (1 + g), e->x = rand() % w, z->x = -8 + rand() % 15, z->y = 10 + rand() % 5 : 0;
@@ -94,7 +94,7 @@ int main() {
9494
for (int i = -2, j = 1e7, k, K = 0; i <= 2; i++, j /= 10, k = (l - start) / j % 10, K = k | K) f[1][w / 2 + i] = K ? '0' + k : ' '; // draw the score
9595
getSize(&W, &H); // get the new screen size
9696
if (W != w || H < h) exit(printf("\033[0;31m\nPlease don't resize the screen, it will break the program\033[0m\n")); // make sure the screen is not resized besides getting higher
97-
else printf("\033[0;4H%s", &f[0][4]); // print the screen
97+
else printf("\033[0;4H%s", f + 4); // print the screen
9898
while (GetTickCount() - l < 10); // wait for a bit
9999
g = 0;
100100
}

0 commit comments

Comments
 (0)