summaryrefslogtreecommitdiff
path: root/src/ring.c
diff options
context:
space:
mode:
authorLouie S <louie@example.com>2023-10-24 13:31:17 -0400
committerLouie S <louie@example.com>2023-10-24 13:31:17 -0400
commit4cc4ba6bc250e8981a6fb3f6e6b96945a16628e5 (patch)
treec9f853616e5b791dd945290871ed6fbe644f4279 /src/ring.c
parent3c6cf0ed9980990ca07f6d76817814979691d65e (diff)
Working controls
Diffstat (limited to 'src/ring.c')
-rw-r--r--src/ring.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/ring.c b/src/ring.c
index 633648b..e73d477 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -19,8 +19,28 @@ void pickup_ring() {
}
}
- if(pickup > 0) {
+ if(pickup >= 0) {
held = &rings[pickup];
held->held = true;
+ towers[hover].rings[pickup] = false;
}
}
+
+bool drop_ring() {
+ int i;
+
+ // should not be called if we are not holding a ring
+ assert(held != NULL);
+
+ //determine if we are allowed to drop the ring here
+ for(i = 2; i > held->size; --i) {
+ if(towers[held->location].rings[i]) {
+ return false;
+ }
+ }
+
+ held->held = false;
+ towers[held->location].rings[i] = true;
+ held = NULL;
+ return true;
+}