revert old way of checking the end of array

This commit is contained in:
Mylloon 2022-11-15 14:55:35 +01:00
parent 205760ea89
commit cbf3651452
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -15,7 +15,7 @@ Table *generate_table(GLuint width, GLuint height, Pos origin, Uint32 color) {
hMax = table->height - hPas;
// Calcul l'espace neccessaire
int space_needed = 0;
int space_needed = 1;
for (GLuint i = wPas; i < wMax; i += wPas, space_needed += 4) {
for (GLuint j = hPas; j < hMax; j += hPas, space_needed += 4) {
}
@ -39,6 +39,7 @@ Table *generate_table(GLuint width, GLuint height, Pos origin, Uint32 color) {
*(tmp + 2) = i;
*(tmp + 3) = table->height;
}
*tmp = -1;
return table;
}
@ -51,7 +52,7 @@ void free_table(Table *table) {
void draw_table(Table *table) {
gl4dpSetColor(table->color);
for (int *ptr = table->lines; *ptr; ptr += 4) {
for (int *ptr = table->lines; *ptr != -1; ptr += 4) {
gl4dpLine(*ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3));
}
}