summaryrefslogtreecommitdiff
path: root/height-map-display/src/map/square.c
diff options
context:
space:
mode:
Diffstat (limited to 'height-map-display/src/map/square.c')
-rw-r--r--height-map-display/src/map/square.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/height-map-display/src/map/square.c b/height-map-display/src/map/square.c
new file mode 100644
index 0000000..707f8b7
--- /dev/null
+++ b/height-map-display/src/map/square.c
@@ -0,0 +1,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; i < 4; i++) {
+ square->nodes[i]->elevation = square->nodes[i]->elevation + diff;
+ }
+}