Skip to content

Commit

Permalink
Fix building count not working for small areas
Browse files Browse the repository at this point in the history
  • Loading branch information
Keriew committed Sep 1, 2024
1 parent 19aad70 commit 0d2f3a0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/building/count.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ int building_count_upgraded(building_type type)

int building_count_in_area(building_type type, int minx, int miny, int maxx, int maxy)
{
int grid_area = abs((maxx - minx) * (maxy - miny));
int grid_area = abs((maxx - minx + 1) * (maxy - miny + 1));
int array_size = grid_area < building_count() ? grid_area : building_count();
int *found_buildings = (int *) malloc(array_size * sizeof(int));

Expand Down

0 comments on commit 0d2f3a0

Please sign in to comment.