shrub/gen164/6/ut_park.c

104 lines
3.1 KiB
C
Raw Normal View History

2013-09-29 00:21:18 +04:00
/* j/6/ut_park.c
**
** This file is in the public domain.
*/
#include "all.h"
#include "../pit.h"
/* logic
*/
u2_bean // transfer
2014-08-21 01:18:34 +04:00
j2_mcx(Pt6, ut, park)(
2013-09-29 00:21:18 +04:00
u2_noun van, // retain
u2_noun sut, // retain
u2_noun way, // retain
u2_atom axe) // retain
{
2014-08-21 01:18:34 +04:00
if ( u2_no == u2du(sut) || c3__core != u2h(sut) ) {
return u2_cm_bail(c3__fail);
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:24:29 +04:00
// else if ( u2_no == u2_cj_hook(u2k(van), "vet") ) {
2014-08-21 01:18:34 +04:00
else if ( u2_no == u2_cr_at(j2_ut_van_vet, van) ) {
2013-09-29 00:21:18 +04:00
return u2_yes;
}
else {
u2_noun p_sut, q_sut, pq_sut;
2014-08-21 01:18:34 +04:00
u2_cx_cell(u2t(sut), &p_sut, &q_sut);
u2_cx_cell(q_sut, &pq_sut, 0);
2013-09-29 00:21:18 +04:00
2013-12-18 05:47:20 +04:00
if ( c3__both == way ) {
2013-12-27 00:58:55 +04:00
if ( c3__gold == pq_sut ) {
2013-12-18 05:47:20 +04:00
return u2_yes;
} else return u2_no;
}
2013-09-29 00:21:18 +04:00
if ( c3__read == way ) {
switch ( pq_sut ) {
2014-08-21 01:18:34 +04:00
default: return u2_cm_bail(c3__fail);
2013-09-29 00:21:18 +04:00
case c3__gold: return u2_yes;
case c3__lead: return u2_no;
case c3__iron: return u2_no;
case c3__zinc: return
2014-08-21 01:18:34 +04:00
u2_and(u2_not(u2_cr_sing(1, axe)),
2014-09-03 07:36:29 +04:00
u2_cr_sing(2, u2_cqc_cap(axe)));
2013-09-29 00:21:18 +04:00
}
}
else if ( c3__rite == way ) {
switch ( pq_sut ) {
2014-08-21 01:18:34 +04:00
default: return u2_cm_bail(c3__fail);
2013-09-29 00:21:18 +04:00
case c3__gold: return u2_yes;
case c3__lead: return u2_no;
case c3__iron: return
2014-08-21 01:18:34 +04:00
u2_and(u2_not(u2_cr_sing(1, axe)),
2014-09-03 07:36:29 +04:00
u2_cr_sing(2, u2_cqc_cap(axe)));
2013-09-29 00:21:18 +04:00
case c3__zinc: return u2_no;
}
}
2014-01-04 06:59:56 +04:00
else if ( c3__free == way ) { return u2_yes; }
2014-08-21 01:18:34 +04:00
else return u2_cm_bail(c3__fail);
2013-09-29 00:21:18 +04:00
}
}
/* boilerplate
*/
u2_ho_jet
2013-09-29 00:21:18 +04:00
j2_mcj(Pt6, ut, park)[];
u2_noun // transfer
2014-08-21 01:18:34 +04:00
j2_mc(Pt6, ut, park)(
2013-09-29 00:21:18 +04:00
u2_noun cor) // retain
{
u2_noun sut, way, axe, van;
2014-08-21 01:18:34 +04:00
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam_2, &way,
2013-09-29 00:21:18 +04:00
u2_cv_sam_3, &axe,
u2_cv_con, &van,
2013-09-29 00:21:18 +04:00
0)) ||
2014-08-21 01:18:34 +04:00
(u2_no == u2ud(axe)) ||
(u2_none == (sut = u2_cr_at(u2_cv_sam, van))) )
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return u2_cm_bail(c3__fail);
2013-09-29 00:21:18 +04:00
} else {
2014-08-21 01:18:34 +04:00
return j2_mcx(Pt6, ut, park)(van, sut, way, axe);
2013-09-29 00:21:18 +04:00
}
}
u2_noun // transfer
2014-09-03 07:36:29 +04:00
u2_cqfu_park(u2_noun van, // retain
2013-09-29 00:21:18 +04:00
u2_noun sut, // retain
u2_noun way, // retain
u2_noun axe) // retain
{
2014-08-28 23:40:40 +04:00
return j2_mcx(Pt6, ut, park)(van, sut, way, axe);
2013-09-29 00:21:18 +04:00
}
/* structures
*/
u2_ho_jet
2013-09-29 00:21:18 +04:00
j2_mcj(Pt6, ut, park)[] = {
{ ".2", c3__hevy, j2_mc(Pt6, ut, park), Tier6_b, u2_none, u2_none },
{ }
};