This commit is contained in:
ThomasBallantine 2025-08-12 22:38:23 +01:00
parent 3a4bec5028
commit a81ed99e82

View File

@ -76,12 +76,15 @@ void movenorth(Housearray* f, char direction){
//update y coordinate
f->y·coord--;
//check if expansion needed
if (f->y·coord < 0){
if (f->y·coord - f->y_coord_origin < 0){
//Expand north
int new_rows = old_rows +1;
int new_cols = old_cols;
//creates am array of pointers to point to my rows of integers
int** new_grid = (int**)malloc(new_rows * sizeof(int*));
if (new_grid == NULL){
return;
}
for (int i = 0; i< old_rows; ++i){
new_grid[i+1] = f->houses[i];//repeat without the plus one for the southward add row
}