From f2c33f880f3fdc07f493d3626c667ec4fce31797 Mon Sep 17 00:00:00 2001 From: nihilazo Date: Thu, 1 Apr 2021 14:24:19 +0100 Subject: [PATCH] make unlocking functions clearer --- main.fs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.fs b/main.fs index 21505f3..657b7e9 100644 --- a/main.fs +++ b/main.fs @@ -79,14 +79,17 @@ S" you feel like throwing some stuff into the pool." set-message \ the word f!0= tests if a floating thing is non-zero : f!0= ( r -- flag ) f0= 0= ; +\ the word can-afford? tests if you could afford n of a currency. +: can-afford? ( n currency -- flag ) f@ s>f f>= ; + \ the world unlock-members tests to see if hiring chat members can be unlocked. if so, they are unlocked. : unlock-members - devices f@ ftrunc 5e f= membercost @ 0= and if + 5 devices can-afford? membercost @ 0= and if 10 membercost ! S" A friendly townie wants to help out." set-message then ; : unlock-constructs - devices f@ ftrunc 30e f= constructcost @ 0= and if + 30 devices can-afford? constructcost @ 0= and if 40 constructcost ! S" You figure out that you can probably hack these devices." set-message then ; @@ -126,9 +129,6 @@ S" you feel like throwing some stuff into the pool." set-message \ the word exit-game exits the game. : exit-game page show-cursor bye ; -\ the word can-afford? tests if you could afford n of a currency. -: can-afford? ( n currency -- flag ) f@ s>f f>= ; - \ the word pay pays an amount of a currency. : pay ( n currency -- ) dup f@ swap s>f ( fswap ) f- f! ;