aboutsummaryrefslogtreecommitdiff
path: root/common.h
diff options
context:
space:
mode:
authorTrumeet <yuuta@yuuta.moe>2021-11-21 20:44:56 -0800
committerTrumeet <yuuta@yuuta.moe>2021-11-21 20:44:56 -0800
commitd8d478e4346d7f9b106d50728d840b1a171106f4 (patch)
tree3b9dbff28113bab8d1783ad606ab0d3ae39eff1a /common.h
parent844dc6a239f3b23cc861b38f0c84f9f7fb7036d8 (diff)
downloadmcal-d8d478e4346d7f9b106d50728d840b1a171106f4.tar
mcal-d8d478e4346d7f9b106d50728d840b1a171106f4.tar.gz
mcal-d8d478e4346d7f9b106d50728d840b1a171106f4.tar.bz2
mcal-d8d478e4346d7f9b106d50728d840b1a171106f4.zip
feat(expexc): support input dimensions and dimensions + positions
Diffstat (limited to 'common.h')
-rw-r--r--common.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/common.h b/common.h
index 950c9de..c78bc50 100644
--- a/common.h
+++ b/common.h
@@ -6,7 +6,7 @@
#include <assert.h>
#include <math.h>
-enum val_type { VEC3D, BOX };
+enum val_type { VEC3D, BOX, ENTITY_DIMEN };
struct val {
enum val_type type;
@@ -29,6 +29,12 @@ struct box {
double max_z;
};
+struct entity_dimen {
+ enum val_type type;
+ double width;
+ double height;
+};
+
static inline double *val_get_index(struct val *val, int index)
{
switch (val->type)
@@ -54,6 +60,14 @@ static inline double *val_get_index(struct val *val, int index)
case 5: return &v_box->max_z;
default: assert(0);
}
+ case ENTITY_DIMEN:
+ struct entity_dimen *v_dimen = (struct entity_dimen *)val;
+ switch (index)
+ {
+ case 0: return &v_dimen->width;
+ case 1: return &v_dimen->height;
+ default: assert(0);
+ }
default:
assert(0);
}
@@ -72,6 +86,9 @@ static int val_parse(char *in, struct val *o)
case BOX:
required_vars = 6;
break;
+ case ENTITY_DIMEN:
+ required_vars = 2;
+ break;
}
while (p != NULL)
{