summaryrefslogtreecommitdiff
path: root/height-map-display/src/map/square.c
blob: 1d74ff53513db97f934448c6aa5631fff2cfb878 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "square.h"
#include "node.h"

#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>

Square* init_square(Node *nodes[4], Terrain_Type terrain) {
    Square* square;
    for (int i; i < 4; i++) {
        square->nodes[i] = nodes[i];
    }
    square->terrain = terrain;
    return square;
}

void change_square_height(Square* square, float diff) {
    for (int i = 0; i < 4; i++) {
        square->nodes[i]->elevation = square->nodes[i]->elevation + diff; 
    }
}