summaryrefslogtreecommitdiffstatsci
path: root/src/shapes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shapes.cpp')
-rw-r--r--src/shapes.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/shapes.cpp b/src/shapes.cpp
index b866bad..b2ae017 100644
--- a/src/shapes.cpp
+++ b/src/shapes.cpp
@@ -4,6 +4,7 @@
* Use of this source code is governed by the 3-Clause BSD license
* specified in the COPYING file included with this source code.
*/
+#include <err.h>
#include <string.h>
#include "shapes.h"
@@ -29,10 +30,9 @@ convertToFillType(const char *fill_name)
return (fill_type_t) i ;
i++;
}
- return (fill_type_t) 0;
+ errx(1, "Unknown fill type '%s' specified", fill_name);
}
-
const char *gShapes[] = {
"circle",
"rectangle",
@@ -53,7 +53,7 @@ convertToShapeType(const char* shape_name)
return (shape_type_t)(i + 1);
i++;
}
- return (shape_type_t) 0;
+ errx(1, "Unknown shape type '%s' specified", shape_name);
}
@@ -95,6 +95,18 @@ generate_random_shape()
return (shape_type_t) ((((double)(CB_SHAPE_END-1) * rand())/RAND_MAX) + 1);
}
+fill_type_t
+generate_random_fill_type()
+{
+#if 0
+ // TODO: Not all fill styles are implemented yet
+ return (fill_type_t) ((((double)(CB_FILL_END-1) * rand())/RAND_MAX) + 1);
+#else
+ // TODO: So for now only go up to solid fills
+ return (fill_type_t) ((((double)(CB_FILL_SOLID) * rand())/RAND_MAX) + 1);
+#endif
+}
+
/*
Local Variables:
mode:c++