File tree Expand file tree Collapse file tree 1 file changed +22
-16
lines changed Expand file tree Collapse file tree 1 file changed +22
-16
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,20 @@ DONE: UI
246
246
0 T ! ( time )
247
247
0 H ! ( days of hunger ) ;
248
248
249
+ : BBUY ( o m p -- f )
250
+ ( ownd@ m@ #price -- ?bought )
251
+ ( if enough $ and if below )
252
+ ( building limit, buy and )
253
+ ( substract price from $. )
254
+ ( leave t/f result flag. )
255
+ OVER OVER ( o m p m p )
256
+ SWAP @ < ?BLD ( o m p f f )
257
+ AND IF ( o m p )
258
+ MINUS SWAP +! ( o )
259
+ 1 SWAP +! 1 ( tf )
260
+ ELSE 2DROP 0 ( ff )
261
+ THEN ; ( f )
262
+
249
263
: FINALIZE ( -- )
250
264
2 82 C! 148 710 ! ;
251
265
@@ -254,22 +268,14 @@ DONE: UI
254
268
ASCII N = 0= ( f )
255
269
WHILE
256
270
UI KEY ( S: a )
257
- DUP ASCII A = M @ #A >=
258
- AND ?BLD AND IF ( agro )
259
- 1 A +! M @ #A - M !
260
- THEN
261
- DUP ASCII F = M @ #F >=
262
- AND ?BLD AND IF ( fctry )
263
- 1 F +! M @ #F - M !
264
- THEN
265
- DUP ASCII S = M @ #SP >=
266
- AND ?BLD AND IF ( strge )
267
- 1 S +! M @ #SP - M !
268
- THEN
269
- DUP ASCII P = M @ #CP >=
270
- AND ?BLD AND IF ( pwrplnt )
271
- 1 C +! M @ #CP - M !
272
- THEN
271
+ DUP ASCII A = IF
272
+ A M #A BBUY DROP THEN
273
+ DUP ASCII F = IF
274
+ F M #F BBUY DROP THEN
275
+ DUP ASCII S = IF
276
+ S M #SP BBUY DROP THEN
277
+ DUP ASCII P = IF
278
+ C M #CP BBUY DROP THEN
273
279
( S: a )
274
280
DUP ASCII G = G @ 0 >
275
281
AND IF ( sellgd )
You can’t perform that action at this time.
0 commit comments