diff options
Diffstat (limited to 'src/ring.c')
-rw-r--r-- | src/ring.c | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -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; +} |