summaryrefslogtreecommitdiff
path: root/height-map-display/src/map/square.c
diff options
context:
space:
mode:
authorSchark <jordan@schark.online>2024-03-17 03:29:39 -0700
committerSchark <jordan@schark.online>2024-03-17 03:29:39 -0700
commitda23e84333230813e1cd688ce4b6ad92f9fdcf5c (patch)
tree59ff50ecb8d13eaf122a8016a6d7f26f7832b813 /height-map-display/src/map/square.c
parent6853e2f83904bafcc4f1131571ba92c7f79f44b3 (diff)
downloadgamedev-da23e84333230813e1cd688ce4b6ad92f9fdcf5c.tar.gz
gamedev-da23e84333230813e1cd688ce4b6ad92f9fdcf5c.zip
Square edge discrepancies, need to fix
Diffstat (limited to '')
-rw-r--r--height-map-display/src/map/square.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/height-map-display/src/map/square.c b/height-map-display/src/map/square.c
index 1d74ff5..f963fa3 100644
--- a/height-map-display/src/map/square.c
+++ b/height-map-display/src/map/square.c
@@ -5,17 +5,23 @@
#include <stdlib.h>
#include <malloc.h>
-Square* init_square(Node *nodes[4], Terrain_Type terrain) {
+Square* init_square(Node *tl, Node *tr, Node *bl, Node *br, Terrain_Type terrain) {
Square* square;
- for (int i; i < 4; i++) {
- square->nodes[i] = nodes[i];
- }
+ square->node_tl = tl;
+ square->node_tr = tr;
+ square->node_bl = bl;
+ square->node_br = br;
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;
- }
+ square->node_tl->elevation = square->node_tl->elevation + diff;
+ square->node_tr->elevation = square->node_tr->elevation + diff;
+ square->node_bl->elevation = square->node_bl->elevation + diff;
+ square->node_br->elevation = square->node_br->elevation + diff;
+}
+
+void change_square_terrain(Square* square, Terrain_Type terrain) {
+ square->terrain = terrain;
}